Skip to content

Commit

Permalink
feat: update the examples apps to the latest sdk version (#765)
Browse files Browse the repository at this point in the history
  • Loading branch information
omridan159 authored Mar 15, 2024
1 parent 9e79977 commit be50020
Show file tree
Hide file tree
Showing 33 changed files with 4,485 additions and 5,641 deletions.
2 changes: 1 addition & 1 deletion packages/examples/create-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"homepage": "./",
"dependencies": {
"@metamask/sdk-react": "^0.16.0",
"@metamask/sdk-react": "^0.17.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/examples/create-react-app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const App = () => {
const to = '0x0000000000000000000000000000000000000000';
const transactionParameters = {
to, // Required except during contract publications.
from: provider?.selectedAddress, // must match user's active address.
from: provider?.getSelectedAddress(), // must match user's active address.
value: '0x5AF3107A4000', // Only required to send ether to the recipient from the initiating external account.
};

Expand All @@ -115,7 +115,7 @@ export const App = () => {
setResponse(`invalid ethereum provider`);
return;
}
const result = await send_eth_signTypedData_v4(provider, provider.chainId);
const result = await send_eth_signTypedData_v4(provider, provider.getChainId());
setResponse(result);
};

Expand Down Expand Up @@ -206,7 +206,7 @@ export const App = () => {
Send transaction
</button>

{ provider?.chainId === '0x1' ? (
{ provider?.getChainId() === '0x1' ? (
<button
className={'Button-Normal'}
style={{ padding: 10, margin: 10 }}
Expand Down
4 changes: 2 additions & 2 deletions packages/examples/create-react-app/src/SignHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const send_eth_signTypedData_v4 = async (provider: SDKProvider, chainId:
},
});

let from = provider?.selectedAddress;
let from = provider?.getSelectedAddress();

console.debug(`sign from: ${from}`);
try {
Expand All @@ -87,7 +87,7 @@ export const send_eth_signTypedData_v4 = async (provider: SDKProvider, chainId:

export const send_personal_sign = async (provider: SDKProvider) => {
try {
const from = provider.selectedAddress;
const from = provider.getSelectedAddress();
const message = 'Hello World from the Create React dapp!';
const hexMessage = '0x' + Buffer.from(message, 'utf8').toString('hex');

Expand Down
Loading

0 comments on commit be50020

Please sign in to comment.