rise-wallet 0.1.4-beta.2 → 0.2.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -34
- package/dist/cli/Dialog.d.ts +35 -0
- package/dist/cli/Dialog.d.ts.map +1 -0
- package/dist/cli/Dialog.js +60 -0
- package/dist/cli/Dialog.js.map +1 -0
- package/dist/cli/Messenger.d.ts +8 -0
- package/dist/cli/Messenger.d.ts.map +1 -0
- package/dist/cli/Messenger.js +123 -0
- package/dist/cli/Messenger.js.map +1 -0
- package/dist/cli/bin/commands-o468kGU4.js +50 -0
- package/dist/cli/bin/index.js +9 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +3 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/internal/commands.d.ts +13 -0
- package/dist/cli/internal/commands.d.ts.map +1 -0
- package/dist/cli/internal/commands.js +180 -0
- package/dist/cli/internal/commands.js.map +1 -0
- package/dist/cli/internal/context.d.ts +521 -0
- package/dist/cli/internal/context.d.ts.map +1 -0
- package/dist/cli/internal/context.js +38 -0
- package/dist/cli/internal/context.js.map +1 -0
- package/dist/cli/internal/http.d.ts +7 -0
- package/dist/cli/internal/http.d.ts.map +1 -0
- package/dist/cli/internal/http.js +17 -0
- package/dist/cli/internal/http.js.map +1 -0
- package/dist/cli/internal/utils.d.ts +7 -0
- package/dist/cli/internal/utils.d.ts.map +1 -0
- package/dist/cli/internal/utils.js +24 -0
- package/dist/cli/internal/utils.js.map +1 -0
- package/dist/core/Chains.d.ts +211 -0
- package/dist/core/Chains.d.ts.map +1 -0
- package/dist/core/Chains.js +20 -0
- package/dist/core/Chains.js.map +1 -0
- package/dist/core/Dialog.d.ts +308 -0
- package/dist/core/Dialog.d.ts.map +1 -0
- package/dist/core/Dialog.js +809 -0
- package/dist/core/Dialog.js.map +1 -0
- package/dist/core/Messenger.d.ts +165 -0
- package/dist/core/Messenger.d.ts.map +1 -0
- package/dist/core/Messenger.js +207 -0
- package/dist/core/Messenger.js.map +1 -0
- package/dist/core/Mode.d.ts +5 -0
- package/dist/core/Mode.d.ts.map +1 -0
- package/dist/core/Mode.js +5 -0
- package/dist/core/Mode.js.map +1 -0
- package/dist/core/Porto.d.ts +1609 -0
- package/dist/core/Porto.d.ts.map +1 -0
- package/dist/core/Porto.js +105 -0
- package/dist/core/Porto.js.map +1 -0
- package/dist/core/RpcSchema.d.ts +82 -0
- package/dist/core/RpcSchema.d.ts.map +1 -0
- package/dist/core/RpcSchema.js +2 -0
- package/dist/core/RpcSchema.js.map +1 -0
- package/dist/core/Storage.d.ts +15 -0
- package/dist/core/Storage.d.ts.map +1 -0
- package/dist/core/Storage.js +109 -0
- package/dist/core/Storage.js.map +1 -0
- package/dist/core/Transport.d.ts +23 -0
- package/dist/core/Transport.d.ts.map +1 -0
- package/dist/core/Transport.js +37 -0
- package/dist/core/Transport.js.map +1 -0
- package/dist/core/internal/_generated/chains.d.ts +2 -0
- package/dist/core/internal/_generated/chains.d.ts.map +1 -0
- package/dist/core/internal/_generated/chains.js +3 -0
- package/dist/core/internal/_generated/chains.js.map +1 -0
- package/dist/core/internal/_generated/contracts/EIP7702Proxy.d.ts +18 -0
- package/dist/core/internal/_generated/contracts/EIP7702Proxy.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/EIP7702Proxy.js +24 -0
- package/dist/core/internal/_generated/contracts/EIP7702Proxy.js.map +1 -0
- package/dist/core/internal/_generated/contracts/Escrow.d.ts +256 -0
- package/dist/core/internal/_generated/contracts/Escrow.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/Escrow.js +329 -0
- package/dist/core/internal/_generated/contracts/Escrow.js.map +1 -0
- package/dist/core/internal/_generated/contracts/ExperimentERC20.d.ts +440 -0
- package/dist/core/internal/_generated/contracts/ExperimentERC20.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/ExperimentERC20.js +568 -0
- package/dist/core/internal/_generated/contracts/ExperimentERC20.js.map +1 -0
- package/dist/core/internal/_generated/contracts/ExperimentERC721.d.ts +456 -0
- package/dist/core/internal/_generated/contracts/ExperimentERC721.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/ExperimentERC721.js +587 -0
- package/dist/core/internal/_generated/contracts/ExperimentERC721.js.map +1 -0
- package/dist/core/internal/_generated/contracts/GuardedExecutor.d.ts +482 -0
- package/dist/core/internal/_generated/contracts/GuardedExecutor.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/GuardedExecutor.js +622 -0
- package/dist/core/internal/_generated/contracts/GuardedExecutor.js.map +1 -0
- package/dist/core/internal/_generated/contracts/ICallChecker.d.ts +25 -0
- package/dist/core/internal/_generated/contracts/ICallChecker.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/ICallChecker.js +33 -0
- package/dist/core/internal/_generated/contracts/ICallChecker.js.map +1 -0
- package/dist/core/internal/_generated/contracts/ICommon.d.ts +3 -0
- package/dist/core/internal/_generated/contracts/ICommon.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/ICommon.js +3 -0
- package/dist/core/internal/_generated/contracts/ICommon.js.map +1 -0
- package/dist/core/internal/_generated/contracts/IEscrow.d.ts +88 -0
- package/dist/core/internal/_generated/contracts/IEscrow.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/IEscrow.js +113 -0
- package/dist/core/internal/_generated/contracts/IEscrow.js.map +1 -0
- package/dist/core/internal/_generated/contracts/IFunder.d.ts +61 -0
- package/dist/core/internal/_generated/contracts/IFunder.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/IFunder.js +79 -0
- package/dist/core/internal/_generated/contracts/IFunder.js.map +1 -0
- package/dist/core/internal/_generated/contracts/IFunderV4.d.ts +34 -0
- package/dist/core/internal/_generated/contracts/IFunderV4.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/IFunderV4.js +44 -0
- package/dist/core/internal/_generated/contracts/IFunderV4.js.map +1 -0
- package/dist/core/internal/_generated/contracts/IIthacaAccount.d.ts +81 -0
- package/dist/core/internal/_generated/contracts/IIthacaAccount.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/IIthacaAccount.js +106 -0
- package/dist/core/internal/_generated/contracts/IIthacaAccount.js.map +1 -0
- package/dist/core/internal/_generated/contracts/IOAppCore.d.ts +108 -0
- package/dist/core/internal/_generated/contracts/IOAppCore.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/IOAppCore.js +141 -0
- package/dist/core/internal/_generated/contracts/IOAppCore.js.map +1 -0
- package/dist/core/internal/_generated/contracts/IOAppMsgInspector.d.ts +33 -0
- package/dist/core/internal/_generated/contracts/IOAppMsgInspector.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/IOAppMsgInspector.js +44 -0
- package/dist/core/internal/_generated/contracts/IOAppMsgInspector.js.map +1 -0
- package/dist/core/internal/_generated/contracts/IOAppReceiver.d.ts +122 -0
- package/dist/core/internal/_generated/contracts/IOAppReceiver.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/IOAppReceiver.js +160 -0
- package/dist/core/internal/_generated/contracts/IOAppReceiver.js.map +1 -0
- package/dist/core/internal/_generated/contracts/IOrchestrator.d.ts +71 -0
- package/dist/core/internal/_generated/contracts/IOrchestrator.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/IOrchestrator.js +94 -0
- package/dist/core/internal/_generated/contracts/IOrchestrator.js.map +1 -0
- package/dist/core/internal/_generated/contracts/ISettler.d.ts +39 -0
- package/dist/core/internal/_generated/contracts/ISettler.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/ISettler.js +51 -0
- package/dist/core/internal/_generated/contracts/ISettler.js.map +1 -0
- package/dist/core/internal/_generated/contracts/ISigner.d.ts +25 -0
- package/dist/core/internal/_generated/contracts/ISigner.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/ISigner.js +33 -0
- package/dist/core/internal/_generated/contracts/ISigner.js.map +1 -0
- package/dist/core/internal/_generated/contracts/IthacaAccount.d.ts +1121 -0
- package/dist/core/internal/_generated/contracts/IthacaAccount.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/IthacaAccount.js +1453 -0
- package/dist/core/internal/_generated/contracts/IthacaAccount.js.map +1 -0
- package/dist/core/internal/_generated/contracts/IthacaAccountNew.d.ts +1121 -0
- package/dist/core/internal/_generated/contracts/IthacaAccountNew.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/IthacaAccountNew.js +1453 -0
- package/dist/core/internal/_generated/contracts/IthacaAccountNew.js.map +1 -0
- package/dist/core/internal/_generated/contracts/IthacaAccountOld.d.ts +1121 -0
- package/dist/core/internal/_generated/contracts/IthacaAccountOld.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/IthacaAccountOld.js +1453 -0
- package/dist/core/internal/_generated/contracts/IthacaAccountOld.js.map +1 -0
- package/dist/core/internal/_generated/contracts/LayerZeroSettler.d.ts +621 -0
- package/dist/core/internal/_generated/contracts/LayerZeroSettler.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/LayerZeroSettler.js +810 -0
- package/dist/core/internal/_generated/contracts/LayerZeroSettler.js.map +1 -0
- package/dist/core/internal/_generated/contracts/LibNonce.d.ts +11 -0
- package/dist/core/internal/_generated/contracts/LibNonce.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/LibNonce.js +14 -0
- package/dist/core/internal/_generated/contracts/LibNonce.js.map +1 -0
- package/dist/core/internal/_generated/contracts/LibTStack.d.ts +3 -0
- package/dist/core/internal/_generated/contracts/LibTStack.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/LibTStack.js +3 -0
- package/dist/core/internal/_generated/contracts/LibTStack.js.map +1 -0
- package/dist/core/internal/_generated/contracts/MultiSigSigner.d.ts +157 -0
- package/dist/core/internal/_generated/contracts/MultiSigSigner.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/MultiSigSigner.js +202 -0
- package/dist/core/internal/_generated/contracts/MultiSigSigner.js.map +1 -0
- package/dist/core/internal/_generated/contracts/OApp.d.ts +314 -0
- package/dist/core/internal/_generated/contracts/OApp.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/OApp.js +411 -0
- package/dist/core/internal/_generated/contracts/OApp.js.map +1 -0
- package/dist/core/internal/_generated/contracts/OAppCore.d.ts +175 -0
- package/dist/core/internal/_generated/contracts/OAppCore.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/OAppCore.js +228 -0
- package/dist/core/internal/_generated/contracts/OAppCore.js.map +1 -0
- package/dist/core/internal/_generated/contracts/OAppReceiver.d.ts +302 -0
- package/dist/core/internal/_generated/contracts/OAppReceiver.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/OAppReceiver.js +395 -0
- package/dist/core/internal/_generated/contracts/OAppReceiver.js.map +1 -0
- package/dist/core/internal/_generated/contracts/OAppSender.d.ts +187 -0
- package/dist/core/internal/_generated/contracts/OAppSender.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/OAppSender.js +244 -0
- package/dist/core/internal/_generated/contracts/OAppSender.js.map +1 -0
- package/dist/core/internal/_generated/contracts/Orchestrator.d.ts +302 -0
- package/dist/core/internal/_generated/contracts/Orchestrator.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/Orchestrator.js +389 -0
- package/dist/core/internal/_generated/contracts/Orchestrator.js.map +1 -0
- package/dist/core/internal/_generated/contracts/SimpleFunder.d.ts +413 -0
- package/dist/core/internal/_generated/contracts/SimpleFunder.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/SimpleFunder.js +533 -0
- package/dist/core/internal/_generated/contracts/SimpleFunder.js.map +1 -0
- package/dist/core/internal/_generated/contracts/SimpleSettler.d.ts +280 -0
- package/dist/core/internal/_generated/contracts/SimpleSettler.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/SimpleSettler.js +359 -0
- package/dist/core/internal/_generated/contracts/SimpleSettler.js.map +1 -0
- package/dist/core/internal/_generated/contracts/Simulator.d.ts +131 -0
- package/dist/core/internal/_generated/contracts/Simulator.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/Simulator.js +169 -0
- package/dist/core/internal/_generated/contracts/Simulator.js.map +1 -0
- package/dist/core/internal/_generated/contracts/TokenTransferLib.d.ts +3 -0
- package/dist/core/internal/_generated/contracts/TokenTransferLib.d.ts.map +1 -0
- package/dist/core/internal/_generated/contracts/TokenTransferLib.js +3 -0
- package/dist/core/internal/_generated/contracts/TokenTransferLib.js.map +1 -0
- package/dist/core/internal/call.d.ts +164 -0
- package/dist/core/internal/call.d.ts.map +1 -0
- package/dist/core/internal/call.js +115 -0
- package/dist/core/internal/call.js.map +1 -0
- package/dist/core/internal/erc8010.d.ts +18 -0
- package/dist/core/internal/erc8010.d.ts.map +1 -0
- package/dist/core/internal/erc8010.js +29 -0
- package/dist/core/internal/erc8010.js.map +1 -0
- package/dist/core/internal/intersectionObserver.d.ts +2 -0
- package/dist/core/internal/intersectionObserver.d.ts.map +1 -0
- package/dist/core/internal/intersectionObserver.js +5 -0
- package/dist/core/internal/intersectionObserver.js.map +1 -0
- package/dist/core/internal/logger.d.ts +22 -0
- package/dist/core/internal/logger.d.ts.map +1 -0
- package/dist/core/internal/logger.js +24 -0
- package/dist/core/internal/logger.js.map +1 -0
- package/dist/core/internal/mode.d.ts +345 -0
- package/dist/core/internal/mode.d.ts.map +1 -0
- package/dist/core/internal/mode.js +110 -0
- package/dist/core/internal/mode.js.map +1 -0
- package/dist/core/internal/modes/dialog.d.ts +800 -0
- package/dist/core/internal/modes/dialog.d.ts.map +1 -0
- package/dist/core/internal/modes/dialog.js +760 -0
- package/dist/core/internal/modes/dialog.js.map +1 -0
- package/dist/core/internal/modes/reactNative.d.ts +1402 -0
- package/dist/core/internal/modes/reactNative.d.ts.map +1 -0
- package/dist/core/internal/modes/reactNative.js +19 -0
- package/dist/core/internal/modes/reactNative.js.map +1 -0
- package/dist/core/internal/modes/relay.d.ts +685 -0
- package/dist/core/internal/modes/relay.d.ts.map +1 -0
- package/dist/core/internal/modes/relay.js +708 -0
- package/dist/core/internal/modes/relay.js.map +1 -0
- package/dist/core/internal/permissions.d.ts +60 -0
- package/dist/core/internal/permissions.d.ts.map +1 -0
- package/dist/core/internal/permissions.js +30 -0
- package/dist/core/internal/permissions.js.map +1 -0
- package/dist/core/internal/permissionsRequest.d.ts +72 -0
- package/dist/core/internal/permissionsRequest.d.ts.map +1 -0
- package/dist/core/internal/permissionsRequest.js +58 -0
- package/dist/core/internal/permissionsRequest.js.map +1 -0
- package/dist/core/internal/porto.d.ts +14 -0
- package/dist/core/internal/porto.d.ts.map +1 -0
- package/dist/core/internal/porto.js +2 -0
- package/dist/core/internal/porto.js.map +1 -0
- package/dist/core/internal/promise.d.ts +9 -0
- package/dist/core/internal/promise.d.ts.map +1 -0
- package/dist/core/internal/promise.js +11 -0
- package/dist/core/internal/promise.js.map +1 -0
- package/dist/core/internal/provider.d.ts +30 -0
- package/dist/core/internal/provider.d.ts.map +1 -0
- package/dist/core/internal/provider.js +944 -0
- package/dist/core/internal/provider.js.map +1 -0
- package/dist/core/internal/relay/rpcSchema.d.ts +76 -0
- package/dist/core/internal/relay/rpcSchema.d.ts.map +1 -0
- package/dist/core/internal/relay/rpcSchema.js +7 -0
- package/dist/core/internal/relay/rpcSchema.js.map +1 -0
- package/dist/core/internal/relay/schema/capabilities.d.ts +165 -0
- package/dist/core/internal/relay/schema/capabilities.d.ts.map +1 -0
- package/dist/core/internal/relay/schema/capabilities.js +112 -0
- package/dist/core/internal/relay/schema/capabilities.js.map +1 -0
- package/dist/core/internal/relay/schema/intent.d.ts +168 -0
- package/dist/core/internal/relay/schema/intent.d.ts.map +1 -0
- package/dist/core/internal/relay/schema/intent.js +170 -0
- package/dist/core/internal/relay/schema/intent.js.map +1 -0
- package/dist/core/internal/relay/schema/key.d.ts +44 -0
- package/dist/core/internal/relay/schema/key.d.ts.map +1 -0
- package/dist/core/internal/relay/schema/key.js +30 -0
- package/dist/core/internal/relay/schema/key.js.map +1 -0
- package/dist/core/internal/relay/schema/permission.d.ts +40 -0
- package/dist/core/internal/relay/schema/permission.d.ts.map +1 -0
- package/dist/core/internal/relay/schema/permission.js +29 -0
- package/dist/core/internal/relay/schema/permission.js.map +1 -0
- package/dist/core/internal/relay/schema/preCall.d.ts +63 -0
- package/dist/core/internal/relay/schema/preCall.d.ts.map +1 -0
- package/dist/core/internal/relay/schema/preCall.js +36 -0
- package/dist/core/internal/relay/schema/preCall.js.map +1 -0
- package/dist/core/internal/relay/schema/quotes.d.ts +370 -0
- package/dist/core/internal/relay/schema/quotes.d.ts.map +1 -0
- package/dist/core/internal/relay/schema/quotes.js +89 -0
- package/dist/core/internal/relay/schema/quotes.js.map +1 -0
- package/dist/core/internal/relay/schema/rpc.d.ts +1529 -0
- package/dist/core/internal/relay/schema/rpc.d.ts.map +1 -0
- package/dist/core/internal/relay/schema/rpc.js +638 -0
- package/dist/core/internal/relay/schema/rpc.js.map +1 -0
- package/dist/core/internal/relay/schema/token.d.ts +14 -0
- package/dist/core/internal/relay/schema/token.d.ts.map +1 -0
- package/dist/core/internal/relay/schema/token.js +13 -0
- package/dist/core/internal/relay/schema/token.js.map +1 -0
- package/dist/core/internal/requiredFunds.d.ts +19 -0
- package/dist/core/internal/requiredFunds.d.ts.map +1 -0
- package/dist/core/internal/requiredFunds.js +25 -0
- package/dist/core/internal/requiredFunds.js.map +1 -0
- package/dist/core/internal/schema/capabilities.d.ts +314 -0
- package/dist/core/internal/schema/capabilities.d.ts.map +1 -0
- package/dist/core/internal/schema/capabilities.js +133 -0
- package/dist/core/internal/schema/capabilities.js.map +1 -0
- package/dist/core/internal/schema/key.d.ts +165 -0
- package/dist/core/internal/schema/key.d.ts.map +1 -0
- package/dist/core/internal/schema/key.js +75 -0
- package/dist/core/internal/schema/key.js.map +1 -0
- package/dist/core/internal/schema/permissions.d.ts +103 -0
- package/dist/core/internal/schema/permissions.d.ts.map +1 -0
- package/dist/core/internal/schema/permissions.js +28 -0
- package/dist/core/internal/schema/permissions.js.map +1 -0
- package/dist/core/internal/schema/request.d.ts +938 -0
- package/dist/core/internal/schema/request.d.ts.map +1 -0
- package/dist/core/internal/schema/request.js +57 -0
- package/dist/core/internal/schema/request.js.map +1 -0
- package/dist/core/internal/schema/rpc.d.ts +3315 -0
- package/dist/core/internal/schema/rpc.d.ts.map +1 -0
- package/dist/core/internal/schema/rpc.js +599 -0
- package/dist/core/internal/schema/rpc.js.map +1 -0
- package/dist/core/internal/schema/token.d.ts +2 -0
- package/dist/core/internal/schema/token.d.ts.map +1 -0
- package/dist/core/internal/schema/token.js +2 -0
- package/dist/core/internal/schema/token.js.map +1 -0
- package/dist/core/internal/schema/utils.d.ts +19 -0
- package/dist/core/internal/schema/utils.d.ts.map +1 -0
- package/dist/core/internal/schema/utils.js +213 -0
- package/dist/core/internal/schema/utils.js.map +1 -0
- package/dist/core/internal/siwe.d.ts +33 -0
- package/dist/core/internal/siwe.d.ts.map +1 -0
- package/dist/core/internal/siwe.js +92 -0
- package/dist/core/internal/siwe.js.map +1 -0
- package/dist/core/internal/store.d.ts +3 -0
- package/dist/core/internal/store.d.ts.map +1 -0
- package/dist/core/internal/store.js +9 -0
- package/dist/core/internal/store.js.map +1 -0
- package/dist/core/internal/tokens.d.ts +58 -0
- package/dist/core/internal/tokens.d.ts.map +1 -0
- package/dist/core/internal/tokens.js +69 -0
- package/dist/core/internal/tokens.js.map +1 -0
- package/dist/core/internal/types.d.ts +299 -0
- package/dist/core/internal/types.d.ts.map +1 -0
- package/dist/core/internal/types.js +2 -0
- package/dist/core/internal/types.js.map +1 -0
- package/dist/core/internal/urlString.d.ts +2 -0
- package/dist/core/internal/urlString.d.ts.map +1 -0
- package/dist/core/internal/urlString.js +8 -0
- package/dist/core/internal/urlString.js.map +1 -0
- package/dist/core/internal/userAgent.d.ts +11 -0
- package/dist/core/internal/userAgent.d.ts.map +1 -0
- package/dist/core/internal/userAgent.js +19 -0
- package/dist/core/internal/userAgent.js.map +1 -0
- package/dist/core/internal/utils.d.ts +25 -0
- package/dist/core/internal/utils.d.ts.map +1 -0
- package/dist/core/internal/utils.js +62 -0
- package/dist/core/internal/utils.js.map +1 -0
- package/dist/core/react-native/Porto.d.ts +1481 -0
- package/dist/core/react-native/Porto.d.ts.map +1 -0
- package/dist/core/react-native/Porto.js +17 -0
- package/dist/core/react-native/Porto.js.map +1 -0
- package/dist/core/react-native/configure.d.ts +10 -0
- package/dist/core/react-native/configure.d.ts.map +1 -0
- package/dist/core/react-native/configure.js +24 -0
- package/dist/core/react-native/configure.js.map +1 -0
- package/dist/core/react-native/environment.d.ts +27 -0
- package/dist/core/react-native/environment.d.ts.map +1 -0
- package/dist/core/react-native/environment.js +13 -0
- package/dist/core/react-native/environment.js.map +1 -0
- package/dist/core/react-native/index.d.ts +5 -0
- package/dist/core/react-native/index.d.ts.map +1 -0
- package/dist/core/react-native/index.js +5 -0
- package/dist/core/react-native/index.js.map +1 -0
- package/dist/core/react-native/utils.d.ts +2 -0
- package/dist/core/react-native/utils.d.ts.map +1 -0
- package/dist/core/react-native/utils.js +12 -0
- package/dist/core/react-native/utils.js.map +1 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -0
- package/dist/index.native.d.ts +8 -0
- package/dist/index.native.d.ts.map +1 -0
- package/dist/index.native.js +12 -0
- package/dist/index.native.js.map +1 -0
- package/dist/internal/index.d.ts +4 -0
- package/dist/internal/index.d.ts.map +1 -0
- package/dist/internal/index.js +4 -0
- package/dist/internal/index.js.map +1 -0
- package/dist/react-native/crypto.d.ts +2 -0
- package/dist/react-native/crypto.d.ts.map +1 -0
- package/dist/react-native/crypto.js +12 -0
- package/dist/react-native/crypto.js.map +1 -0
- package/dist/react-native/index.d.ts +8 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +12 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/register.d.ts +3 -0
- package/dist/react-native/register.d.ts.map +1 -0
- package/dist/react-native/register.js +15 -0
- package/dist/react-native/register.js.map +1 -0
- package/dist/register/index.d.ts +15 -0
- package/dist/register/index.d.ts.map +1 -0
- package/dist/register/index.js +2 -0
- package/dist/register/index.js.map +1 -0
- package/dist/remote/Actions.d.ts +34 -0
- package/dist/remote/Actions.d.ts.map +1 -0
- package/dist/remote/Actions.js +76 -0
- package/dist/remote/Actions.js.map +1 -0
- package/dist/remote/Events.d.ts +47 -0
- package/dist/remote/Events.d.ts.map +1 -0
- package/dist/remote/Events.js +132 -0
- package/dist/remote/Events.js.map +1 -0
- package/dist/remote/Hooks.d.ts +3801 -0
- package/dist/remote/Hooks.d.ts.map +1 -0
- package/dist/remote/Hooks.js +106 -0
- package/dist/remote/Hooks.js.map +1 -0
- package/dist/remote/Porto.d.ts +858 -0
- package/dist/remote/Porto.d.ts.map +1 -0
- package/dist/remote/Porto.js +66 -0
- package/dist/remote/Porto.js.map +1 -0
- package/dist/remote/index.d.ts +5 -0
- package/dist/remote/index.d.ts.map +1 -0
- package/dist/remote/index.js +5 -0
- package/dist/remote/index.js.map +1 -0
- package/dist/remote/internal/methodPolicies.d.ts +97 -0
- package/dist/remote/internal/methodPolicies.d.ts.map +1 -0
- package/dist/remote/internal/methodPolicies.js +102 -0
- package/dist/remote/internal/methodPolicies.js.map +1 -0
- package/dist/server/Route.d.ts +88 -0
- package/dist/server/Route.d.ts.map +1 -0
- package/dist/server/Route.js +189 -0
- package/dist/server/Route.js.map +1 -0
- package/dist/server/Router.d.ts +24 -0
- package/dist/server/Router.d.ts.map +1 -0
- package/dist/server/Router.js +29 -0
- package/dist/server/Router.js.map +1 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +3 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/internal/merchantSchema.d.ts +65 -0
- package/dist/server/internal/merchantSchema.d.ts.map +1 -0
- package/dist/server/internal/merchantSchema.js +7 -0
- package/dist/server/internal/merchantSchema.js.map +1 -0
- package/dist/server/internal/requestListener.d.ts +124 -0
- package/dist/server/internal/requestListener.d.ts.map +1 -0
- package/dist/server/internal/requestListener.js +172 -0
- package/dist/server/internal/requestListener.js.map +1 -0
- package/dist/theme/Theme.d.ts +122 -0
- package/dist/theme/Theme.d.ts.map +1 -0
- package/dist/theme/Theme.js +18 -0
- package/dist/theme/Theme.js.map +1 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +2 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/trusted-hosts.d.ts +2 -0
- package/dist/trusted-hosts.d.ts.map +1 -0
- package/dist/trusted-hosts.js +44 -0
- package/dist/trusted-hosts.js.map +1 -0
- package/dist/tsconfig.tmp.tsbuildinfo +1 -0
- package/dist/viem/Account.d.ts +111 -0
- package/dist/viem/Account.d.ts.map +1 -0
- package/dist/viem/Account.js +132 -0
- package/dist/viem/Account.js.map +1 -0
- package/dist/viem/AccountActions.d.ts +11 -0
- package/dist/viem/AccountActions.d.ts.map +1 -0
- package/dist/viem/AccountActions.js +14 -0
- package/dist/viem/AccountActions.js.map +1 -0
- package/dist/viem/CapabilitiesSchema.d.ts +15 -0
- package/dist/viem/CapabilitiesSchema.d.ts.map +1 -0
- package/dist/viem/CapabilitiesSchema.js +2 -0
- package/dist/viem/CapabilitiesSchema.js.map +1 -0
- package/dist/viem/ContractActions.d.ts +209 -0
- package/dist/viem/ContractActions.d.ts.map +1 -0
- package/dist/viem/ContractActions.js +350 -0
- package/dist/viem/ContractActions.js.map +1 -0
- package/dist/viem/Key.d.ts +1156 -0
- package/dist/viem/Key.d.ts.map +1 -0
- package/dist/viem/Key.js +924 -0
- package/dist/viem/Key.js.map +1 -0
- package/dist/viem/RelayActions.d.ts +436 -0
- package/dist/viem/RelayActions.d.ts.map +1 -0
- package/dist/viem/RelayActions.js +385 -0
- package/dist/viem/RelayActions.js.map +1 -0
- package/dist/viem/RelayClient.d.ts +27 -0
- package/dist/viem/RelayClient.d.ts.map +1 -0
- package/dist/viem/RelayClient.js +44 -0
- package/dist/viem/RelayClient.js.map +1 -0
- package/dist/viem/RpcSchema.d.ts +23 -0
- package/dist/viem/RpcSchema.d.ts.map +1 -0
- package/dist/viem/RpcSchema.js +2 -0
- package/dist/viem/RpcSchema.js.map +1 -0
- package/dist/viem/WalletActions.d.ts +87 -0
- package/dist/viem/WalletActions.d.ts.map +1 -0
- package/dist/viem/WalletActions.js +220 -0
- package/dist/viem/WalletActions.js.map +1 -0
- package/dist/viem/WalletClient.d.ts +21 -0
- package/dist/viem/WalletClient.d.ts.map +1 -0
- package/dist/viem/WalletClient.js +23 -0
- package/dist/viem/WalletClient.js.map +1 -0
- package/dist/viem/index.d.ts +14 -0
- package/dist/viem/index.d.ts.map +1 -0
- package/dist/viem/index.js +12 -0
- package/dist/viem/index.js.map +1 -0
- package/dist/viem/internal/relayActions.d.ts +365 -0
- package/dist/viem/internal/relayActions.d.ts.map +1 -0
- package/dist/viem/internal/relayActions.js +783 -0
- package/dist/viem/internal/relayActions.js.map +1 -0
- package/dist/viem/internal/utils.d.ts +16 -0
- package/dist/viem/internal/utils.d.ts.map +1 -0
- package/dist/viem/internal/utils.js +2 -0
- package/dist/viem/internal/utils.js.map +1 -0
- package/dist/wagmi/Actions.d.ts +2 -0
- package/dist/wagmi/Actions.d.ts.map +1 -0
- package/dist/wagmi/Actions.js +2 -0
- package/dist/wagmi/Actions.js.map +1 -0
- package/dist/wagmi/Connector.d.ts +28 -0
- package/dist/wagmi/Connector.d.ts.map +1 -0
- package/dist/wagmi/Connector.js +238 -0
- package/dist/wagmi/Connector.js.map +1 -0
- package/dist/wagmi/Hooks.d.ts +2 -0
- package/dist/wagmi/Hooks.d.ts.map +1 -0
- package/dist/wagmi/Hooks.js +2 -0
- package/dist/wagmi/Hooks.js.map +1 -0
- package/dist/wagmi/Hooks.native.d.ts +3 -0
- package/dist/wagmi/Hooks.native.d.ts.map +1 -0
- package/dist/wagmi/Hooks.native.js +3 -0
- package/dist/wagmi/Hooks.native.js.map +1 -0
- package/dist/wagmi/Query.d.ts +2 -0
- package/dist/wagmi/Query.d.ts.map +1 -0
- package/dist/wagmi/Query.js +2 -0
- package/dist/wagmi/Query.js.map +1 -0
- package/dist/wagmi/index.d.ts +5 -0
- package/dist/wagmi/index.d.ts.map +1 -0
- package/dist/wagmi/index.js +5 -0
- package/dist/wagmi/index.js.map +1 -0
- package/dist/wagmi/index.native.d.ts +6 -0
- package/dist/wagmi/index.native.d.ts.map +1 -0
- package/dist/wagmi/index.native.js +6 -0
- package/dist/wagmi/index.native.js.map +1 -0
- package/dist/wagmi/internal/core.d.ts +84 -0
- package/dist/wagmi/internal/core.d.ts.map +1 -0
- package/dist/wagmi/internal/core.js +229 -0
- package/dist/wagmi/internal/core.js.map +1 -0
- package/dist/wagmi/internal/query.d.ts +33 -0
- package/dist/wagmi/internal/query.d.ts.map +1 -0
- package/dist/wagmi/internal/query.js +23 -0
- package/dist/wagmi/internal/query.js.map +1 -0
- package/dist/wagmi/internal/react.d.ts +91 -0
- package/dist/wagmi/internal/react.d.ts.map +1 -0
- package/dist/wagmi/internal/react.js +256 -0
- package/dist/wagmi/internal/react.js.map +1 -0
- package/dist/wagmi/internal/types.d.ts +11 -0
- package/dist/wagmi/internal/types.d.ts.map +1 -0
- package/dist/wagmi/internal/types.js +2 -0
- package/dist/wagmi/internal/types.js.map +1 -0
- package/dist/wagmi/internal/utils.d.ts +2 -0
- package/dist/wagmi/internal/utils.d.ts.map +1 -0
- package/dist/wagmi/internal/utils.js +18 -0
- package/dist/wagmi/internal/utils.js.map +1 -0
- package/package.json +287 -34
- package/src/cli/Dialog.ts +75 -0
- package/src/cli/Messenger.ts +148 -0
- package/src/cli/bin/index.ts +37 -0
- package/src/cli/bin/tsconfig.json +8 -0
- package/src/cli/index.ts +2 -0
- package/src/cli/internal/commands.ts +216 -0
- package/src/cli/internal/context.ts +56 -0
- package/src/cli/internal/http.ts +28 -0
- package/src/cli/internal/utils.ts +28 -0
- package/src/cli/tsdown.config.ts +37 -0
- package/src/core/Chains.ts +25 -0
- package/src/core/Dialog.ts +1059 -0
- package/src/core/Messenger.ts +394 -0
- package/src/core/Mode.ts +4 -0
- package/src/core/Porto.ts +287 -0
- package/src/core/RpcSchema.ts +124 -0
- package/src/core/Storage.ts +122 -0
- package/src/core/Transport.ts +45 -0
- package/src/core/internal/_generated/chains.ts +2 -0
- package/src/core/internal/_generated/contracts/EIP7702Proxy.ts +25 -0
- package/src/core/internal/_generated/contracts/Escrow.ts +330 -0
- package/src/core/internal/_generated/contracts/ExperimentERC20.ts +569 -0
- package/src/core/internal/_generated/contracts/ExperimentERC721.ts +588 -0
- package/src/core/internal/_generated/contracts/GuardedExecutor.ts +623 -0
- package/src/core/internal/_generated/contracts/ICallChecker.ts +34 -0
- package/src/core/internal/_generated/contracts/ICommon.ts +4 -0
- package/src/core/internal/_generated/contracts/IEscrow.ts +114 -0
- package/src/core/internal/_generated/contracts/IFunder.ts +80 -0
- package/src/core/internal/_generated/contracts/IFunderV4.ts +45 -0
- package/src/core/internal/_generated/contracts/IIthacaAccount.ts +107 -0
- package/src/core/internal/_generated/contracts/IOAppCore.ts +142 -0
- package/src/core/internal/_generated/contracts/IOAppMsgInspector.ts +45 -0
- package/src/core/internal/_generated/contracts/IOAppReceiver.ts +161 -0
- package/src/core/internal/_generated/contracts/IOrchestrator.ts +95 -0
- package/src/core/internal/_generated/contracts/ISettler.ts +52 -0
- package/src/core/internal/_generated/contracts/ISigner.ts +34 -0
- package/src/core/internal/_generated/contracts/IthacaAccount.ts +1454 -0
- package/src/core/internal/_generated/contracts/IthacaAccountNew.ts +1454 -0
- package/src/core/internal/_generated/contracts/IthacaAccountOld.ts +1454 -0
- package/src/core/internal/_generated/contracts/LayerZeroSettler.ts +811 -0
- package/src/core/internal/_generated/contracts/LibNonce.ts +15 -0
- package/src/core/internal/_generated/contracts/LibTStack.ts +4 -0
- package/src/core/internal/_generated/contracts/MultiSigSigner.ts +203 -0
- package/src/core/internal/_generated/contracts/OApp.ts +412 -0
- package/src/core/internal/_generated/contracts/OAppCore.ts +229 -0
- package/src/core/internal/_generated/contracts/OAppReceiver.ts +396 -0
- package/src/core/internal/_generated/contracts/OAppSender.ts +245 -0
- package/src/core/internal/_generated/contracts/Orchestrator.ts +390 -0
- package/src/core/internal/_generated/contracts/SimpleFunder.ts +534 -0
- package/src/core/internal/_generated/contracts/SimpleSettler.ts +360 -0
- package/src/core/internal/_generated/contracts/Simulator.ts +170 -0
- package/src/core/internal/_generated/contracts/TokenTransferLib.ts +4 -0
- package/src/core/internal/_snapshots/provider.browser.test.ts.snap +119 -0
- package/src/core/internal/_snapshots/provider.test.ts.snap +1103 -0
- package/src/core/internal/call.test.ts +116 -0
- package/src/core/internal/call.ts +245 -0
- package/src/core/internal/erc8010.test.ts +74 -0
- package/src/core/internal/erc8010.ts +44 -0
- package/src/core/internal/intersectionObserver.ts +5 -0
- package/src/core/internal/logger.ts +42 -0
- package/src/core/internal/mode.ts +498 -0
- package/src/core/internal/modes/dialog.ts +1051 -0
- package/src/core/internal/modes/reactNative.ts +29 -0
- package/src/core/internal/modes/relay.ts +893 -0
- package/src/core/internal/permissions.ts +43 -0
- package/src/core/internal/permissionsRequest.ts +88 -0
- package/src/core/internal/porto.ts +16 -0
- package/src/core/internal/promise.ts +19 -0
- package/src/core/internal/provider.browser.test.ts +311 -0
- package/src/core/internal/provider.test.ts +3552 -0
- package/src/core/internal/provider.ts +1278 -0
- package/src/core/internal/relay/rpcSchema.ts +101 -0
- package/src/core/internal/relay/schema/capabilities.test.ts +663 -0
- package/src/core/internal/relay/schema/capabilities.ts +156 -0
- package/src/core/internal/relay/schema/intent.test.ts +433 -0
- package/src/core/internal/relay/schema/intent.ts +174 -0
- package/src/core/internal/relay/schema/key.test.ts +424 -0
- package/src/core/internal/relay/schema/key.ts +34 -0
- package/src/core/internal/relay/schema/permission.test.ts +499 -0
- package/src/core/internal/relay/schema/permission.ts +34 -0
- package/src/core/internal/relay/schema/preCall.ts +39 -0
- package/src/core/internal/relay/schema/quotes.test.ts +901 -0
- package/src/core/internal/relay/schema/quotes.ts +98 -0
- package/src/core/internal/relay/schema/rpc.ts +822 -0
- package/src/core/internal/relay/schema/token.ts +16 -0
- package/src/core/internal/requiredFunds.test.ts +141 -0
- package/src/core/internal/requiredFunds.ts +45 -0
- package/src/core/internal/schema/capabilities.test.ts +1334 -0
- package/src/core/internal/schema/capabilities.ts +162 -0
- package/src/core/internal/schema/key.test.ts +570 -0
- package/src/core/internal/schema/key.ts +98 -0
- package/src/core/internal/schema/permissions.test.ts +948 -0
- package/src/core/internal/schema/permissions.ts +31 -0
- package/src/core/internal/schema/request.bench.ts +35 -0
- package/src/core/internal/schema/request.ts +90 -0
- package/src/core/internal/schema/rpc.ts +821 -0
- package/src/core/internal/schema/token.ts +1 -0
- package/src/core/internal/schema/utils.test.ts +572 -0
- package/src/core/internal/schema/utils.ts +236 -0
- package/src/core/internal/siwe.test.ts +473 -0
- package/src/core/internal/siwe.ts +144 -0
- package/src/core/internal/store.ts +9 -0
- package/src/core/internal/tokens.test.ts +317 -0
- package/src/core/internal/tokens.ts +125 -0
- package/src/core/internal/types.ts +448 -0
- package/src/core/internal/urlString.ts +5 -0
- package/src/core/internal/userAgent.ts +35 -0
- package/src/core/internal/utils.test.ts +35 -0
- package/src/core/internal/utils.ts +67 -0
- package/src/core/react-native/Porto.ts +22 -0
- package/src/core/react-native/configure.ts +31 -0
- package/src/core/react-native/environment.ts +43 -0
- package/src/core/react-native/index.ts +4 -0
- package/src/core/react-native/utils.ts +18 -0
- package/src/index.native.ts +15 -0
- package/src/index.ts +17 -0
- package/src/internal/index.ts +3 -0
- package/src/react-native/crypto.ts +19 -0
- package/src/react-native/index.ts +15 -0
- package/src/react-native/register.ts +24 -0
- package/src/register/index.ts +17 -0
- package/src/remote/Actions.ts +115 -0
- package/src/remote/Events.ts +193 -0
- package/src/remote/Hooks.ts +194 -0
- package/src/remote/Porto.ts +144 -0
- package/src/remote/index.ts +4 -0
- package/src/remote/internal/methodPolicies.ts +124 -0
- package/src/server/Route.test.ts +347 -0
- package/src/server/Route.ts +259 -0
- package/src/server/Router.test.ts +32 -0
- package/src/server/Router.ts +59 -0
- package/src/server/index.ts +2 -0
- package/src/server/internal/merchantSchema.ts +11 -0
- package/src/server/internal/requestListener.ts +284 -0
- package/src/theme/Theme.ts +163 -0
- package/src/theme/index.ts +2 -0
- package/src/trusted-hosts.ts +43 -0
- package/src/tsconfig.build.tsbuildinfo +1 -0
- package/src/tsconfig.json +15 -0
- package/src/viem/Account.test.ts +270 -0
- package/src/viem/Account.ts +278 -0
- package/src/viem/AccountActions.test.ts +3 -0
- package/src/viem/AccountActions.ts +30 -0
- package/src/viem/CapabilitiesSchema.ts +18 -0
- package/src/viem/ContractActions.test.ts +980 -0
- package/src/viem/ContractActions.ts +624 -0
- package/src/viem/Key.test.ts +1420 -0
- package/src/viem/Key.ts +1318 -0
- package/src/viem/RelayActions.test.ts +1730 -0
- package/src/viem/RelayActions.ts +1082 -0
- package/src/viem/RelayClient.test.ts +127 -0
- package/src/viem/RelayClient.ts +87 -0
- package/src/viem/RpcSchema.ts +27 -0
- package/src/viem/WalletActions.test.ts +646 -0
- package/src/viem/WalletActions.ts +476 -0
- package/src/viem/WalletClient.test.ts +36 -0
- package/src/viem/WalletClient.ts +74 -0
- package/src/viem/index.ts +13 -0
- package/src/viem/internal/relayActions.test.ts +1296 -0
- package/src/viem/internal/relayActions.ts +1222 -0
- package/src/viem/internal/utils.ts +27 -0
- package/src/wagmi/Actions.ts +13 -0
- package/src/wagmi/Connector.ts +306 -0
- package/src/wagmi/Hooks.native.ts +16 -0
- package/src/wagmi/Hooks.ts +14 -0
- package/src/wagmi/Query.ts +5 -0
- package/src/wagmi/index.native.ts +6 -0
- package/src/wagmi/index.ts +4 -0
- package/src/wagmi/internal/core.test.ts +12 -0
- package/src/wagmi/internal/core.ts +468 -0
- package/src/wagmi/internal/query.ts +52 -0
- package/src/wagmi/internal/react.test.ts +12 -0
- package/src/wagmi/internal/react.ts +705 -0
- package/src/wagmi/internal/types.ts +21 -0
- package/src/wagmi/internal/utils.ts +25 -0
- package/dist/chain.cjs +0 -17
- package/dist/chain.d.cts +0 -41
- package/dist/chain.d.ts +0 -41
- package/dist/chain.js +0 -13
- package/dist/config.cjs +0 -19
- package/dist/config.d.cts +0 -3
- package/dist/config.d.ts +0 -3
- package/dist/config.js +0 -16
- package/dist/index.cjs +0 -18
- package/dist/index.d.cts +0 -2
|
@@ -0,0 +1,1222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Actions for Porto Relay.
|
|
3
|
+
*
|
|
4
|
+
* @see https://porto.sh/relay
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as AbiError from 'ox/AbiError'
|
|
8
|
+
import * as AbiFunction from 'ox/AbiFunction'
|
|
9
|
+
import type * as Address from 'ox/Address'
|
|
10
|
+
import * as Errors from 'ox/Errors'
|
|
11
|
+
import * as Hash from 'ox/Hash'
|
|
12
|
+
import * as Hex from 'ox/Hex'
|
|
13
|
+
import * as Secp256k1 from 'ox/Secp256k1'
|
|
14
|
+
import * as Signature from 'ox/Signature'
|
|
15
|
+
import {
|
|
16
|
+
BaseError,
|
|
17
|
+
type Calls,
|
|
18
|
+
type Chain,
|
|
19
|
+
type Client,
|
|
20
|
+
type Narrow,
|
|
21
|
+
type Transport,
|
|
22
|
+
type ValueOf,
|
|
23
|
+
withCache,
|
|
24
|
+
} from 'viem'
|
|
25
|
+
import { verifyHash } from 'viem/actions'
|
|
26
|
+
import {
|
|
27
|
+
type GetExecuteErrorReturnType,
|
|
28
|
+
getExecuteError,
|
|
29
|
+
} from 'viem/experimental/erc7821'
|
|
30
|
+
import * as z from 'zod/mini'
|
|
31
|
+
import * as RpcSchema from '../../core/internal/relay/rpcSchema.js'
|
|
32
|
+
import * as u from '../../core/internal/schema/utils.js'
|
|
33
|
+
import type { IsUndefined, OneOf } from '../../core/internal/types.js'
|
|
34
|
+
import * as U from '../../core/internal/utils.js'
|
|
35
|
+
import type { sendCalls } from '../RelayActions.js'
|
|
36
|
+
import type { GetChainParameter } from './utils.js'
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Gets the authorization for a given address.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* TODO
|
|
43
|
+
*
|
|
44
|
+
* @param client - The client to use.
|
|
45
|
+
* @param parameters - Parameters.
|
|
46
|
+
* @returns Result.
|
|
47
|
+
*/
|
|
48
|
+
export async function getAuthorization(
|
|
49
|
+
client: Client,
|
|
50
|
+
parameters: getAuthorization.Parameters,
|
|
51
|
+
): Promise<getAuthorization.ReturnType> {
|
|
52
|
+
try {
|
|
53
|
+
const method = 'wallet_getAuthorization' as const
|
|
54
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
55
|
+
const result = await withCache(
|
|
56
|
+
() =>
|
|
57
|
+
client.request<Schema>({
|
|
58
|
+
method,
|
|
59
|
+
params: [
|
|
60
|
+
z.encode(RpcSchema.wallet_getAuthorization.Parameters, parameters),
|
|
61
|
+
],
|
|
62
|
+
}),
|
|
63
|
+
{ cacheKey: `${client.uid}.${method}.${parameters.address}` },
|
|
64
|
+
)
|
|
65
|
+
return z.decode(RpcSchema.wallet_getAuthorization.Response, result)
|
|
66
|
+
} catch (error) {
|
|
67
|
+
parseSchemaError(error)
|
|
68
|
+
throw error
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export namespace getAuthorization {
|
|
73
|
+
export type Parameters = RpcSchema.wallet_getAuthorization.Parameters
|
|
74
|
+
export type ReturnType = RpcSchema.wallet_getAuthorization.Response
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Gets the capabilities for a given chain ID.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* TODO
|
|
82
|
+
*
|
|
83
|
+
* @param client - The client to use.
|
|
84
|
+
* @param options - Options.
|
|
85
|
+
* @returns Result.
|
|
86
|
+
*/
|
|
87
|
+
export async function getCapabilities<
|
|
88
|
+
const chainIds extends 'all' | readonly number[] | undefined = undefined,
|
|
89
|
+
const raw extends boolean = false,
|
|
90
|
+
>(
|
|
91
|
+
client: Client<Transport>,
|
|
92
|
+
options: getCapabilities.Options<chainIds, raw> = {},
|
|
93
|
+
): Promise<getCapabilities.ReturnType<chainIds, raw>> {
|
|
94
|
+
const chainIds = (() => {
|
|
95
|
+
if (options.chainId) return [options.chainId]
|
|
96
|
+
if (options.chainIds === 'all') return undefined
|
|
97
|
+
if (options.chainIds) return options.chainIds as readonly number[]
|
|
98
|
+
return [client.chain!.id]
|
|
99
|
+
})()
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
const method = 'wallet_getCapabilities' as const
|
|
103
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
104
|
+
const result = await withCache(
|
|
105
|
+
() =>
|
|
106
|
+
client.request<Schema>(
|
|
107
|
+
{
|
|
108
|
+
method,
|
|
109
|
+
params: chainIds ? [chainIds] : undefined,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
retryCount: 0,
|
|
113
|
+
},
|
|
114
|
+
),
|
|
115
|
+
{
|
|
116
|
+
cacheKey: `${client.uid}.${method}.${chainIds?.join(',')}`,
|
|
117
|
+
},
|
|
118
|
+
)
|
|
119
|
+
const parsed = (() => {
|
|
120
|
+
if (options.raw) return result as never
|
|
121
|
+
return z.decode(RpcSchema.wallet_getCapabilities.Response, result)
|
|
122
|
+
})()
|
|
123
|
+
if (options.chainIds) return parsed as never
|
|
124
|
+
return Object.values(parsed)[0]! as never
|
|
125
|
+
} catch (error) {
|
|
126
|
+
parseSchemaError(error)
|
|
127
|
+
throw error
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export namespace getCapabilities {
|
|
132
|
+
export type Options<
|
|
133
|
+
chainIds extends 'all' | readonly number[] | undefined = undefined,
|
|
134
|
+
raw extends boolean = false,
|
|
135
|
+
> = {
|
|
136
|
+
/**
|
|
137
|
+
* Whether to return the raw, non-decoded response.
|
|
138
|
+
* @default false
|
|
139
|
+
*/
|
|
140
|
+
raw?: raw | boolean | undefined
|
|
141
|
+
} & OneOf<
|
|
142
|
+
| {
|
|
143
|
+
/**
|
|
144
|
+
* Chain IDs to get the capabilities for.
|
|
145
|
+
* `"all"` will return the capabilities for all supported chains.
|
|
146
|
+
*/
|
|
147
|
+
chainIds?: chainIds | 'all' | readonly number[] | undefined
|
|
148
|
+
}
|
|
149
|
+
| {
|
|
150
|
+
/**
|
|
151
|
+
* Chain ID to get the capabilities for.
|
|
152
|
+
*/
|
|
153
|
+
chainId?: number | undefined
|
|
154
|
+
}
|
|
155
|
+
>
|
|
156
|
+
|
|
157
|
+
export type ReturnType<
|
|
158
|
+
chainIds extends 'all' | readonly number[] | undefined = undefined,
|
|
159
|
+
raw extends boolean = false,
|
|
160
|
+
//
|
|
161
|
+
value = raw extends true
|
|
162
|
+
? z.input<typeof RpcSchema.wallet_getCapabilities.Response>
|
|
163
|
+
: RpcSchema.wallet_getCapabilities.Response,
|
|
164
|
+
> = IsUndefined<chainIds> extends true ? ValueOf<value> : value
|
|
165
|
+
|
|
166
|
+
export type ErrorType = parseSchemaError.ErrorType | Errors.GlobalErrorType
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Get assets owned by user in given chain IDs.
|
|
171
|
+
*/
|
|
172
|
+
export async function getAssets(
|
|
173
|
+
client: Client,
|
|
174
|
+
parameters: getAssets.Parameters,
|
|
175
|
+
): Promise<getAssets.ReturnType> {
|
|
176
|
+
const { account, assetFilter, assetTypeFilter, chainFilter } = parameters
|
|
177
|
+
|
|
178
|
+
try {
|
|
179
|
+
const method = 'wallet_getAssets' as const
|
|
180
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
181
|
+
const result = await client.request<Schema>({
|
|
182
|
+
method,
|
|
183
|
+
params: [
|
|
184
|
+
z.encode(RpcSchema.wallet_getAssets.Parameters, {
|
|
185
|
+
account,
|
|
186
|
+
assetFilter,
|
|
187
|
+
assetTypeFilter,
|
|
188
|
+
chainFilter,
|
|
189
|
+
}),
|
|
190
|
+
],
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
const value = z.decode(RpcSchema.wallet_getAssets.Response, result)
|
|
194
|
+
const decoded = Object.entries(value).reduce(
|
|
195
|
+
(acc, [key, value]) => {
|
|
196
|
+
acc[Hex.toNumber(key as `0x${string}`)] = value
|
|
197
|
+
return acc
|
|
198
|
+
},
|
|
199
|
+
{} as Record<number, ValueOf<typeof value>>,
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
const aggregated = {} as Record<string, ValueOf<typeof decoded>[number]>
|
|
203
|
+
for (const value of Object.values(decoded)) {
|
|
204
|
+
for (const item of value) {
|
|
205
|
+
const key = JSON.stringify(item.metadata)
|
|
206
|
+
aggregated[key] = {
|
|
207
|
+
...item,
|
|
208
|
+
balance: item.balance + (aggregated[key]?.balance ?? 0n),
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return {
|
|
214
|
+
...decoded,
|
|
215
|
+
'0': Object.values(aggregated),
|
|
216
|
+
}
|
|
217
|
+
} catch (error) {
|
|
218
|
+
parseSchemaError(error)
|
|
219
|
+
throw error
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export namespace getAssets {
|
|
224
|
+
export type Parameters = RpcSchema.wallet_getAssets.Parameters
|
|
225
|
+
export type ReturnType = RpcSchema.wallet_getAssets.Response
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Requests faucet funds to be sent to an address on the Relay.
|
|
230
|
+
*/
|
|
231
|
+
export async function addFaucetFunds<chain extends Chain | undefined>(
|
|
232
|
+
client: Client<Transport, chain>,
|
|
233
|
+
parameters: addFaucetFunds.Parameters<chain>,
|
|
234
|
+
): Promise<RpcSchema.wallet_addFaucetFunds.Response> {
|
|
235
|
+
const { address, chain = client.chain, tokenAddress, value } = parameters
|
|
236
|
+
try {
|
|
237
|
+
const method = 'wallet_addFaucetFunds' as const
|
|
238
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
239
|
+
const result = await client.request<Schema>(
|
|
240
|
+
{
|
|
241
|
+
method,
|
|
242
|
+
params: [
|
|
243
|
+
z.encode(RpcSchema.wallet_addFaucetFunds.Parameters, {
|
|
244
|
+
address,
|
|
245
|
+
chainId: chain?.id!,
|
|
246
|
+
tokenAddress,
|
|
247
|
+
value,
|
|
248
|
+
}),
|
|
249
|
+
],
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
retryCount: 0,
|
|
253
|
+
},
|
|
254
|
+
)
|
|
255
|
+
// relay state can be behind node state. wait to ensure sync.
|
|
256
|
+
// TODO: figure out how to resolve.
|
|
257
|
+
await new Promise((resolve) => setTimeout(resolve, 2_000))
|
|
258
|
+
return result
|
|
259
|
+
} catch (error) {
|
|
260
|
+
parseSchemaError(error)
|
|
261
|
+
throw error
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export namespace addFaucetFunds {
|
|
266
|
+
export type Parameters<chain extends Chain | undefined = Chain | undefined> =
|
|
267
|
+
Omit<RpcSchema.wallet_addFaucetFunds.Parameters, 'chainId'> &
|
|
268
|
+
GetChainParameter<chain>
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Gets the status of a call bundle.
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* TODO
|
|
276
|
+
*
|
|
277
|
+
* @param client - The client to use.
|
|
278
|
+
* @param parameters - Parameters.
|
|
279
|
+
* @returns Result.
|
|
280
|
+
*/
|
|
281
|
+
export async function getCallsStatus(
|
|
282
|
+
client: Client,
|
|
283
|
+
parameters: getCallsStatus.Parameters,
|
|
284
|
+
): Promise<getCallsStatus.ReturnType> {
|
|
285
|
+
const { id } = parameters
|
|
286
|
+
|
|
287
|
+
try {
|
|
288
|
+
const method = 'wallet_getCallsStatus' as const
|
|
289
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
290
|
+
const result = await client.request<Schema>({
|
|
291
|
+
method,
|
|
292
|
+
params: [id],
|
|
293
|
+
})
|
|
294
|
+
return z.decode(RpcSchema.wallet_getCallsStatus.Response, result)
|
|
295
|
+
} catch (error) {
|
|
296
|
+
parseSchemaError(error)
|
|
297
|
+
throw error
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export namespace getCallsStatus {
|
|
302
|
+
export type Parameters = {
|
|
303
|
+
id: Hex.Hex
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export type ReturnType = RpcSchema.wallet_getCallsStatus.Response
|
|
307
|
+
|
|
308
|
+
export type ErrorType = parseSchemaError.ErrorType | Errors.GlobalErrorType
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Gets the keys for a given account.
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
* TODO
|
|
316
|
+
*
|
|
317
|
+
* @param client - The client to use.
|
|
318
|
+
* @param parameters - Parameters.
|
|
319
|
+
* @returns Result.
|
|
320
|
+
*/
|
|
321
|
+
export async function getKeys(
|
|
322
|
+
client: Client,
|
|
323
|
+
parameters: getKeys.Parameters,
|
|
324
|
+
): Promise<getKeys.ReturnType> {
|
|
325
|
+
const { address, chainIds } = parameters
|
|
326
|
+
|
|
327
|
+
try {
|
|
328
|
+
const method = 'wallet_getKeys' as const
|
|
329
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
330
|
+
const result = await client.request<Schema>({
|
|
331
|
+
method,
|
|
332
|
+
params: [
|
|
333
|
+
z.encode(RpcSchema.wallet_getKeys.Parameters, {
|
|
334
|
+
address,
|
|
335
|
+
chainIds,
|
|
336
|
+
}),
|
|
337
|
+
],
|
|
338
|
+
})
|
|
339
|
+
return z.decode(RpcSchema.wallet_getKeys.Response, result)
|
|
340
|
+
} catch (error) {
|
|
341
|
+
parseSchemaError(error)
|
|
342
|
+
throw error
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export namespace getKeys {
|
|
347
|
+
export type Parameters = RpcSchema.wallet_getKeys.Parameters
|
|
348
|
+
|
|
349
|
+
export type ReturnType = RpcSchema.wallet_getKeys.Response
|
|
350
|
+
|
|
351
|
+
export type ErrorType = parseSchemaError.ErrorType | Errors.GlobalErrorType
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Gets the health of the RPC.
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* TODO
|
|
359
|
+
*
|
|
360
|
+
* @param client - The client to use.
|
|
361
|
+
* @returns Result.
|
|
362
|
+
*/
|
|
363
|
+
export async function health(client: Client): Promise<health.ReturnType> {
|
|
364
|
+
const method = 'health' as const
|
|
365
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
366
|
+
const result = await withCache(
|
|
367
|
+
() =>
|
|
368
|
+
client.request<Schema>({
|
|
369
|
+
method,
|
|
370
|
+
}),
|
|
371
|
+
{ cacheKey: `${client.uid}.${method}` },
|
|
372
|
+
)
|
|
373
|
+
return z.decode(RpcSchema.health.Response, result)
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export namespace health {
|
|
377
|
+
export type ReturnType = RpcSchema.health.Response
|
|
378
|
+
|
|
379
|
+
export type ErrorType = Errors.GlobalErrorType
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Prepares a call bundle.
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* TODO
|
|
387
|
+
*
|
|
388
|
+
* @param client - The client to use.
|
|
389
|
+
* @param parameters - Parameters.
|
|
390
|
+
* @returns Result.
|
|
391
|
+
*/
|
|
392
|
+
export async function prepareCalls<
|
|
393
|
+
const calls extends readonly unknown[],
|
|
394
|
+
chain extends Chain | undefined,
|
|
395
|
+
>(
|
|
396
|
+
client: Client<Transport, chain>,
|
|
397
|
+
parameters: prepareCalls.Parameters<calls, chain>,
|
|
398
|
+
): Promise<prepareCalls.ReturnType> {
|
|
399
|
+
const { address, capabilities, chain = client.chain, key } = parameters
|
|
400
|
+
|
|
401
|
+
const calls = parameters.calls.map((call: any) => {
|
|
402
|
+
return {
|
|
403
|
+
data: call.abi
|
|
404
|
+
? AbiFunction.encodeData(
|
|
405
|
+
AbiFunction.fromAbi(call.abi, call.functionName),
|
|
406
|
+
call.args,
|
|
407
|
+
)
|
|
408
|
+
: (call.data ?? '0x'),
|
|
409
|
+
to: call.to,
|
|
410
|
+
value: call.value ?? 0n,
|
|
411
|
+
}
|
|
412
|
+
})
|
|
413
|
+
|
|
414
|
+
try {
|
|
415
|
+
const method = 'wallet_prepareCalls' as const
|
|
416
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
417
|
+
const result = await client.request<Schema>(
|
|
418
|
+
{
|
|
419
|
+
method,
|
|
420
|
+
params: [
|
|
421
|
+
z.encode(RpcSchema.wallet_prepareCalls.Parameters, {
|
|
422
|
+
calls,
|
|
423
|
+
capabilities: {
|
|
424
|
+
...capabilities,
|
|
425
|
+
meta: {
|
|
426
|
+
...capabilities?.meta,
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
chainId: chain?.id!,
|
|
430
|
+
from: address,
|
|
431
|
+
key: key
|
|
432
|
+
? {
|
|
433
|
+
prehash: key.prehash,
|
|
434
|
+
publicKey: key.publicKey,
|
|
435
|
+
type: key.type,
|
|
436
|
+
}
|
|
437
|
+
: undefined,
|
|
438
|
+
}),
|
|
439
|
+
],
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
retryCount: 0,
|
|
443
|
+
},
|
|
444
|
+
)
|
|
445
|
+
return Object.assign(
|
|
446
|
+
z.decode(RpcSchema.wallet_prepareCalls.Response, result),
|
|
447
|
+
{ _raw: result },
|
|
448
|
+
)
|
|
449
|
+
} catch (error) {
|
|
450
|
+
parseSchemaError(error)
|
|
451
|
+
parseExecutionError(error, { calls: parameters.calls })
|
|
452
|
+
throw error
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export namespace prepareCalls {
|
|
457
|
+
export type Parameters<
|
|
458
|
+
calls extends readonly unknown[] = readonly unknown[],
|
|
459
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
460
|
+
> = {
|
|
461
|
+
address?: Address.Address | undefined
|
|
462
|
+
calls: Calls<Narrow<calls>>
|
|
463
|
+
capabilities?: RpcSchema.wallet_prepareCalls.Capabilities | undefined
|
|
464
|
+
key: RpcSchema.wallet_prepareCalls.Parameters['key']
|
|
465
|
+
} & GetChainParameter<chain>
|
|
466
|
+
|
|
467
|
+
export type ReturnType = RpcSchema.wallet_prepareCalls.Response & {
|
|
468
|
+
_raw: z.input<typeof RpcSchema.wallet_prepareCalls.Response>
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export type ErrorType =
|
|
472
|
+
| parseSchemaError.ErrorType
|
|
473
|
+
| parseExecutionError.ErrorType
|
|
474
|
+
| Errors.GlobalErrorType
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Prepares an account upgrade.
|
|
479
|
+
*
|
|
480
|
+
* @example
|
|
481
|
+
* TODO
|
|
482
|
+
*
|
|
483
|
+
* @param client - Client to use.
|
|
484
|
+
* @param parameters - Parameters.
|
|
485
|
+
* @returns Result.
|
|
486
|
+
*/
|
|
487
|
+
export async function prepareUpgradeAccount<chain extends Chain | undefined>(
|
|
488
|
+
client: Client<Transport, chain>,
|
|
489
|
+
parameters: prepareUpgradeAccount.Parameters<chain>,
|
|
490
|
+
): Promise<prepareUpgradeAccount.ReturnType> {
|
|
491
|
+
const {
|
|
492
|
+
address,
|
|
493
|
+
chain = client.chain,
|
|
494
|
+
delegation,
|
|
495
|
+
...capabilities
|
|
496
|
+
} = parameters
|
|
497
|
+
|
|
498
|
+
try {
|
|
499
|
+
const method = 'wallet_prepareUpgradeAccount' as const
|
|
500
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
501
|
+
const result = await client.request<Schema>(
|
|
502
|
+
{
|
|
503
|
+
method,
|
|
504
|
+
params: [
|
|
505
|
+
z.encode(
|
|
506
|
+
RpcSchema.wallet_prepareUpgradeAccount.Parameters,
|
|
507
|
+
U.normalizeValue({
|
|
508
|
+
address,
|
|
509
|
+
capabilities,
|
|
510
|
+
chainId: chain?.id,
|
|
511
|
+
delegation,
|
|
512
|
+
}),
|
|
513
|
+
),
|
|
514
|
+
],
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
retryCount: 0,
|
|
518
|
+
},
|
|
519
|
+
)
|
|
520
|
+
return z.decode(RpcSchema.wallet_prepareUpgradeAccount.Response, result)
|
|
521
|
+
} catch (error) {
|
|
522
|
+
parseSchemaError(error)
|
|
523
|
+
parseExecutionError(error)
|
|
524
|
+
throw error
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
export namespace prepareUpgradeAccount {
|
|
528
|
+
export type Parameters<chain extends Chain | undefined = Chain | undefined> =
|
|
529
|
+
RpcSchema.wallet_prepareUpgradeAccount.Parameters['capabilities'] &
|
|
530
|
+
Omit<
|
|
531
|
+
RpcSchema.wallet_prepareUpgradeAccount.Parameters,
|
|
532
|
+
'capabilities' | 'chainId'
|
|
533
|
+
> &
|
|
534
|
+
GetChainParameter<chain>
|
|
535
|
+
|
|
536
|
+
export type ReturnType = RpcSchema.wallet_prepareUpgradeAccount.Response
|
|
537
|
+
|
|
538
|
+
export type ErrorType =
|
|
539
|
+
| parseSchemaError.ErrorType
|
|
540
|
+
| parseExecutionError.ErrorType
|
|
541
|
+
| Errors.GlobalErrorType
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Broadcasts a signed call bundle.
|
|
546
|
+
*
|
|
547
|
+
* @example
|
|
548
|
+
* TODO
|
|
549
|
+
*
|
|
550
|
+
* @param client - The client to use.
|
|
551
|
+
* @param parameters - Parameters.
|
|
552
|
+
* @returns Result.
|
|
553
|
+
*/
|
|
554
|
+
export async function sendPreparedCalls(
|
|
555
|
+
client: Client,
|
|
556
|
+
parameters: sendPreparedCalls.Parameters,
|
|
557
|
+
): Promise<sendPreparedCalls.ReturnType> {
|
|
558
|
+
const { capabilities, context, key, signature } = parameters
|
|
559
|
+
try {
|
|
560
|
+
const method = 'wallet_sendPreparedCalls' as const
|
|
561
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
562
|
+
const result = await client.request<Schema>(
|
|
563
|
+
{
|
|
564
|
+
method,
|
|
565
|
+
params: [
|
|
566
|
+
z.encode(RpcSchema.wallet_sendPreparedCalls.Parameters, {
|
|
567
|
+
capabilities,
|
|
568
|
+
context: {
|
|
569
|
+
preCall: context.preCall,
|
|
570
|
+
quote: context.quote,
|
|
571
|
+
},
|
|
572
|
+
key: key
|
|
573
|
+
? {
|
|
574
|
+
prehash: key.prehash,
|
|
575
|
+
publicKey: key.publicKey,
|
|
576
|
+
type: key.type,
|
|
577
|
+
}
|
|
578
|
+
: undefined,
|
|
579
|
+
signature,
|
|
580
|
+
}),
|
|
581
|
+
],
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
retryCount: 0,
|
|
585
|
+
},
|
|
586
|
+
)
|
|
587
|
+
return z.decode(RpcSchema.wallet_sendPreparedCalls.Response, result)
|
|
588
|
+
} catch (error) {
|
|
589
|
+
parseSchemaError(error)
|
|
590
|
+
parseExecutionError(error)
|
|
591
|
+
throw error
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
export namespace sendPreparedCalls {
|
|
596
|
+
export type Parameters = RpcSchema.wallet_sendPreparedCalls.Parameters
|
|
597
|
+
|
|
598
|
+
export type ReturnType = RpcSchema.wallet_sendPreparedCalls.Response
|
|
599
|
+
|
|
600
|
+
export type ErrorType =
|
|
601
|
+
| parseSchemaError.ErrorType
|
|
602
|
+
| parseExecutionError.ErrorType
|
|
603
|
+
| Errors.GlobalErrorType
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* NOTE: SHOULD ONLY BE USED ON SERVER.
|
|
608
|
+
*
|
|
609
|
+
* Gets onramp contact info for address.
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* TODO
|
|
613
|
+
*
|
|
614
|
+
* @param client - Client to use.
|
|
615
|
+
* @param parameters - Parameters.
|
|
616
|
+
* @returns Result.
|
|
617
|
+
*/
|
|
618
|
+
export async function getOnrampContactInfo(
|
|
619
|
+
client: Client,
|
|
620
|
+
parameters: getOnrampContactInfo.Parameters,
|
|
621
|
+
): Promise<getOnrampContactInfo.ReturnType> {
|
|
622
|
+
const { address, secret } = parameters
|
|
623
|
+
|
|
624
|
+
try {
|
|
625
|
+
const method = 'account_getOnrampContactInfo' as const
|
|
626
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
627
|
+
const result = await client.request<Schema>(
|
|
628
|
+
{
|
|
629
|
+
method,
|
|
630
|
+
params: [
|
|
631
|
+
z.encode(RpcSchema.account_getOnrampContactInfo.Parameters, {
|
|
632
|
+
address,
|
|
633
|
+
secret,
|
|
634
|
+
}),
|
|
635
|
+
],
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
retryCount: 0,
|
|
639
|
+
},
|
|
640
|
+
)
|
|
641
|
+
return z.decode(RpcSchema.account_getOnrampContactInfo.Response, result)
|
|
642
|
+
} catch (error) {
|
|
643
|
+
parseSchemaError(error)
|
|
644
|
+
parseExecutionError(error)
|
|
645
|
+
throw error
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
export namespace getOnrampContactInfo {
|
|
650
|
+
export type Parameters = RpcSchema.account_getOnrampContactInfo.Parameters
|
|
651
|
+
|
|
652
|
+
export type ReturnType = RpcSchema.account_getOnrampContactInfo.Response
|
|
653
|
+
|
|
654
|
+
export type ErrorType =
|
|
655
|
+
| parseSchemaError.ErrorType
|
|
656
|
+
| parseExecutionError.ErrorType
|
|
657
|
+
| Errors.GlobalErrorType
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Gets onramp status for address
|
|
662
|
+
*
|
|
663
|
+
* @example
|
|
664
|
+
* TODO
|
|
665
|
+
*
|
|
666
|
+
* @param client - Client to use.
|
|
667
|
+
* @param parameters - Parameters.
|
|
668
|
+
* @returns Result.
|
|
669
|
+
*/
|
|
670
|
+
export async function onrampStatus(
|
|
671
|
+
client: Client,
|
|
672
|
+
parameters: onrampStatus.Parameters,
|
|
673
|
+
): Promise<onrampStatus.ReturnType> {
|
|
674
|
+
const { address } = parameters
|
|
675
|
+
|
|
676
|
+
try {
|
|
677
|
+
const method = 'account_onrampStatus' as const
|
|
678
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
679
|
+
const result = await client.request<Schema>(
|
|
680
|
+
{
|
|
681
|
+
method,
|
|
682
|
+
params: [
|
|
683
|
+
z.encode(RpcSchema.account_onrampStatus.Parameters, {
|
|
684
|
+
address,
|
|
685
|
+
}),
|
|
686
|
+
],
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
retryCount: 0,
|
|
690
|
+
},
|
|
691
|
+
)
|
|
692
|
+
return z.decode(RpcSchema.account_onrampStatus.Response, result)
|
|
693
|
+
} catch (error) {
|
|
694
|
+
parseSchemaError(error)
|
|
695
|
+
parseExecutionError(error)
|
|
696
|
+
throw error
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
export namespace onrampStatus {
|
|
701
|
+
export type Parameters = RpcSchema.account_onrampStatus.Parameters
|
|
702
|
+
|
|
703
|
+
export type ReturnType = RpcSchema.account_onrampStatus.Response
|
|
704
|
+
|
|
705
|
+
export type ErrorType =
|
|
706
|
+
| parseSchemaError.ErrorType
|
|
707
|
+
| parseExecutionError.ErrorType
|
|
708
|
+
| Errors.GlobalErrorType
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Resends phone verification for address
|
|
713
|
+
*
|
|
714
|
+
* @example
|
|
715
|
+
* TODO
|
|
716
|
+
*
|
|
717
|
+
* @param client - Client to use.
|
|
718
|
+
* @param parameters - Parameters.
|
|
719
|
+
* @returns Result.
|
|
720
|
+
*/
|
|
721
|
+
export async function resendVerifyPhone(
|
|
722
|
+
client: Client,
|
|
723
|
+
parameters: resendVerifyPhone.Parameters,
|
|
724
|
+
): Promise<resendVerifyPhone.ReturnType> {
|
|
725
|
+
const { phone, walletAddress } = parameters
|
|
726
|
+
|
|
727
|
+
try {
|
|
728
|
+
const method = 'account_resendVerifyPhone' as const
|
|
729
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
730
|
+
const result = await client.request<Schema>(
|
|
731
|
+
{
|
|
732
|
+
method,
|
|
733
|
+
params: [
|
|
734
|
+
z.encode(RpcSchema.account_resendVerifyPhone.Parameters, {
|
|
735
|
+
phone,
|
|
736
|
+
walletAddress,
|
|
737
|
+
}),
|
|
738
|
+
],
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
retryCount: 0,
|
|
742
|
+
},
|
|
743
|
+
)
|
|
744
|
+
return z.decode(RpcSchema.account_resendVerifyPhone.Response, result)
|
|
745
|
+
} catch (error) {
|
|
746
|
+
parseSchemaError(error)
|
|
747
|
+
parseExecutionError(error)
|
|
748
|
+
throw error
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
export namespace resendVerifyPhone {
|
|
753
|
+
export type Parameters = RpcSchema.account_resendVerifyPhone.Parameters
|
|
754
|
+
|
|
755
|
+
export type ReturnType = RpcSchema.account_resendVerifyPhone.Response
|
|
756
|
+
|
|
757
|
+
export type ErrorType =
|
|
758
|
+
| parseSchemaError.ErrorType
|
|
759
|
+
| parseExecutionError.ErrorType
|
|
760
|
+
| Errors.GlobalErrorType
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Sets email for address
|
|
765
|
+
*
|
|
766
|
+
* @example
|
|
767
|
+
* TODO
|
|
768
|
+
*
|
|
769
|
+
* @param client - Client to use.
|
|
770
|
+
* @param parameters - Parameters.
|
|
771
|
+
* @returns Result.
|
|
772
|
+
*/
|
|
773
|
+
export async function setEmail(
|
|
774
|
+
client: Client,
|
|
775
|
+
parameters: setEmail.Parameters,
|
|
776
|
+
): Promise<setEmail.ReturnType> {
|
|
777
|
+
const { email, walletAddress } = parameters
|
|
778
|
+
|
|
779
|
+
try {
|
|
780
|
+
const method = 'account_setEmail' as const
|
|
781
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
782
|
+
const result = await client.request<Schema>(
|
|
783
|
+
{
|
|
784
|
+
method,
|
|
785
|
+
params: [
|
|
786
|
+
z.encode(RpcSchema.account_setEmail.Parameters, {
|
|
787
|
+
email,
|
|
788
|
+
walletAddress,
|
|
789
|
+
}),
|
|
790
|
+
],
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
retryCount: 0,
|
|
794
|
+
},
|
|
795
|
+
)
|
|
796
|
+
return z.decode(RpcSchema.account_setEmail.Response, result)
|
|
797
|
+
} catch (error) {
|
|
798
|
+
parseSchemaError(error)
|
|
799
|
+
parseExecutionError(error)
|
|
800
|
+
throw error
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
export namespace setEmail {
|
|
805
|
+
export type Parameters = RpcSchema.account_setEmail.Parameters
|
|
806
|
+
|
|
807
|
+
export type ReturnType = RpcSchema.account_setEmail.Response
|
|
808
|
+
|
|
809
|
+
export type ErrorType =
|
|
810
|
+
| parseSchemaError.ErrorType
|
|
811
|
+
| parseExecutionError.ErrorType
|
|
812
|
+
| Errors.GlobalErrorType
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Sets phone for address
|
|
817
|
+
*
|
|
818
|
+
* @example
|
|
819
|
+
* TODO
|
|
820
|
+
*
|
|
821
|
+
* @param client - Client to use.
|
|
822
|
+
* @param parameters - Parameters.
|
|
823
|
+
* @returns Result.
|
|
824
|
+
*/
|
|
825
|
+
export async function setPhone(
|
|
826
|
+
client: Client,
|
|
827
|
+
parameters: setPhone.Parameters,
|
|
828
|
+
): Promise<setPhone.ReturnType> {
|
|
829
|
+
const { phone, walletAddress } = parameters
|
|
830
|
+
|
|
831
|
+
try {
|
|
832
|
+
const method = 'account_setPhone' as const
|
|
833
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
834
|
+
const result = await client.request<Schema>(
|
|
835
|
+
{
|
|
836
|
+
method,
|
|
837
|
+
params: [
|
|
838
|
+
z.encode(RpcSchema.account_setPhone.Parameters, {
|
|
839
|
+
phone,
|
|
840
|
+
walletAddress,
|
|
841
|
+
}),
|
|
842
|
+
],
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
retryCount: 0,
|
|
846
|
+
},
|
|
847
|
+
)
|
|
848
|
+
return z.decode(RpcSchema.account_setPhone.Response, result)
|
|
849
|
+
} catch (error) {
|
|
850
|
+
parseSchemaError(error)
|
|
851
|
+
parseExecutionError(error)
|
|
852
|
+
throw error
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
export namespace setPhone {
|
|
857
|
+
export type Parameters = RpcSchema.account_setPhone.Parameters
|
|
858
|
+
|
|
859
|
+
export type ReturnType = RpcSchema.account_setPhone.Response
|
|
860
|
+
|
|
861
|
+
export type ErrorType =
|
|
862
|
+
| parseSchemaError.ErrorType
|
|
863
|
+
| parseExecutionError.ErrorType
|
|
864
|
+
| Errors.GlobalErrorType
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Submits an account upgrade to the Relay.
|
|
869
|
+
*
|
|
870
|
+
* @example
|
|
871
|
+
* TODO
|
|
872
|
+
*
|
|
873
|
+
* @param client - Client to use.
|
|
874
|
+
* @param parameters - Parameters.
|
|
875
|
+
* @returns Result.
|
|
876
|
+
*/
|
|
877
|
+
export async function upgradeAccount(
|
|
878
|
+
client: Client,
|
|
879
|
+
parameters: upgradeAccount.Parameters,
|
|
880
|
+
): Promise<upgradeAccount.ReturnType> {
|
|
881
|
+
const { context, signatures } = parameters
|
|
882
|
+
|
|
883
|
+
try {
|
|
884
|
+
const method = 'wallet_upgradeAccount' as const
|
|
885
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
886
|
+
await client.request<Schema>(
|
|
887
|
+
{
|
|
888
|
+
method,
|
|
889
|
+
params: [
|
|
890
|
+
z.encode(RpcSchema.wallet_upgradeAccount.Parameters, {
|
|
891
|
+
context,
|
|
892
|
+
signatures,
|
|
893
|
+
}),
|
|
894
|
+
],
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
retryCount: 0,
|
|
898
|
+
},
|
|
899
|
+
)
|
|
900
|
+
} catch (error) {
|
|
901
|
+
parseSchemaError(error)
|
|
902
|
+
parseExecutionError(error)
|
|
903
|
+
throw error
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
export namespace upgradeAccount {
|
|
908
|
+
export type Parameters = RpcSchema.wallet_upgradeAccount.Parameters
|
|
909
|
+
|
|
910
|
+
export type ReturnType = RpcSchema.wallet_upgradeAccount.Response
|
|
911
|
+
|
|
912
|
+
export type ErrorType =
|
|
913
|
+
| parseSchemaError.ErrorType
|
|
914
|
+
| parseExecutionError.ErrorType
|
|
915
|
+
| Errors.GlobalErrorType
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Verifies email for address
|
|
920
|
+
*
|
|
921
|
+
* @example
|
|
922
|
+
* TODO
|
|
923
|
+
*
|
|
924
|
+
* @param client - Client to use.
|
|
925
|
+
* @param parameters - Parameters.
|
|
926
|
+
* @returns Result.
|
|
927
|
+
*/
|
|
928
|
+
export async function verifyEmail(
|
|
929
|
+
client: Client,
|
|
930
|
+
parameters: verifyEmail.Parameters,
|
|
931
|
+
): Promise<verifyEmail.ReturnType> {
|
|
932
|
+
const { chainId, email, signature, token, walletAddress } = parameters
|
|
933
|
+
|
|
934
|
+
try {
|
|
935
|
+
const method = 'account_verifyEmail' as const
|
|
936
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
937
|
+
const result = await client.request<Schema>(
|
|
938
|
+
{
|
|
939
|
+
method,
|
|
940
|
+
params: [
|
|
941
|
+
z.encode(RpcSchema.account_verifyEmail.Parameters, {
|
|
942
|
+
chainId,
|
|
943
|
+
email,
|
|
944
|
+
signature,
|
|
945
|
+
token,
|
|
946
|
+
walletAddress,
|
|
947
|
+
}),
|
|
948
|
+
],
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
retryCount: 0,
|
|
952
|
+
},
|
|
953
|
+
)
|
|
954
|
+
return z.decode(RpcSchema.account_verifyEmail.Response, result)
|
|
955
|
+
} catch (error) {
|
|
956
|
+
parseSchemaError(error)
|
|
957
|
+
parseExecutionError(error)
|
|
958
|
+
throw error
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
export namespace verifyEmail {
|
|
963
|
+
export type Parameters = RpcSchema.account_verifyEmail.Parameters
|
|
964
|
+
|
|
965
|
+
export type ReturnType = RpcSchema.account_verifyEmail.Response
|
|
966
|
+
|
|
967
|
+
export type ErrorType =
|
|
968
|
+
| parseSchemaError.ErrorType
|
|
969
|
+
| parseExecutionError.ErrorType
|
|
970
|
+
| Errors.GlobalErrorType
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Verifies email for address
|
|
975
|
+
*
|
|
976
|
+
* @example
|
|
977
|
+
* TODO
|
|
978
|
+
*
|
|
979
|
+
* @param client - Client to use.
|
|
980
|
+
* @param parameters - Parameters.
|
|
981
|
+
* @returns Result.
|
|
982
|
+
*/
|
|
983
|
+
export async function verifyPhone(
|
|
984
|
+
client: Client,
|
|
985
|
+
parameters: verifyPhone.Parameters,
|
|
986
|
+
): Promise<verifyPhone.ReturnType> {
|
|
987
|
+
const { code, phone, walletAddress } = parameters
|
|
988
|
+
|
|
989
|
+
try {
|
|
990
|
+
const method = 'account_verifyPhone' as const
|
|
991
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
992
|
+
const result = await client.request<Schema>(
|
|
993
|
+
{
|
|
994
|
+
method,
|
|
995
|
+
params: [
|
|
996
|
+
z.encode(RpcSchema.account_verifyPhone.Parameters, {
|
|
997
|
+
code,
|
|
998
|
+
phone,
|
|
999
|
+
walletAddress,
|
|
1000
|
+
}),
|
|
1001
|
+
],
|
|
1002
|
+
},
|
|
1003
|
+
{
|
|
1004
|
+
retryCount: 0,
|
|
1005
|
+
},
|
|
1006
|
+
)
|
|
1007
|
+
return z.decode(RpcSchema.account_verifyPhone.Response, result)
|
|
1008
|
+
} catch (error) {
|
|
1009
|
+
parseSchemaError(error)
|
|
1010
|
+
parseExecutionError(error)
|
|
1011
|
+
throw error
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
export namespace verifyPhone {
|
|
1016
|
+
export type Parameters = RpcSchema.account_verifyPhone.Parameters
|
|
1017
|
+
|
|
1018
|
+
export type ReturnType = RpcSchema.account_verifyPhone.Response
|
|
1019
|
+
|
|
1020
|
+
export type ErrorType =
|
|
1021
|
+
| parseSchemaError.ErrorType
|
|
1022
|
+
| parseExecutionError.ErrorType
|
|
1023
|
+
| Errors.GlobalErrorType
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Verifies a prepare calls response.
|
|
1028
|
+
*
|
|
1029
|
+
* @param client - Client to use.
|
|
1030
|
+
* @param parameters - Parameters.
|
|
1031
|
+
* @returns Whether or not the response is valid.
|
|
1032
|
+
*/
|
|
1033
|
+
export async function verifyPrepareCallsResponse(
|
|
1034
|
+
client: Client,
|
|
1035
|
+
parameters: verifyPrepareCallsResponse.Parameters,
|
|
1036
|
+
) {
|
|
1037
|
+
const { signature } = parameters
|
|
1038
|
+
const {
|
|
1039
|
+
signature: _,
|
|
1040
|
+
capabilities: { feeSignature: __, ...capabilities },
|
|
1041
|
+
...response
|
|
1042
|
+
} = parameters.response
|
|
1043
|
+
|
|
1044
|
+
const sorted = sortKeys({ capabilities, ...response })
|
|
1045
|
+
|
|
1046
|
+
const payload = Hash.keccak256(Hex.fromString(JSON.stringify(sorted)))
|
|
1047
|
+
const address = Secp256k1.recoverAddress({
|
|
1048
|
+
payload,
|
|
1049
|
+
signature: Signature.fromHex(signature),
|
|
1050
|
+
})
|
|
1051
|
+
const { quoteSigner } = await health(client)
|
|
1052
|
+
return address === quoteSigner
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
export namespace verifyPrepareCallsResponse {
|
|
1056
|
+
export type Parameters = {
|
|
1057
|
+
response: z.input<typeof RpcSchema.wallet_prepareCalls.Response>
|
|
1058
|
+
signature: Hex.Hex
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* Verifies a signature.
|
|
1064
|
+
*
|
|
1065
|
+
* @example
|
|
1066
|
+
* TODO
|
|
1067
|
+
*
|
|
1068
|
+
* @param client - The client to use.
|
|
1069
|
+
* @param parameters - Parameters.
|
|
1070
|
+
* @returns Result.
|
|
1071
|
+
*/
|
|
1072
|
+
export async function verifySignature<chain extends Chain | undefined>(
|
|
1073
|
+
client: Client<Transport, chain>,
|
|
1074
|
+
parameters: verifySignature.Parameters<chain>,
|
|
1075
|
+
): Promise<verifySignature.ReturnType> {
|
|
1076
|
+
const { address, chain = client.chain, digest, signature } = parameters
|
|
1077
|
+
|
|
1078
|
+
try {
|
|
1079
|
+
async function fallback() {
|
|
1080
|
+
const valid = await verifyHash(client, {
|
|
1081
|
+
address,
|
|
1082
|
+
hash: digest,
|
|
1083
|
+
signature,
|
|
1084
|
+
})
|
|
1085
|
+
return {
|
|
1086
|
+
proof: null,
|
|
1087
|
+
valid,
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
const method = 'wallet_verifySignature' as const
|
|
1092
|
+
type Schema = Extract<RpcSchema.Viem[number], { Method: typeof method }>
|
|
1093
|
+
const result = await (async () => {
|
|
1094
|
+
const result = await client
|
|
1095
|
+
.request<Schema>(
|
|
1096
|
+
{
|
|
1097
|
+
method,
|
|
1098
|
+
params: [
|
|
1099
|
+
z.encode(RpcSchema.wallet_verifySignature.Parameters, {
|
|
1100
|
+
address,
|
|
1101
|
+
chainId: chain?.id!,
|
|
1102
|
+
digest,
|
|
1103
|
+
signature,
|
|
1104
|
+
}),
|
|
1105
|
+
],
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
retryCount: 0,
|
|
1109
|
+
},
|
|
1110
|
+
)
|
|
1111
|
+
.catch(fallback)
|
|
1112
|
+
if (result.valid) return result
|
|
1113
|
+
return fallback()
|
|
1114
|
+
})()
|
|
1115
|
+
return z.decode(RpcSchema.wallet_verifySignature.Response, result)
|
|
1116
|
+
} catch (error) {
|
|
1117
|
+
parseSchemaError(error)
|
|
1118
|
+
throw error
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
export namespace verifySignature {
|
|
1123
|
+
export type Parameters<chain extends Chain | undefined = Chain | undefined> =
|
|
1124
|
+
Omit<
|
|
1125
|
+
RpcSchema.wallet_verifySignature.Parameters,
|
|
1126
|
+
'chainId' | 'keyIdOrAddress'
|
|
1127
|
+
> & {
|
|
1128
|
+
address: Address.Address
|
|
1129
|
+
} & GetChainParameter<chain>
|
|
1130
|
+
|
|
1131
|
+
export type ReturnType = RpcSchema.wallet_verifySignature.Response
|
|
1132
|
+
|
|
1133
|
+
export type ErrorType = parseSchemaError.ErrorType | Errors.GlobalErrorType
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
export function parseExecutionError<const calls extends readonly unknown[]>(
|
|
1137
|
+
e: unknown,
|
|
1138
|
+
{ calls }: { calls?: sendCalls.Parameters<calls>['calls'] | undefined } = {},
|
|
1139
|
+
) {
|
|
1140
|
+
if (!(e instanceof BaseError)) return
|
|
1141
|
+
|
|
1142
|
+
const getAbiError = (error: GetExecuteErrorReturnType) => {
|
|
1143
|
+
try {
|
|
1144
|
+
if (error.name === 'ContractFunctionExecutionError') {
|
|
1145
|
+
const data =
|
|
1146
|
+
error.cause.name === 'ContractFunctionRevertedError'
|
|
1147
|
+
? error.cause.data
|
|
1148
|
+
: undefined
|
|
1149
|
+
if (data)
|
|
1150
|
+
return AbiError.fromAbi(
|
|
1151
|
+
[data.abiItem],
|
|
1152
|
+
data.errorName,
|
|
1153
|
+
) as AbiError.AbiError
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
const cause = error.walk(
|
|
1157
|
+
(e) =>
|
|
1158
|
+
!(e instanceof Error) &&
|
|
1159
|
+
(e as { code?: number | undefined }).code === 3,
|
|
1160
|
+
) as (BaseError & { code: number; data: Hex.Hex }) | undefined
|
|
1161
|
+
if (!cause) return undefined
|
|
1162
|
+
|
|
1163
|
+
const { data, message } = cause
|
|
1164
|
+
if (data === '0xd0d5039b') return AbiError.from('error Unauthorized()')
|
|
1165
|
+
return {
|
|
1166
|
+
inputs: [],
|
|
1167
|
+
name: (message ?? data).split('(')[0]!,
|
|
1168
|
+
type: 'error',
|
|
1169
|
+
} satisfies AbiError.AbiError
|
|
1170
|
+
} catch {
|
|
1171
|
+
return undefined
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
const error = getExecuteError(e as BaseError, {
|
|
1175
|
+
calls: (calls ?? []) as any,
|
|
1176
|
+
})
|
|
1177
|
+
const abiError = getAbiError(error)
|
|
1178
|
+
if (error === e && !abiError) return
|
|
1179
|
+
throw new ExecutionError(Object.assign(error, { abiError }))
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
export function sortKeys<value>(value: value): value {
|
|
1183
|
+
if (typeof value === 'object' && value !== null) {
|
|
1184
|
+
if (Array.isArray(value)) return value.map(sortKeys) as value
|
|
1185
|
+
const result = {} as Record<string, unknown>
|
|
1186
|
+
for (const key of Object.keys(value).sort())
|
|
1187
|
+
result[key] = sortKeys(value[key as keyof typeof value])
|
|
1188
|
+
return result as value
|
|
1189
|
+
}
|
|
1190
|
+
return value
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
export declare namespace parseExecutionError {
|
|
1194
|
+
export type ErrorType = ExecutionError | Errors.GlobalErrorType
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
/** Thrown when schema validation fails. */
|
|
1198
|
+
export function parseSchemaError(e: unknown) {
|
|
1199
|
+
if ((e as any).name === '$ZodError') throw u.toValidationError(e)
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
export declare namespace parseSchemaError {
|
|
1203
|
+
type ErrorType = u.ValidationError | Errors.GlobalErrorType
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
/** Thrown when the execution fails. */
|
|
1207
|
+
export class ExecutionError extends Errors.BaseError<BaseError> {
|
|
1208
|
+
override readonly name = 'Rpc.ExecutionError'
|
|
1209
|
+
|
|
1210
|
+
abiError?: AbiError.AbiError | undefined
|
|
1211
|
+
|
|
1212
|
+
constructor(cause: BaseError & { abiError?: AbiError.AbiError | undefined }) {
|
|
1213
|
+
super('An error occurred while executing calls.', {
|
|
1214
|
+
cause,
|
|
1215
|
+
metaMessages: [cause.abiError && 'Reason: ' + cause.abiError.name].filter(
|
|
1216
|
+
Boolean,
|
|
1217
|
+
),
|
|
1218
|
+
})
|
|
1219
|
+
|
|
1220
|
+
this.abiError = cause.abiError
|
|
1221
|
+
}
|
|
1222
|
+
}
|