diff --git a/package.json b/package.json index 1aaa58d27..21d51b06b 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "@ledgerhq/hw-transport": "6.27.1", "@ledgerhq/hw-transport-webhid": "6.27.1", "@metamask/detect-provider": "^2.0.0", - "@meteorwallet/sdk": "^0.8.0", + "@meteorwallet/sdk": "^1.0.5", "@mintbase-js/wallet": "0.5.0-beta.6", "@near-snap/sdk": "^0.6.0", "@peersyst/near-mobile-signer": "^1.0.10", diff --git a/packages/meteor-wallet/src/lib/meteor-wallet.ts b/packages/meteor-wallet/src/lib/meteor-wallet.ts index 936f6b7b9..5c52c22fc 100644 --- a/packages/meteor-wallet/src/lib/meteor-wallet.ts +++ b/packages/meteor-wallet/src/lib/meteor-wallet.ts @@ -2,8 +2,6 @@ import type { Account, InjectedWallet, Network, - Optional, - Transaction, WalletBehaviourFactory, WalletModuleFactory, } from "@near-wallet-selector/core"; @@ -16,7 +14,6 @@ import { EMeteorWalletSignInType, MeteorWallet as MeteorWalletSdk, } from "@meteorwallet/sdk"; -import { createAction } from "@near-wallet-selector/wallet-utils"; import icon from "./icon"; const setupWalletState = async ( @@ -68,45 +65,6 @@ const createMeteorWalletInjected: WalletBehaviourFactory< ]; }; - const transformTransactions = async ( - transactions: Array> - ) => { - const account = _state.wallet.account()!; - const { networkId, signer, provider } = account.connection; - - const localKey = await signer.getPublicKey(account.accountId, networkId); - - return Promise.all( - transactions.map(async (transaction, index) => { - const actions = transaction.actions.map((action) => - createAction(action) - ); - const accessKey = await account.accessKeyForTransaction( - transaction.receiverId, - actions, - localKey - ); - - if (!accessKey) { - throw new Error( - `Failed to find matching key for transaction sent to ${transaction.receiverId}` - ); - } - - const block = await provider.block({ finality: "final" }); - - return nearAPI.transactions.createTransaction( - account.accountId, - nearAPI.utils.PublicKey.from(accessKey.public_key), - transaction.receiverId, - accessKey.access_key.nonce + index + 1, - actions, - nearAPI.utils.serialize.base_decode(block.header.hash) - ); - }) - ); - }; - return { async signIn({ contractId, methodNames = [] }) { logger.log("MeteorWallet:signIn", { @@ -205,7 +163,7 @@ const createMeteorWalletInjected: WalletBehaviourFactory< return account["signAndSendTransaction_direct"]({ receiverId: receiverId ?? contract!.contractId, - actions: actions.map((action) => createAction(action)), + actions, }); }, @@ -219,7 +177,7 @@ const createMeteorWalletInjected: WalletBehaviourFactory< } return _state.wallet.requestSignTransactions({ - transactions: await transformTransactions(transactions), + transactions, }); }, diff --git a/yarn.lock b/yarn.lock index 692eed7d4..4fd88e53f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3455,13 +3455,14 @@ resolved "https://registry.yarnpkg.com/@metamask/detect-provider/-/detect-provider-2.0.0.tgz#4bc2795e5e6f7d8b84b2e845058d2f222c99917d" integrity sha512-sFpN+TX13E9fdBDh9lvQeZdJn4qYoRb/6QF2oZZK/Pn559IhCFacPMU1rMuqyXoFQF3JSJfii2l98B87QDPeCQ== -"@meteorwallet/sdk@^0.8.0": - version "0.8.0" - resolved "https://registry.yarnpkg.com/@meteorwallet/sdk/-/sdk-0.8.0.tgz#913732c1c5210a05e008a3aedc664b16c728f682" - integrity sha512-C0x9/20t+lCMUlKSPSAbPUWjz8Ls59NwWnz/qSJM5B4qCXN3OSCcrqmpbJpSVa2wCHFhK/HuOqaKlMCr0XsQ0w== +"@meteorwallet/sdk@^1.0.5": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@meteorwallet/sdk/-/sdk-1.0.5.tgz#1a878bc1357b8818cc3240a44709a6fe9971c3e1" + integrity sha512-2HT3F6O8lMvj1STD/ir09R43jPLlRVFPoR8dD+qsASUe73ZJumX8r3Uef4g9waAjKZza5B7wmi4XpamFaKrlkg== dependencies: - nanoid "3.3.4" - query-string "^7.1.1" + borsh "^0.7.0" + nanoid "3.3.6" + query-string "^7.1.3" "@mintbase-js/wallet@0.5.0-beta.6": version "0.5.0-beta.6" @@ -16056,20 +16057,20 @@ mute-stream@0.0.8, mute-stream@~0.0.4: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== -nanoid@3.3.4, nanoid@^3.3.4: - version "3.3.4" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" - integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== +nanoid@3.3.6, nanoid@^3.3.6: + version "3.3.6" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c" + integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA== nanoid@^3.1.20: version "3.3.7" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== -nanoid@^3.3.6: - version "3.3.6" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c" - integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA== +nanoid@^3.3.4: + version "3.3.4" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" + integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== nanoid@^4.0.0: version "4.0.2" @@ -18308,7 +18309,7 @@ qs@~6.10.3: dependencies: side-channel "^1.0.4" -query-string@7.1.3, query-string@^7.1.1: +query-string@7.1.3, query-string@^7.1.3: version "7.1.3" resolved "https://registry.yarnpkg.com/query-string/-/query-string-7.1.3.tgz#a1cf90e994abb113a325804a972d98276fe02328" integrity sha512-hh2WYhq4fi8+b+/2Kg9CEge4fDPvHS534aOOvOZeQ3+Vf2mCFsaFBYj0i+iXcAq6I9Vzp5fjMFBlONvayDC1qg==