rise-wallet 0.1.4-beta.1 → 0.2.28
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 +34 -0
- package/dist/cli/Dialog.js +60 -0
- package/dist/cli/Dialog.js.map +1 -0
- package/dist/cli/Messenger.d.ts +7 -0
- package/dist/cli/Messenger.js +123 -0
- package/dist/cli/Messenger.js.map +1 -0
- package/dist/cli/bin/commands-D7N5ucUu.js +50 -0
- package/dist/cli/bin/index.js +9 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +3 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/internal/http.d.ts +6 -0
- package/dist/cli/internal/http.js +17 -0
- package/dist/cli/internal/http.js.map +1 -0
- package/dist/cli/tsdown.config.d.ts +2 -0
- package/dist/cli/tsdown.config.js +28 -0
- package/dist/cli/tsdown.config.js.map +1 -0
- package/dist/core/Chains.d.ts +210 -0
- package/dist/core/Chains.js +20 -0
- package/dist/core/Chains.js.map +1 -0
- package/dist/core/Dialog.d.ts +307 -0
- package/dist/core/Dialog.js +809 -0
- package/dist/core/Dialog.js.map +1 -0
- package/dist/core/Messenger.d.ts +164 -0
- package/dist/core/Messenger.js +207 -0
- package/dist/core/Messenger.js.map +1 -0
- package/dist/core/Mode.d.ts +4 -0
- package/dist/core/Mode.js +5 -0
- package/dist/core/Mode.js.map +1 -0
- package/dist/core/Porto.d.ts +1608 -0
- package/dist/core/Porto.js +105 -0
- package/dist/core/Porto.js.map +1 -0
- package/dist/core/RpcSchema.d.ts +81 -0
- package/dist/core/RpcSchema.js +2 -0
- package/dist/core/RpcSchema.js.map +1 -0
- package/dist/core/Storage.d.ts +14 -0
- package/dist/core/Storage.js +109 -0
- package/dist/core/Storage.js.map +1 -0
- package/dist/core/Transport.d.ts +22 -0
- package/dist/core/Transport.js +37 -0
- package/dist/core/Transport.js.map +1 -0
- package/dist/core/internal/_generated/chains.d.ts +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/IthacaAccount.d.ts +1120 -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/call.d.ts +163 -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 +17 -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 +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 +21 -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 +344 -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 +799 -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 +1401 -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 +684 -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 +59 -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 +71 -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 +13 -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 +8 -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 +29 -0
- package/dist/core/internal/provider.js +941 -0
- package/dist/core/internal/provider.js.map +1 -0
- package/dist/core/internal/relay/rpcSchema.d.ts +75 -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 +164 -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 +167 -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 +43 -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 +39 -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 +62 -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 +369 -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 +1528 -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 +13 -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 +18 -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 +313 -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 +164 -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 +102 -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 +937 -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 +3314 -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 +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 +18 -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 +32 -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 +2 -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 +57 -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 +298 -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 +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 +10 -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 +24 -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 +1480 -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 +9 -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 +26 -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 +4 -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 +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 +16 -2
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -0
- package/dist/internal/index.d.ts +3 -0
- package/dist/internal/index.js +4 -0
- package/dist/internal/index.js.map +1 -0
- package/dist/react-native/crypto.d.ts +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 +7 -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 +2 -0
- package/dist/react-native/register.js +15 -0
- package/dist/react-native/register.js.map +1 -0
- package/dist/register/index.d.ts +14 -0
- package/dist/register/index.js +2 -0
- package/dist/register/index.js.map +1 -0
- package/dist/remote/Actions.d.ts +33 -0
- package/dist/remote/Actions.js +76 -0
- package/dist/remote/Actions.js.map +1 -0
- package/dist/remote/Events.d.ts +46 -0
- package/dist/remote/Events.js +132 -0
- package/dist/remote/Events.js.map +1 -0
- package/dist/remote/Hooks.d.ts +3800 -0
- package/dist/remote/Hooks.js +106 -0
- package/dist/remote/Hooks.js.map +1 -0
- package/dist/remote/Porto.d.ts +857 -0
- package/dist/remote/Porto.js +66 -0
- package/dist/remote/Porto.js.map +1 -0
- package/dist/remote/index.d.ts +4 -0
- package/dist/remote/index.js +5 -0
- package/dist/remote/index.js.map +1 -0
- package/dist/remote/internal/methodPolicies.d.ts +96 -0
- package/dist/remote/internal/methodPolicies.js +102 -0
- package/dist/remote/internal/methodPolicies.js.map +1 -0
- package/dist/server/Route.d.ts +87 -0
- package/dist/server/Route.js +189 -0
- package/dist/server/Route.js.map +1 -0
- package/dist/server/Router.d.ts +23 -0
- package/dist/server/Router.js +29 -0
- package/dist/server/Router.js.map +1 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +3 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/internal/merchantSchema.d.ts +64 -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 +123 -0
- package/dist/server/internal/requestListener.js +172 -0
- package/dist/server/internal/requestListener.js.map +1 -0
- package/dist/theme/Theme.d.ts +121 -0
- package/dist/theme/Theme.js +18 -0
- package/dist/theme/Theme.js.map +1 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/index.js +2 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/trusted-hosts.d.ts +1 -0
- package/dist/trusted-hosts.js +41 -0
- package/dist/trusted-hosts.js.map +1 -0
- package/dist/viem/Account.d.ts +110 -0
- package/dist/viem/Account.js +132 -0
- package/dist/viem/Account.js.map +1 -0
- package/dist/viem/AccountActions.d.ts +10 -0
- package/dist/viem/AccountActions.js +14 -0
- package/dist/viem/AccountActions.js.map +1 -0
- package/dist/viem/CapabilitiesSchema.d.ts +14 -0
- package/dist/viem/CapabilitiesSchema.js +2 -0
- package/dist/viem/CapabilitiesSchema.js.map +1 -0
- package/dist/viem/ContractActions.d.ts +208 -0
- package/dist/viem/ContractActions.js +350 -0
- package/dist/viem/ContractActions.js.map +1 -0
- package/dist/viem/Key.d.ts +1155 -0
- package/dist/viem/Key.js +924 -0
- package/dist/viem/Key.js.map +1 -0
- package/dist/viem/RelayActions.d.ts +435 -0
- package/dist/viem/RelayActions.js +385 -0
- package/dist/viem/RelayActions.js.map +1 -0
- package/dist/viem/RelayClient.d.ts +26 -0
- package/dist/viem/RelayClient.js +44 -0
- package/dist/viem/RelayClient.js.map +1 -0
- package/dist/viem/RpcSchema.d.ts +22 -0
- package/dist/viem/RpcSchema.js +2 -0
- package/dist/viem/RpcSchema.js.map +1 -0
- package/dist/viem/WalletActions.d.ts +86 -0
- package/dist/viem/WalletActions.js +220 -0
- package/dist/viem/WalletActions.js.map +1 -0
- package/dist/viem/WalletClient.d.ts +20 -0
- package/dist/viem/WalletClient.js +23 -0
- package/dist/viem/WalletClient.js.map +1 -0
- package/dist/viem/index.d.ts +13 -0
- package/dist/viem/index.js +12 -0
- package/dist/viem/index.js.map +1 -0
- package/dist/viem/internal/relayActions.d.ts +364 -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 +15 -0
- package/dist/viem/internal/utils.js +2 -0
- package/dist/viem/internal/utils.js.map +1 -0
- package/dist/wagmi/Actions.d.ts +1 -0
- package/dist/wagmi/Actions.js +2 -0
- package/dist/wagmi/Actions.js.map +1 -0
- package/dist/wagmi/Connector.d.ts +26 -0
- package/dist/wagmi/Connector.js +238 -0
- package/dist/wagmi/Connector.js.map +1 -0
- package/dist/wagmi/Hooks.d.ts +1 -0
- package/dist/wagmi/Hooks.js +2 -0
- package/dist/wagmi/Hooks.js.map +1 -0
- package/dist/wagmi/Query.d.ts +1 -0
- package/dist/wagmi/Query.js +2 -0
- package/dist/wagmi/Query.js.map +1 -0
- package/dist/wagmi/index.d.ts +4 -0
- package/dist/wagmi/index.js +5 -0
- package/dist/wagmi/index.js.map +1 -0
- package/dist/wagmi/internal/core.d.ts +83 -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 +32 -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 +90 -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 +10 -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 +1 -0
- package/dist/wagmi/internal/utils.js +18 -0
- package/dist/wagmi/internal/utils.js.map +1 -0
- package/package.json +286 -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 +212 -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 +1277 -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.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 +40 -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 +304 -0
- package/src/wagmi/Hooks.ts +14 -0
- package/src/wagmi/Query.ts +5 -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,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RPC capabilities.
|
|
3
|
+
*
|
|
4
|
+
* @see https://github.com/ithacaxyz/relay/blob/main/src/types/capabilities.rs
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as z from 'zod/mini'
|
|
8
|
+
import * as u from '../../schema/utils.js'
|
|
9
|
+
import * as Key from './key.js'
|
|
10
|
+
|
|
11
|
+
export namespace assetDiffs {
|
|
12
|
+
export const AssetDiffAsset = z.union([
|
|
13
|
+
z.object({
|
|
14
|
+
address: z.optional(z.union([u.address(), z.null()])),
|
|
15
|
+
decimals: z.optional(z.union([z.number(), z.null()])),
|
|
16
|
+
direction: z.union([z.literal('incoming'), z.literal('outgoing')]),
|
|
17
|
+
fiat: z.optional(
|
|
18
|
+
z.object({
|
|
19
|
+
currency: z.string(),
|
|
20
|
+
value: z.codec(z.string(), z.number(), {
|
|
21
|
+
decode: (value) => Number(value),
|
|
22
|
+
encode: (value) => String(value),
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
),
|
|
26
|
+
name: z.optional(z.union([z.string(), z.null()])),
|
|
27
|
+
symbol: z.string(),
|
|
28
|
+
type: z.literal('erc20'),
|
|
29
|
+
value: u.bigint(),
|
|
30
|
+
}),
|
|
31
|
+
z.object({
|
|
32
|
+
address: z.optional(z.union([u.address(), z.null()])),
|
|
33
|
+
direction: z.union([z.literal('incoming'), z.literal('outgoing')]),
|
|
34
|
+
fiat: z.optional(
|
|
35
|
+
z.object({
|
|
36
|
+
currency: z.string(),
|
|
37
|
+
value: z.codec(z.string(), z.number(), {
|
|
38
|
+
decode: (value) => Number(value),
|
|
39
|
+
encode: (value) => String(value),
|
|
40
|
+
}),
|
|
41
|
+
}),
|
|
42
|
+
),
|
|
43
|
+
name: z.optional(z.union([z.string(), z.null()])),
|
|
44
|
+
symbol: z.string(),
|
|
45
|
+
type: z.literal('erc721'),
|
|
46
|
+
uri: z.string(),
|
|
47
|
+
value: u.bigint(),
|
|
48
|
+
}),
|
|
49
|
+
z.object({
|
|
50
|
+
address: z.null(),
|
|
51
|
+
decimals: z.optional(z.union([z.number(), z.null()])),
|
|
52
|
+
direction: z.union([z.literal('incoming'), z.literal('outgoing')]),
|
|
53
|
+
fiat: z.optional(
|
|
54
|
+
z.object({
|
|
55
|
+
currency: z.string(),
|
|
56
|
+
value: z.codec(z.string(), z.number(), {
|
|
57
|
+
decode: (value) => Number(value),
|
|
58
|
+
encode: (value) => String(value),
|
|
59
|
+
}),
|
|
60
|
+
}),
|
|
61
|
+
),
|
|
62
|
+
symbol: z.string(),
|
|
63
|
+
type: z.null(),
|
|
64
|
+
value: u.bigint(),
|
|
65
|
+
}),
|
|
66
|
+
])
|
|
67
|
+
export type AssetDiffAsset = z.infer<typeof AssetDiffAsset>
|
|
68
|
+
|
|
69
|
+
export const Response = z.record(
|
|
70
|
+
u.hex(),
|
|
71
|
+
z.readonly(
|
|
72
|
+
z.array(
|
|
73
|
+
z.readonly(z.tuple([u.address(), z.readonly(z.array(AssetDiffAsset))])),
|
|
74
|
+
),
|
|
75
|
+
),
|
|
76
|
+
)
|
|
77
|
+
export type Response = z.infer<typeof Response>
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export namespace authorizeKeys {
|
|
81
|
+
/** Represents a key authorization request. */
|
|
82
|
+
export const Request = z.readonly(z.array(Key.WithPermissions))
|
|
83
|
+
export type Request = z.infer<typeof Request>
|
|
84
|
+
|
|
85
|
+
/** Represents a key authorization response. */
|
|
86
|
+
export const Response = z.readonly(
|
|
87
|
+
z.array(
|
|
88
|
+
z.object({
|
|
89
|
+
...Key.WithPermissions.shape,
|
|
90
|
+
/** The hash of the authorized key. */
|
|
91
|
+
hash: u.hex(),
|
|
92
|
+
}),
|
|
93
|
+
),
|
|
94
|
+
)
|
|
95
|
+
export type Response = z.infer<typeof Response>
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export namespace feeTotals {
|
|
99
|
+
export const Response = z.record(
|
|
100
|
+
u.hex(),
|
|
101
|
+
z.object({
|
|
102
|
+
currency: z.string(),
|
|
103
|
+
value: z.string(),
|
|
104
|
+
}),
|
|
105
|
+
)
|
|
106
|
+
export type Response = z.infer<typeof Response>
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export namespace meta {
|
|
110
|
+
/** Represents metadata for a call bundle. */
|
|
111
|
+
export const Request = z.object({
|
|
112
|
+
/** The address of the fee payer. */
|
|
113
|
+
feePayer: z.optional(u.address()),
|
|
114
|
+
/** The token to pa for the call bundle. If `None`, defaults to native token (ETH). */
|
|
115
|
+
feeToken: z.optional(u.address()),
|
|
116
|
+
/** The nonce for the bundle. */
|
|
117
|
+
nonce: z.optional(u.bigint()),
|
|
118
|
+
})
|
|
119
|
+
export type Request = z.infer<typeof Request>
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export namespace requiredFunds {
|
|
123
|
+
export const Request = z.readonly(
|
|
124
|
+
z.array(
|
|
125
|
+
z.object({
|
|
126
|
+
address: u.address(),
|
|
127
|
+
value: u.bigint(),
|
|
128
|
+
}),
|
|
129
|
+
),
|
|
130
|
+
)
|
|
131
|
+
export type Request = z.infer<typeof Request>
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export namespace revokeKeys {
|
|
135
|
+
/** Represents a key revocation request. */
|
|
136
|
+
export const Request = z.readonly(
|
|
137
|
+
z.array(
|
|
138
|
+
z.object({
|
|
139
|
+
/** The hash of the key to revoke. */
|
|
140
|
+
hash: u.hex(),
|
|
141
|
+
}),
|
|
142
|
+
),
|
|
143
|
+
)
|
|
144
|
+
export type Request = z.infer<typeof Request>
|
|
145
|
+
|
|
146
|
+
/** Represents a key revocation response. */
|
|
147
|
+
export const Response = z.readonly(
|
|
148
|
+
z.array(
|
|
149
|
+
z.object({
|
|
150
|
+
/** The hash of the revoked key. */
|
|
151
|
+
hash: u.hex(),
|
|
152
|
+
}),
|
|
153
|
+
),
|
|
154
|
+
)
|
|
155
|
+
export type Response = z.infer<typeof Response>
|
|
156
|
+
}
|
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest'
|
|
2
|
+
import * as z from 'zod/mini'
|
|
3
|
+
import * as u from '../../schema/utils.js'
|
|
4
|
+
import * as Intent from './intent.js'
|
|
5
|
+
|
|
6
|
+
describe('Intent', () => {
|
|
7
|
+
const validIntentData = {
|
|
8
|
+
combinedGas: '0x5208',
|
|
9
|
+
encodedFundTransfers: [],
|
|
10
|
+
encodedPreCalls: ['0xdeadbeef', '0xcafebabe'],
|
|
11
|
+
eoa: '0x1234567890123456789012345678901234567890',
|
|
12
|
+
executionData: '0xabcdef',
|
|
13
|
+
expiry: '0x1234567890',
|
|
14
|
+
funder: '0x1234567890123456789012345678901234567890',
|
|
15
|
+
funderSignature: '0xfundersig123',
|
|
16
|
+
isMultichain: false,
|
|
17
|
+
nonce: '0x1',
|
|
18
|
+
payer: '0x1234567890123456789012345678901234567890',
|
|
19
|
+
paymentAmount: '0x64',
|
|
20
|
+
paymentMaxAmount: '0xc8',
|
|
21
|
+
paymentRecipient: '0x9876543210987654321098765432109876543210',
|
|
22
|
+
paymentSignature: '0x123456',
|
|
23
|
+
paymentToken: '0xa0b86991c31cc0c7b6f931c7d751c635d989dc1bb',
|
|
24
|
+
settler: '0x9876543210987654321098765432109876543210',
|
|
25
|
+
settlerContext: '0xsettlercontext123',
|
|
26
|
+
signature: '0xsignature123',
|
|
27
|
+
supportedAccountImplementation:
|
|
28
|
+
'0x0000000000000000000000000000000000000000',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
test('behavior: decodes valid intent with all fields', () => {
|
|
32
|
+
const result = z.decode(Intent.Intent, validIntentData as never)
|
|
33
|
+
expect(result).toMatchInlineSnapshot(`
|
|
34
|
+
{
|
|
35
|
+
"combinedGas": 21000n,
|
|
36
|
+
"encodedFundTransfers": [],
|
|
37
|
+
"encodedPreCalls": [
|
|
38
|
+
"0xdeadbeef",
|
|
39
|
+
"0xcafebabe",
|
|
40
|
+
],
|
|
41
|
+
"eoa": "0x1234567890123456789012345678901234567890",
|
|
42
|
+
"executionData": "0xabcdef",
|
|
43
|
+
"expiry": 78187493520n,
|
|
44
|
+
"funder": "0x1234567890123456789012345678901234567890",
|
|
45
|
+
"funderSignature": "0xfundersig123",
|
|
46
|
+
"isMultichain": false,
|
|
47
|
+
"nonce": 1n,
|
|
48
|
+
"payer": "0x1234567890123456789012345678901234567890",
|
|
49
|
+
"paymentAmount": 100n,
|
|
50
|
+
"paymentMaxAmount": 200n,
|
|
51
|
+
"paymentRecipient": "0x9876543210987654321098765432109876543210",
|
|
52
|
+
"paymentSignature": "0x123456",
|
|
53
|
+
"paymentToken": "0xa0b86991c31cc0c7b6f931c7d751c635d989dc1bb",
|
|
54
|
+
"settler": "0x9876543210987654321098765432109876543210",
|
|
55
|
+
"settlerContext": "0xsettlercontext123",
|
|
56
|
+
"signature": "0xsignature123",
|
|
57
|
+
"supportedAccountImplementation": "0x0000000000000000000000000000000000000000",
|
|
58
|
+
}
|
|
59
|
+
`)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
test('behavior: encodes valid intent data', () => {
|
|
63
|
+
const decodedData = z.decode(Intent.Intent, validIntentData as never)
|
|
64
|
+
const encodedData = z.encode(Intent.Intent, decodedData)
|
|
65
|
+
expect(encodedData).toMatchInlineSnapshot(`
|
|
66
|
+
{
|
|
67
|
+
"combinedGas": "0x5208",
|
|
68
|
+
"encodedFundTransfers": [],
|
|
69
|
+
"encodedPreCalls": [
|
|
70
|
+
"0xdeadbeef",
|
|
71
|
+
"0xcafebabe",
|
|
72
|
+
],
|
|
73
|
+
"eoa": "0x1234567890123456789012345678901234567890",
|
|
74
|
+
"executionData": "0xabcdef",
|
|
75
|
+
"expiry": "0x1234567890",
|
|
76
|
+
"funder": "0x1234567890123456789012345678901234567890",
|
|
77
|
+
"funderSignature": "0xfundersig123",
|
|
78
|
+
"isMultichain": false,
|
|
79
|
+
"nonce": "0x1",
|
|
80
|
+
"payer": "0x1234567890123456789012345678901234567890",
|
|
81
|
+
"paymentAmount": "0x64",
|
|
82
|
+
"paymentMaxAmount": "0xc8",
|
|
83
|
+
"paymentRecipient": "0x9876543210987654321098765432109876543210",
|
|
84
|
+
"paymentSignature": "0x123456",
|
|
85
|
+
"paymentToken": "0xa0b86991c31cc0c7b6f931c7d751c635d989dc1bb",
|
|
86
|
+
"settler": "0x9876543210987654321098765432109876543210",
|
|
87
|
+
"settlerContext": "0xsettlercontext123",
|
|
88
|
+
"signature": "0xsignature123",
|
|
89
|
+
"supportedAccountImplementation": "0x0000000000000000000000000000000000000000",
|
|
90
|
+
}
|
|
91
|
+
`)
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
test('behavior: round-trip encoding/decoding preserves data', () => {
|
|
95
|
+
const originalDecoded = z.decode(Intent.Intent, validIntentData as never)
|
|
96
|
+
const encoded = z.encode(Intent.Intent, originalDecoded)
|
|
97
|
+
const reDecoded = z.decode(Intent.Intent, encoded)
|
|
98
|
+
|
|
99
|
+
expect(reDecoded).toEqual(originalDecoded)
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
test('behavior: decodes intent with empty encodedPreCalls array', () => {
|
|
103
|
+
const dataWithEmptyPreCalls = {
|
|
104
|
+
...validIntentData,
|
|
105
|
+
encodedPreCalls: [],
|
|
106
|
+
}
|
|
107
|
+
const result = z.decode(Intent.Intent, dataWithEmptyPreCalls as never)
|
|
108
|
+
expect(result.encodedPreCalls).toEqual([])
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
test('behavior: decodes intent with large BigInt values', () => {
|
|
112
|
+
const dataWithLargeBigInts = {
|
|
113
|
+
...validIntentData,
|
|
114
|
+
combinedGas: '0xffffffffffffffffffffffffffffffffff',
|
|
115
|
+
nonce: '0xffffffffffffffffffffffffffffffffffff',
|
|
116
|
+
paymentAmount: '0xffffffffffffffffffffffffffffffff',
|
|
117
|
+
paymentMaxAmount: '0xffffffffffffffffffffffffffffffffff',
|
|
118
|
+
}
|
|
119
|
+
const result = z.decode(Intent.Intent, dataWithLargeBigInts as never)
|
|
120
|
+
expect(result.combinedGas).toBe(
|
|
121
|
+
BigInt('0xffffffffffffffffffffffffffffffffff'),
|
|
122
|
+
)
|
|
123
|
+
expect(result.nonce).toBe(BigInt('0xffffffffffffffffffffffffffffffffffff'))
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
test('behavior: encodes large BigInt values back to hex', () => {
|
|
127
|
+
const dataWithLargeBigInts = {
|
|
128
|
+
...validIntentData,
|
|
129
|
+
combinedGas: '0xff',
|
|
130
|
+
nonce: '0xffff',
|
|
131
|
+
}
|
|
132
|
+
const decoded = z.decode(Intent.Intent, dataWithLargeBigInts as never)
|
|
133
|
+
const encoded = z.encode(Intent.Intent, decoded)
|
|
134
|
+
expect(encoded.combinedGas).toBe('0xff')
|
|
135
|
+
expect(encoded.nonce).toBe('0xffff')
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
test('error: rejects invalid address format', () => {
|
|
139
|
+
expect(
|
|
140
|
+
u.toValidationError(
|
|
141
|
+
z.safeDecode(Intent.Intent, {
|
|
142
|
+
...validIntentData,
|
|
143
|
+
eoa: 'invalid-address',
|
|
144
|
+
} as never).error,
|
|
145
|
+
),
|
|
146
|
+
).toMatchInlineSnapshot(
|
|
147
|
+
`
|
|
148
|
+
[Schema.ValidationError: Validation failed with 1 error:
|
|
149
|
+
|
|
150
|
+
- Invalid union value.
|
|
151
|
+
- at \`eoa\`: Must match pattern: ^0x[\\s\\S]{0,}$
|
|
152
|
+
- at \`eoa\`: Must match pattern: ^0x[\\s\\S]{0,}$
|
|
153
|
+
- at \`prePaymentAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
154
|
+
- at \`prePaymentMaxAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
155
|
+
- at \`totalPaymentAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
156
|
+
- at \`totalPaymentMaxAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.]
|
|
157
|
+
`,
|
|
158
|
+
)
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
test('error: rejects invalid hex format for BigInt fields', () => {
|
|
162
|
+
expect(
|
|
163
|
+
u.toValidationError(
|
|
164
|
+
z.safeDecode(Intent.Intent, {
|
|
165
|
+
...validIntentData,
|
|
166
|
+
combinedGas: 'not-hex',
|
|
167
|
+
} as never).error,
|
|
168
|
+
),
|
|
169
|
+
).toMatchInlineSnapshot(
|
|
170
|
+
`
|
|
171
|
+
[Schema.ValidationError: Validation failed with 1 error:
|
|
172
|
+
|
|
173
|
+
- Invalid union value.
|
|
174
|
+
- at \`combinedGas\`: Must match pattern: ^0x[\\s\\S]{0,}$
|
|
175
|
+
- at \`combinedGas\`: Must match pattern: ^0x[\\s\\S]{0,}$
|
|
176
|
+
- at \`prePaymentAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
177
|
+
- at \`prePaymentMaxAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
178
|
+
- at \`totalPaymentAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
179
|
+
- at \`totalPaymentMaxAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.]
|
|
180
|
+
`,
|
|
181
|
+
)
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
test('error: rejects missing required fields', () => {
|
|
185
|
+
expect(
|
|
186
|
+
u.toValidationError(
|
|
187
|
+
z.safeDecode(Intent.Intent, {
|
|
188
|
+
eoa: '0x1234567890123456789012345678901234567890',
|
|
189
|
+
// Missing other required fields
|
|
190
|
+
} as never).error,
|
|
191
|
+
),
|
|
192
|
+
).toMatchInlineSnapshot(
|
|
193
|
+
`
|
|
194
|
+
[Schema.ValidationError: Validation failed with 1 error:
|
|
195
|
+
|
|
196
|
+
- Invalid union value.
|
|
197
|
+
- at \`combinedGas\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
198
|
+
- at \`encodedFundTransfers\`: Expected array.
|
|
199
|
+
- at \`encodedPreCalls\`: Expected array.
|
|
200
|
+
- at \`executionData\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
201
|
+
- at \`expiry\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
202
|
+
- at \`funder\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]{40}$.
|
|
203
|
+
- at \`funderSignature\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
204
|
+
- at \`isMultichain\`: Expected boolean.
|
|
205
|
+
- at \`nonce\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
206
|
+
- at \`payer\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]{40}$.
|
|
207
|
+
- at \`paymentAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
208
|
+
- at \`paymentMaxAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
209
|
+
- at \`paymentRecipient\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]{40}$.
|
|
210
|
+
- at \`paymentSignature\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
211
|
+
- at \`paymentToken\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]{40}$.
|
|
212
|
+
- at \`settler\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]{40}$.
|
|
213
|
+
- at \`settlerContext\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
214
|
+
- at \`signature\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
215
|
+
- at \`supportedAccountImplementation\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]{40}$.
|
|
216
|
+
- at \`combinedGas\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
217
|
+
- at \`encodedFundTransfers\`: Expected array.
|
|
218
|
+
- at \`encodedPreCalls\`: Expected array.
|
|
219
|
+
- at \`executionData\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
220
|
+
- at \`expiry\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
221
|
+
- at \`funder\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]{40}$.
|
|
222
|
+
- at \`funderSignature\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
223
|
+
- at \`isMultichain\`: Expected boolean.
|
|
224
|
+
- at \`nonce\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
225
|
+
- at \`payer\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]{40}$.
|
|
226
|
+
- at \`paymentRecipient\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]{40}$.
|
|
227
|
+
- at \`paymentSignature\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
228
|
+
- at \`paymentToken\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]{40}$.
|
|
229
|
+
- at \`prePaymentAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
230
|
+
- at \`prePaymentMaxAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
231
|
+
- at \`settler\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]{40}$.
|
|
232
|
+
- at \`settlerContext\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
233
|
+
- at \`signature\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
234
|
+
- at \`supportedAccountImplementation\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]{40}$.
|
|
235
|
+
- at \`totalPaymentAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
236
|
+
- at \`totalPaymentMaxAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.]
|
|
237
|
+
`,
|
|
238
|
+
)
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
test('error: rejects invalid encodedPreCalls array items', async () => {
|
|
242
|
+
const { error } = z.safeParse(Intent.Intent, {
|
|
243
|
+
...validIntentData,
|
|
244
|
+
encodedPreCalls: ['0xvalid', 'invalid-hex'],
|
|
245
|
+
} as never)
|
|
246
|
+
expect(u.toValidationError(error as never)).toMatchInlineSnapshot(
|
|
247
|
+
`
|
|
248
|
+
[Schema.ValidationError: Validation failed with 1 error:
|
|
249
|
+
|
|
250
|
+
- Invalid union value.
|
|
251
|
+
- at \`encodedPreCalls[1]\`: Must match pattern: ^0x[\\s\\S]{0,}$
|
|
252
|
+
- at \`encodedPreCalls[1]\`: Must match pattern: ^0x[\\s\\S]{0,}$
|
|
253
|
+
- at \`prePaymentAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
254
|
+
- at \`prePaymentMaxAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
255
|
+
- at \`totalPaymentAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
256
|
+
- at \`totalPaymentMaxAmount\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.]
|
|
257
|
+
`,
|
|
258
|
+
)
|
|
259
|
+
})
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
describe('Partial', () => {
|
|
263
|
+
const validPartialData = {
|
|
264
|
+
eoa: '0x1234567890123456789012345678901234567890',
|
|
265
|
+
executionData: '0xabcdef',
|
|
266
|
+
nonce: '0x1',
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
test('behavior: decodes valid partial intent', () => {
|
|
270
|
+
const result = z.decode(Intent.Partial, validPartialData as never)
|
|
271
|
+
expect(result).toMatchInlineSnapshot(`
|
|
272
|
+
{
|
|
273
|
+
"eoa": "0x1234567890123456789012345678901234567890",
|
|
274
|
+
"executionData": "0xabcdef",
|
|
275
|
+
"nonce": 1n,
|
|
276
|
+
}
|
|
277
|
+
`)
|
|
278
|
+
})
|
|
279
|
+
|
|
280
|
+
test('behavior: encodes valid partial intent data', () => {
|
|
281
|
+
const decodedData = z.decode(Intent.Partial, validPartialData as never)
|
|
282
|
+
const encodedData = z.encode(Intent.Partial, decodedData)
|
|
283
|
+
expect(encodedData).toMatchInlineSnapshot(`
|
|
284
|
+
{
|
|
285
|
+
"eoa": "0x1234567890123456789012345678901234567890",
|
|
286
|
+
"executionData": "0xabcdef",
|
|
287
|
+
"nonce": "0x1",
|
|
288
|
+
}
|
|
289
|
+
`)
|
|
290
|
+
})
|
|
291
|
+
|
|
292
|
+
test('behavior: round-trip encoding/decoding preserves partial data', () => {
|
|
293
|
+
const originalDecoded = z.decode(Intent.Partial, validPartialData as never)
|
|
294
|
+
const encoded = z.encode(Intent.Partial, originalDecoded)
|
|
295
|
+
const reDecoded = z.decode(Intent.Partial, encoded)
|
|
296
|
+
|
|
297
|
+
expect(reDecoded).toEqual(originalDecoded)
|
|
298
|
+
})
|
|
299
|
+
|
|
300
|
+
test('behavior: decodes with different nonce values', () => {
|
|
301
|
+
const testCases = [
|
|
302
|
+
{ expected: 0n, nonce: '0x0' },
|
|
303
|
+
{ expected: 1n, nonce: '0x1' },
|
|
304
|
+
{ expected: 255n, nonce: '0xff' },
|
|
305
|
+
{ expected: 4096n, nonce: '0x1000' },
|
|
306
|
+
]
|
|
307
|
+
|
|
308
|
+
for (const { nonce, expected } of testCases) {
|
|
309
|
+
const result = z.decode(Intent.Partial, {
|
|
310
|
+
...validPartialData,
|
|
311
|
+
nonce,
|
|
312
|
+
} as never)
|
|
313
|
+
expect(result.nonce).toBe(expected)
|
|
314
|
+
}
|
|
315
|
+
})
|
|
316
|
+
|
|
317
|
+
test('behavior: encodes different nonce values back to hex', () => {
|
|
318
|
+
const testCases = [
|
|
319
|
+
{ nonce: '0x0' },
|
|
320
|
+
{ nonce: '0x1' },
|
|
321
|
+
{ nonce: '0xff' },
|
|
322
|
+
{ nonce: '0x1000' },
|
|
323
|
+
]
|
|
324
|
+
|
|
325
|
+
for (const { nonce } of testCases) {
|
|
326
|
+
const decoded = z.decode(Intent.Partial, {
|
|
327
|
+
...validPartialData,
|
|
328
|
+
nonce,
|
|
329
|
+
} as never)
|
|
330
|
+
const encoded = z.encode(Intent.Partial, decoded)
|
|
331
|
+
expect(encoded.nonce).toBe(nonce)
|
|
332
|
+
}
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
test('error: rejects invalid address in partial', () => {
|
|
336
|
+
expect(
|
|
337
|
+
u.toValidationError(
|
|
338
|
+
z.safeDecode(Intent.Partial, {
|
|
339
|
+
...validPartialData,
|
|
340
|
+
eoa: 'invalid-address',
|
|
341
|
+
} as never).error,
|
|
342
|
+
),
|
|
343
|
+
).toMatchInlineSnapshot(
|
|
344
|
+
`
|
|
345
|
+
[Schema.ValidationError: Validation failed with 1 error:
|
|
346
|
+
|
|
347
|
+
- at \`eoa\`: Must match pattern: ^0x[\\s\\S]{0,}$]
|
|
348
|
+
`,
|
|
349
|
+
)
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
test('error: rejects invalid hex for executionData', () => {
|
|
353
|
+
expect(
|
|
354
|
+
u.toValidationError(
|
|
355
|
+
z.safeDecode(Intent.Partial, {
|
|
356
|
+
...validPartialData,
|
|
357
|
+
executionData: 'not-hex',
|
|
358
|
+
} as never).error,
|
|
359
|
+
),
|
|
360
|
+
).toMatchInlineSnapshot(
|
|
361
|
+
`
|
|
362
|
+
[Schema.ValidationError: Validation failed with 1 error:
|
|
363
|
+
|
|
364
|
+
- at \`executionData\`: Must match pattern: ^0x[\\s\\S]{0,}$]
|
|
365
|
+
`,
|
|
366
|
+
)
|
|
367
|
+
})
|
|
368
|
+
|
|
369
|
+
test('error: rejects invalid hex for nonce', () => {
|
|
370
|
+
expect(
|
|
371
|
+
u.toValidationError(
|
|
372
|
+
z.safeDecode(Intent.Partial, {
|
|
373
|
+
...validPartialData,
|
|
374
|
+
nonce: 'not-hex',
|
|
375
|
+
} as never).error,
|
|
376
|
+
),
|
|
377
|
+
).toMatchInlineSnapshot(
|
|
378
|
+
`
|
|
379
|
+
[Schema.ValidationError: Validation failed with 1 error:
|
|
380
|
+
|
|
381
|
+
- at \`nonce\`: Must match pattern: ^0x[\\s\\S]{0,}$]
|
|
382
|
+
`,
|
|
383
|
+
)
|
|
384
|
+
})
|
|
385
|
+
|
|
386
|
+
test('error: rejects missing required fields in partial', () => {
|
|
387
|
+
expect(
|
|
388
|
+
u.toValidationError(
|
|
389
|
+
z.safeDecode(Intent.Partial, {
|
|
390
|
+
eoa: '0x1234567890123456789012345678901234567890',
|
|
391
|
+
// Missing executionData and nonce
|
|
392
|
+
} as never).error,
|
|
393
|
+
),
|
|
394
|
+
).toMatchInlineSnapshot(
|
|
395
|
+
`
|
|
396
|
+
[Schema.ValidationError: Validation failed with 2 errors:
|
|
397
|
+
|
|
398
|
+
- at \`executionData\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.
|
|
399
|
+
- at \`nonce\`: Expected template_literal. Needs string in format ^0x[A-Fa-f0-9]+$.]
|
|
400
|
+
`,
|
|
401
|
+
)
|
|
402
|
+
})
|
|
403
|
+
|
|
404
|
+
test('misc: partial intent contains subset of full intent fields', () => {
|
|
405
|
+
const partialDecoded = z.decode(Intent.Partial, validPartialData as never)
|
|
406
|
+
const fullDecoded = z.decode(Intent.Intent, {
|
|
407
|
+
combinedGas: '0x5208',
|
|
408
|
+
encodedFundTransfers: [],
|
|
409
|
+
encodedPreCalls: [],
|
|
410
|
+
...validPartialData,
|
|
411
|
+
expiry: '0x1234567890',
|
|
412
|
+
funder: '0x1234567890123456789012345678901234567890',
|
|
413
|
+
funderSignature: '0xfundersig123',
|
|
414
|
+
isMultichain: false,
|
|
415
|
+
payer: '0x1234567890123456789012345678901234567890',
|
|
416
|
+
paymentAmount: '0x64',
|
|
417
|
+
paymentMaxAmount: '0xc8',
|
|
418
|
+
paymentRecipient: '0x9876543210987654321098765432109876543210',
|
|
419
|
+
paymentSignature: '0x123456',
|
|
420
|
+
paymentToken: '0xa0b86991c31cc0c7b6f931c7d751c635d989dc1bb',
|
|
421
|
+
settler: '0x9876543210987654321098765432109876543210',
|
|
422
|
+
settlerContext: '0xsettlercontext123',
|
|
423
|
+
signature: '0xsignature123',
|
|
424
|
+
supportedAccountImplementation:
|
|
425
|
+
'0x0000000000000000000000000000000000000000',
|
|
426
|
+
} as never)
|
|
427
|
+
|
|
428
|
+
// Verify that partial fields match the full intent
|
|
429
|
+
expect(partialDecoded.eoa).toBe(fullDecoded.eoa)
|
|
430
|
+
expect(partialDecoded.executionData).toBe(fullDecoded.executionData)
|
|
431
|
+
expect(partialDecoded.nonce).toBe(fullDecoded.nonce)
|
|
432
|
+
})
|
|
433
|
+
})
|