tapimo 0.1.0 → 0.2.0
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 +28 -15
- package/dist/ApiKey.d.ts +3 -1
- package/dist/ApiKey.d.ts.map +1 -1
- package/dist/ApiKey.js +1 -0
- package/dist/ApiKey.js.map +1 -1
- package/dist/ApiKeys.d.ts +71 -3
- package/dist/ApiKeys.d.ts.map +1 -1
- package/dist/ApiKeys.js +117 -1
- package/dist/ApiKeys.js.map +1 -1
- package/dist/App.d.ts +7139 -4197
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +133 -329
- package/dist/App.js.map +1 -1
- package/dist/Scope.d.ts +11 -4
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +12 -4
- package/dist/Scope.js.map +1 -1
- package/dist/Webhooks.d.ts +2 -2
- package/dist/Webhooks.d.ts.map +1 -1
- package/dist/Webhooks.js +2 -2
- package/dist/Webhooks.js.map +1 -1
- package/dist/admin/App.d.ts +126 -53
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +104 -6
- package/dist/admin/apps/api-keys.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.js +67 -0
- package/dist/admin/apps/api-keys.js.map +1 -1
- package/dist/admin/apps/scopes.d.ts +4 -1
- package/dist/admin/apps/scopes.d.ts.map +1 -1
- package/dist/admin/apps/verified-tokens.d.ts +115 -115
- package/dist/admin/apps/verified-tokens.js +1 -1
- package/dist/admin/apps/verified-tokens.js.map +1 -1
- package/dist/admin/ui.generated.d.ts +1 -1
- package/dist/admin/ui.generated.js +1 -1
- package/dist/apps/data/App.d.ts +19176 -0
- package/dist/apps/data/App.d.ts.map +1 -0
- package/dist/apps/data/App.js +236 -0
- package/dist/apps/data/App.js.map +1 -0
- package/dist/apps/data/index.d.ts +3 -0
- package/dist/apps/data/index.d.ts.map +1 -0
- package/dist/apps/data/index.js +3 -0
- package/dist/apps/data/index.js.map +1 -0
- package/dist/apps/{activities.d.ts → data/routes/activities.d.ts} +32 -32
- package/dist/apps/{activities.d.ts.map → data/routes/activities.d.ts.map} +1 -1
- package/dist/apps/{activities.js → data/routes/activities.js} +13 -13
- package/dist/apps/data/routes/activities.js.map +1 -0
- package/dist/apps/{addresses.d.ts → data/routes/addresses.d.ts} +22 -22
- package/dist/apps/{addresses.d.ts.map → data/routes/addresses.d.ts.map} +1 -1
- package/dist/apps/{addresses.js → data/routes/addresses.js} +5 -5
- package/dist/apps/data/routes/addresses.js.map +1 -0
- package/dist/apps/{balances.d.ts → data/routes/balances.d.ts} +49 -49
- package/dist/apps/data/routes/balances.d.ts.map +1 -0
- package/dist/apps/{balances.js → data/routes/balances.js} +42 -11
- package/dist/apps/data/routes/balances.js.map +1 -0
- package/dist/apps/{blocks.d.ts → data/routes/blocks.d.ts} +47 -47
- package/dist/apps/data/routes/blocks.d.ts.map +1 -0
- package/dist/apps/{blocks.js → data/routes/blocks.js} +13 -13
- package/dist/apps/data/routes/blocks.js.map +1 -0
- package/dist/apps/{coingecko.d.ts → data/routes/coingecko.d.ts} +183 -183
- package/dist/apps/data/routes/coingecko.d.ts.map +1 -0
- package/dist/apps/{coingecko.js → data/routes/coingecko.js} +13 -13
- package/dist/apps/data/routes/coingecko.js.map +1 -0
- package/dist/apps/{exchanges.d.ts → data/routes/exchanges.d.ts} +460 -460
- package/dist/apps/data/routes/exchanges.d.ts.map +1 -0
- package/dist/apps/{exchanges.js → data/routes/exchanges.js} +19 -19
- package/dist/apps/data/routes/exchanges.js.map +1 -0
- package/dist/apps/{fee-amm.d.ts → data/routes/fee-amm.d.ts} +94 -94
- package/dist/apps/data/routes/fee-amm.d.ts.map +1 -0
- package/dist/apps/{fee-amm.js → data/routes/fee-amm.js} +17 -17
- package/dist/apps/data/routes/fee-amm.js.map +1 -0
- package/dist/apps/{indexer.d.ts → data/routes/indexer.d.ts} +4 -4
- package/dist/apps/data/routes/indexer.d.ts.map +1 -0
- package/dist/apps/{indexer.js → data/routes/indexer.js} +13 -9
- package/dist/apps/data/routes/indexer.js.map +1 -0
- package/dist/apps/{receipts.d.ts → data/routes/receipts.d.ts} +49 -49
- package/dist/apps/data/routes/receipts.d.ts.map +1 -0
- package/dist/apps/{receipts.js → data/routes/receipts.js} +12 -12
- package/dist/apps/data/routes/receipts.js.map +1 -0
- package/dist/apps/{rpc.d.ts → data/routes/rpc.d.ts} +4 -4
- package/dist/apps/data/routes/rpc.d.ts.map +1 -0
- package/dist/apps/{rpc.js → data/routes/rpc.js} +6 -6
- package/dist/apps/data/routes/rpc.js.map +1 -0
- package/dist/apps/{tokenlist.d.ts → data/routes/tokenlist.d.ts} +4 -4
- package/dist/apps/data/routes/tokenlist.d.ts.map +1 -0
- package/dist/apps/{tokenlist.js → data/routes/tokenlist.js} +8 -8
- package/dist/apps/data/routes/tokenlist.js.map +1 -0
- package/dist/apps/{tokens.d.ts → data/routes/tokens.d.ts} +468 -468
- package/dist/apps/data/routes/tokens.d.ts.map +1 -0
- package/dist/apps/{tokens.js → data/routes/tokens.js} +19 -19
- package/dist/apps/data/routes/tokens.js.map +1 -0
- package/dist/apps/{transactions.d.ts → data/routes/transactions.d.ts} +304 -304
- package/dist/apps/data/routes/transactions.d.ts.map +1 -0
- package/dist/apps/{transactions.js → data/routes/transactions.js} +13 -13
- package/dist/apps/data/routes/transactions.js.map +1 -0
- package/dist/apps/{transfers.d.ts → data/routes/transfers.d.ts} +6 -6
- package/dist/apps/data/routes/transfers.d.ts.map +1 -0
- package/dist/apps/{transfers.js → data/routes/transfers.js} +13 -13
- package/dist/apps/data/routes/transfers.js.map +1 -0
- package/dist/apps/{verified-tokens.d.ts → data/routes/verified-tokens.d.ts} +42 -42
- package/dist/apps/data/routes/verified-tokens.d.ts.map +1 -0
- package/dist/apps/{verified-tokens.js → data/routes/verified-tokens.js} +9 -9
- package/dist/apps/data/routes/verified-tokens.js.map +1 -0
- package/dist/apps/{webhooks.d.ts → data/routes/webhooks.d.ts} +62 -62
- package/dist/apps/{webhooks.d.ts.map → data/routes/webhooks.d.ts.map} +1 -1
- package/dist/apps/{webhooks.js → data/routes/webhooks.js} +30 -26
- package/dist/apps/data/routes/webhooks.js.map +1 -0
- package/dist/apps/docs/App.d.ts +27 -0
- package/dist/apps/docs/App.d.ts.map +1 -0
- package/dist/apps/docs/App.js +122 -0
- package/dist/apps/docs/App.js.map +1 -0
- package/dist/{internal/OpenApi.fonts.d.ts → apps/docs/fonts.d.ts} +1 -1
- package/dist/apps/docs/fonts.d.ts.map +1 -0
- package/dist/{internal/OpenApi.fonts.js → apps/docs/fonts.js} +1 -1
- package/dist/apps/docs/fonts.js.map +1 -0
- package/dist/apps/docs/index.d.ts +2 -0
- package/dist/apps/docs/index.d.ts.map +1 -0
- package/dist/apps/docs/index.js +2 -0
- package/dist/apps/docs/index.js.map +1 -0
- package/dist/{internal/OpenApi.logo.d.ts → apps/docs/logo.d.ts} +1 -1
- package/dist/apps/docs/logo.d.ts.map +1 -0
- package/dist/{internal/OpenApi.logo.js → apps/docs/logo.js} +1 -1
- package/dist/apps/docs/logo.js.map +1 -0
- package/dist/apps/index.d.ts +4 -0
- package/dist/apps/index.d.ts.map +1 -0
- package/dist/apps/index.js +4 -0
- package/dist/apps/index.js.map +1 -0
- package/dist/apps/metadata.d.ts +7 -0
- package/dist/apps/metadata.d.ts.map +1 -0
- package/dist/apps/metadata.js +15 -0
- package/dist/apps/metadata.js.map +1 -0
- package/dist/apps/platform/App.d.ts +2985 -0
- package/dist/apps/platform/App.d.ts.map +1 -0
- package/dist/apps/platform/App.js +74 -0
- package/dist/apps/platform/App.js.map +1 -0
- package/dist/apps/platform/index.d.ts +2 -0
- package/dist/apps/platform/index.d.ts.map +1 -0
- package/dist/apps/platform/index.js +2 -0
- package/dist/apps/platform/index.js.map +1 -0
- package/dist/apps/platform/routes/api-keys.d.ts +681 -0
- package/dist/apps/platform/routes/api-keys.d.ts.map +1 -0
- package/dist/apps/platform/routes/api-keys.js +328 -0
- package/dist/apps/platform/routes/api-keys.js.map +1 -0
- package/dist/apps/platform/routes/invitations.d.ts +733 -0
- package/dist/apps/platform/routes/invitations.d.ts.map +1 -0
- package/dist/apps/platform/routes/invitations.js +413 -0
- package/dist/apps/platform/routes/invitations.js.map +1 -0
- package/dist/apps/platform/routes/me.d.ts +95 -0
- package/dist/apps/platform/routes/me.d.ts.map +1 -0
- package/dist/apps/platform/routes/me.js +81 -0
- package/dist/apps/platform/routes/me.js.map +1 -0
- package/dist/apps/platform/routes/members.d.ts +554 -0
- package/dist/apps/platform/routes/members.d.ts.map +1 -0
- package/dist/apps/platform/routes/members.js +251 -0
- package/dist/apps/platform/routes/members.js.map +1 -0
- package/dist/apps/platform/routes/orgs.d.ts +582 -0
- package/dist/apps/platform/routes/orgs.d.ts.map +1 -0
- package/dist/apps/platform/routes/orgs.js +265 -0
- package/dist/apps/platform/routes/orgs.js.map +1 -0
- package/dist/apps/platform/routes/projects.d.ts +740 -0
- package/dist/apps/platform/routes/projects.d.ts.map +1 -0
- package/dist/apps/platform/routes/projects.js +286 -0
- package/dist/apps/platform/routes/projects.js.map +1 -0
- package/dist/apps/relay/App.d.ts +41 -0
- package/dist/apps/relay/App.d.ts.map +1 -0
- package/dist/apps/relay/App.js +103 -0
- package/dist/apps/relay/App.js.map +1 -0
- package/dist/apps/relay/Sponsorships.d.ts +107 -0
- package/dist/apps/relay/Sponsorships.d.ts.map +1 -0
- package/dist/apps/relay/Sponsorships.js +193 -0
- package/dist/apps/relay/Sponsorships.js.map +1 -0
- package/dist/apps/relay/index.d.ts +3 -0
- package/dist/apps/relay/index.d.ts.map +1 -0
- package/dist/apps/relay/index.js +3 -0
- package/dist/apps/relay/index.js.map +1 -0
- package/dist/cli/Cli.d.ts +1 -1
- package/dist/cli/Cli.js +1 -1
- package/dist/cli/commands/admin.d.ts +1 -1
- package/dist/cli/commands/admin.js +2 -2
- package/dist/cli/commands/admin.js.map +1 -1
- package/dist/db/Db.d.ts +10 -0
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +128 -0
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +80 -0
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +99 -0
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/invitations.d.ts +84 -0
- package/dist/db/tables/invitations.d.ts.map +1 -0
- package/dist/db/tables/invitations.js +165 -0
- package/dist/db/tables/invitations.js.map +1 -0
- package/dist/db/tables/memberships.d.ts +108 -0
- package/dist/db/tables/memberships.d.ts.map +1 -0
- package/dist/db/tables/memberships.js +153 -0
- package/dist/db/tables/memberships.js.map +1 -0
- package/dist/db/tables/organizations.d.ts +44 -0
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +89 -0
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/projects.d.ts +65 -0
- package/dist/db/tables/projects.d.ts.map +1 -0
- package/dist/db/tables/projects.js +75 -0
- package/dist/db/tables/projects.js.map +1 -0
- package/dist/db/tables/sponsoredTransactions.d.ts +120 -0
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -0
- package/dist/db/tables/sponsoredTransactions.js +161 -0
- package/dist/db/tables/sponsoredTransactions.js.map +1 -0
- package/dist/db/tables/users.d.ts +48 -0
- package/dist/db/tables/users.d.ts.map +1 -0
- package/dist/db/tables/users.js +65 -0
- package/dist/db/tables/users.js.map +1 -0
- package/dist/handlers/internal/executionError.d.ts.map +1 -1
- package/dist/handlers/internal/executionError.js +2 -0
- package/dist/handlers/internal/executionError.js.map +1 -1
- package/dist/handlers/internal/multisig.d.ts +2 -6
- package/dist/handlers/internal/multisig.d.ts.map +1 -1
- package/dist/handlers/internal/multisig.js +11 -36
- package/dist/handlers/internal/multisig.js.map +1 -1
- package/dist/handlers/internal/sponsorship.d.ts +32 -2
- package/dist/handlers/internal/sponsorship.d.ts.map +1 -1
- package/dist/handlers/internal/sponsorship.js +34 -9
- package/dist/handlers/internal/sponsorship.js.map +1 -1
- package/dist/handlers/relay.d.ts +6 -2
- package/dist/handlers/relay.d.ts.map +1 -1
- package/dist/handlers/relay.js +16 -2
- package/dist/handlers/relay.js.map +1 -1
- package/dist/internal/Auth.d.ts +208 -6
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +500 -21
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/Log.d.ts +7 -3
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +4 -0
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/OpenApi.d.ts +0 -19
- package/dist/internal/OpenApi.d.ts.map +1 -1
- package/dist/internal/OpenApi.js +0 -57
- package/dist/internal/OpenApi.js.map +1 -1
- package/dist/internal/Store.d.ts +7 -1
- package/dist/internal/Store.d.ts.map +1 -1
- package/dist/internal/Store.js +16 -2
- package/dist/internal/Store.js.map +1 -1
- package/dist/internal/Viem.d.ts +84 -0
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Webhooks.d.ts +1 -1
- package/dist/internal/Webhooks.d.ts.map +1 -1
- package/package.json +31 -5
- package/src/ApiKey.ts +1 -0
- package/src/ApiKeys.test.ts +104 -1
- package/src/ApiKeys.ts +154 -1
- package/src/App.test.ts +11187 -179
- package/src/App.ts +200 -420
- package/src/Client.test-d.ts +306 -15
- package/src/Scope.ts +13 -4
- package/src/Webhooks.ts +2 -2
- package/src/admin/apps/api-keys.test.ts +51 -0
- package/src/admin/apps/api-keys.ts +84 -0
- package/src/admin/apps/scopes.test.ts +5 -1
- package/src/admin/apps/verified-tokens.ts +1 -1
- package/src/admin/ui.generated.ts +1 -1
- package/src/apps/composition.test.ts +66 -0
- package/src/apps/data/App.ts +295 -0
- package/src/apps/data/index.ts +2 -0
- package/src/apps/{activities.test.ts → data/routes/activities.test.ts} +3 -3
- package/src/apps/{activities.ts → data/routes/activities.ts} +15 -15
- package/src/apps/{addresses.ts → data/routes/addresses.ts} +6 -6
- package/src/apps/{balances.test.ts → data/routes/balances.test.ts} +2 -2
- package/src/apps/{balances.ts → data/routes/balances.ts} +46 -12
- package/src/apps/{blocks.test.ts → data/routes/blocks.test.ts} +3 -3
- package/src/apps/{blocks.ts → data/routes/blocks.ts} +14 -14
- package/src/apps/{coingecko.test.ts → data/routes/coingecko.test.ts} +2 -2
- package/src/apps/{coingecko.ts → data/routes/coingecko.ts} +14 -14
- package/src/apps/{exchanges.test.ts → data/routes/exchanges.test.ts} +1 -1
- package/src/apps/{exchanges.ts → data/routes/exchanges.ts} +20 -20
- package/src/apps/{fee-amm.test.ts → data/routes/fee-amm.test.ts} +3 -3
- package/src/apps/{fee-amm.ts → data/routes/fee-amm.ts} +18 -18
- package/src/apps/{indexer.test.ts → data/routes/indexer.test.ts} +26 -5
- package/src/apps/{indexer.ts → data/routes/indexer.ts} +13 -10
- package/src/apps/{receipts.test.ts → data/routes/receipts.test.ts} +3 -3
- package/src/apps/{receipts.ts → data/routes/receipts.ts} +13 -13
- package/src/apps/{rpc.test.ts → data/routes/rpc.test.ts} +44 -5
- package/src/apps/{rpc.ts → data/routes/rpc.ts} +7 -7
- package/src/apps/{tokenlist.test.ts → data/routes/tokenlist.test.ts} +3 -3
- package/src/apps/{tokenlist.ts → data/routes/tokenlist.ts} +9 -9
- package/src/apps/{tokens.test.ts → data/routes/tokens.test.ts} +2 -2
- package/src/apps/{tokens.ts → data/routes/tokens.ts} +20 -20
- package/src/apps/{transactions.test.ts → data/routes/transactions.test.ts} +3 -3
- package/src/apps/{transactions.ts → data/routes/transactions.ts} +15 -15
- package/src/apps/{transfers.test.ts → data/routes/transfers.test.ts} +2 -2
- package/src/apps/{transfers.ts → data/routes/transfers.ts} +15 -15
- package/src/apps/{verified-tokens.test.ts → data/routes/verified-tokens.test.ts} +3 -3
- package/src/apps/{verified-tokens.ts → data/routes/verified-tokens.ts} +10 -10
- package/src/apps/{webhooks.test.ts → data/routes/webhooks.test.ts} +6 -6
- package/src/apps/{webhooks.ts → data/routes/webhooks.ts} +39 -35
- package/src/apps/docs/App.ts +136 -0
- package/src/apps/docs/index.ts +1 -0
- package/src/apps/index.ts +3 -0
- package/src/apps/metadata.ts +23 -0
- package/src/apps/platform/App.ts +130 -0
- package/src/apps/platform/index.ts +1 -0
- package/src/apps/platform/routes/api-keys.test.ts +330 -0
- package/src/apps/platform/routes/api-keys.ts +427 -0
- package/src/apps/platform/routes/invitations.test.ts +361 -0
- package/src/apps/platform/routes/invitations.ts +519 -0
- package/src/apps/platform/routes/me.test.ts +121 -0
- package/src/apps/platform/routes/me.ts +106 -0
- package/src/apps/platform/routes/members.test.ts +195 -0
- package/src/apps/platform/routes/members.ts +313 -0
- package/src/apps/platform/routes/orgs.test.ts +313 -0
- package/src/apps/platform/routes/orgs.ts +343 -0
- package/src/apps/platform/routes/projects.test.ts +181 -0
- package/src/apps/platform/routes/projects.ts +367 -0
- package/src/apps/relay/App.test.ts +484 -0
- package/src/apps/relay/App.ts +128 -0
- package/src/apps/relay/Sponsorships.test.ts +375 -0
- package/src/apps/relay/Sponsorships.ts +305 -0
- package/src/apps/relay/index.ts +2 -0
- package/src/cli/Cli.ts +1 -1
- package/src/cli/commands/admin.ts +2 -2
- package/src/db/Db.ts +159 -0
- package/src/db/Schema.ts +137 -0
- package/src/db/tables/invitations.ts +198 -0
- package/src/db/tables/memberships.ts +208 -0
- package/src/db/tables/organizations.test.ts +37 -1
- package/src/db/tables/organizations.ts +105 -0
- package/src/db/tables/projects.ts +107 -0
- package/src/db/tables/sponsoredTransactions.test.ts +218 -0
- package/src/db/tables/sponsoredTransactions.ts +236 -0
- package/src/db/tables/users.ts +85 -0
- package/src/handlers/internal/executionError.ts +2 -0
- package/src/handlers/internal/multisig.test.ts +84 -10
- package/src/handlers/internal/multisig.ts +15 -50
- package/src/handlers/internal/sponsorship.ts +74 -15
- package/src/handlers/{internal/relay.localnet.test.ts → relay.test.ts} +2 -2
- package/src/handlers/relay.ts +23 -5
- package/src/internal/Auth.test.ts +316 -0
- package/src/internal/Auth.ts +691 -25
- package/src/internal/Cursor.test.ts +3 -2
- package/src/internal/Log.test.ts +1 -1
- package/src/internal/Log.ts +11 -3
- package/src/internal/MetricSink.ts +1 -1
- package/src/internal/OpenApi.ts +0 -59
- package/src/internal/Store.test.ts +52 -0
- package/src/internal/Store.ts +24 -5
- package/src/internal/Tidx.local.test.ts +1 -1
- package/src/internal/VerifiedTokens.test.ts +1 -1
- package/src/internal/WebhookDestination.test.ts +1 -1
- package/src/internal/Webhooks.test.ts +4 -4
- package/src/internal/Webhooks.ts +1 -1
- package/dist/apps/activities.js.map +0 -1
- package/dist/apps/addresses.js.map +0 -1
- package/dist/apps/balances.d.ts.map +0 -1
- package/dist/apps/balances.js.map +0 -1
- package/dist/apps/blocks.d.ts.map +0 -1
- package/dist/apps/blocks.js.map +0 -1
- package/dist/apps/coingecko.d.ts.map +0 -1
- package/dist/apps/coingecko.js.map +0 -1
- package/dist/apps/exchanges.d.ts.map +0 -1
- package/dist/apps/exchanges.js.map +0 -1
- package/dist/apps/fee-amm.d.ts.map +0 -1
- package/dist/apps/fee-amm.js.map +0 -1
- package/dist/apps/indexer.d.ts.map +0 -1
- package/dist/apps/indexer.js.map +0 -1
- package/dist/apps/receipts.d.ts.map +0 -1
- package/dist/apps/receipts.js.map +0 -1
- package/dist/apps/rpc.d.ts.map +0 -1
- package/dist/apps/rpc.js.map +0 -1
- package/dist/apps/tokenlist.d.ts.map +0 -1
- package/dist/apps/tokenlist.js.map +0 -1
- package/dist/apps/tokens.d.ts.map +0 -1
- package/dist/apps/tokens.js.map +0 -1
- package/dist/apps/transactions.d.ts.map +0 -1
- package/dist/apps/transactions.js.map +0 -1
- package/dist/apps/transfers.d.ts.map +0 -1
- package/dist/apps/transfers.js.map +0 -1
- package/dist/apps/verified-tokens.d.ts.map +0 -1
- package/dist/apps/verified-tokens.js.map +0 -1
- package/dist/apps/webhooks.js.map +0 -1
- package/dist/internal/OpenApi.fonts.d.ts.map +0 -1
- package/dist/internal/OpenApi.fonts.js.map +0 -1
- package/dist/internal/OpenApi.logo.d.ts.map +0 -1
- package/dist/internal/OpenApi.logo.js.map +0 -1
- package/src/handlers/internal/multisig.localnet.test.ts +0 -146
- /package/src/{internal/OpenApi.fonts.ts → apps/docs/fonts.ts} +0 -0
- /package/src/{internal/OpenApi.logo.ts → apps/docs/logo.ts} +0 -0
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { Address, Hex, P256 } from 'ox'
|
|
2
2
|
import { MultisigConfig, SignatureEnvelope, TxEnvelopeTempo } from 'ox/tempo'
|
|
3
3
|
import { createClient, custom } from 'viem'
|
|
4
|
+
import { prepareTransactionRequest, sendTransactionSync, signTransaction } from 'viem/actions'
|
|
4
5
|
import { Account, Transaction } from 'viem/tempo'
|
|
5
6
|
import { tempoDevnet } from 'viem/tempo/chains'
|
|
6
7
|
|
|
8
|
+
import * as Relay from '../../../test/Relay.js'
|
|
9
|
+
import * as Runtime from '../../../test/runtime.js'
|
|
10
|
+
import * as StateStore from '../../internal/Store.js'
|
|
7
11
|
import * as Multisig from './multisig.js'
|
|
8
12
|
|
|
9
13
|
const privateKey_1 = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'
|
|
@@ -245,12 +249,12 @@ describe('config resolution', () => {
|
|
|
245
249
|
expect({
|
|
246
250
|
hash,
|
|
247
251
|
init: transaction_submitted.signature.init
|
|
248
|
-
? MultisigConfig.
|
|
252
|
+
? MultisigConfig.getAddress(transaction_submitted.signature.init)
|
|
249
253
|
: undefined,
|
|
250
254
|
}).toMatchInlineSnapshot(`
|
|
251
255
|
{
|
|
252
256
|
"hash": "${hash}",
|
|
253
|
-
"init": "${
|
|
257
|
+
"init": "${account.address.toLowerCase()}",
|
|
254
258
|
}
|
|
255
259
|
`)
|
|
256
260
|
})
|
|
@@ -311,12 +315,12 @@ describe('config resolution', () => {
|
|
|
311
315
|
expect({
|
|
312
316
|
hash,
|
|
313
317
|
init: transaction_submitted.signature.init
|
|
314
|
-
? MultisigConfig.
|
|
318
|
+
? MultisigConfig.getAddress(transaction_submitted.signature.init)
|
|
315
319
|
: undefined,
|
|
316
320
|
}).toMatchInlineSnapshot(`
|
|
317
321
|
{
|
|
318
322
|
"hash": "${hash}",
|
|
319
|
-
"init": "${
|
|
323
|
+
"init": "${account.address.toLowerCase()}",
|
|
320
324
|
}
|
|
321
325
|
`)
|
|
322
326
|
})
|
|
@@ -376,12 +380,12 @@ describe('config resolution', () => {
|
|
|
376
380
|
expect({
|
|
377
381
|
hash,
|
|
378
382
|
init: transaction_submitted.signature.init
|
|
379
|
-
? MultisigConfig.
|
|
383
|
+
? MultisigConfig.getAddress(transaction_submitted.signature.init)
|
|
380
384
|
: undefined,
|
|
381
385
|
}).toMatchInlineSnapshot(`
|
|
382
386
|
{
|
|
383
387
|
"hash": "${hash}",
|
|
384
|
-
"init": "${
|
|
388
|
+
"init": "${account.address.toLowerCase()}",
|
|
385
389
|
}
|
|
386
390
|
`)
|
|
387
391
|
})
|
|
@@ -474,12 +478,12 @@ describe('config resolution', () => {
|
|
|
474
478
|
signature: SignatureEnvelope.Multisig
|
|
475
479
|
}
|
|
476
480
|
expect({
|
|
481
|
+
account: transaction_submitted.signature.account,
|
|
477
482
|
hash,
|
|
478
483
|
init: transaction_submitted.signature.init,
|
|
479
|
-
genesisConfigId: transaction_submitted.signature.genesisConfigId,
|
|
480
484
|
}).toMatchInlineSnapshot(`
|
|
481
485
|
{
|
|
482
|
-
"
|
|
486
|
+
"account": "${account.address.toLowerCase()}",
|
|
483
487
|
"hash": "${hash}",
|
|
484
488
|
"init": undefined,
|
|
485
489
|
}
|
|
@@ -566,6 +570,7 @@ describe('handleRawTransaction with sponsor', () => {
|
|
|
566
570
|
signatures: [signature_2],
|
|
567
571
|
} as never)
|
|
568
572
|
const broadcasted: string[] = []
|
|
573
|
+
const sponsored: unknown[] = []
|
|
569
574
|
|
|
570
575
|
await Multisig.handleRawTransaction({
|
|
571
576
|
getClient: (() => undefined) as never,
|
|
@@ -593,6 +598,10 @@ describe('handleRawTransaction with sponsor', () => {
|
|
|
593
598
|
request: { params: [second] },
|
|
594
599
|
sponsor: {
|
|
595
600
|
account: feePayer as never,
|
|
601
|
+
onSponsored: (event) => {
|
|
602
|
+
sponsored.push(event)
|
|
603
|
+
expect(broadcasted).toHaveLength(0)
|
|
604
|
+
},
|
|
596
605
|
resolveFeeToken: () => feeToken,
|
|
597
606
|
},
|
|
598
607
|
store,
|
|
@@ -608,6 +617,7 @@ describe('handleRawTransaction with sponsor', () => {
|
|
|
608
617
|
feeToken: (transaction_broadcasted['feeToken'] as string).toLowerCase(),
|
|
609
618
|
hash,
|
|
610
619
|
init: Boolean(signature.init),
|
|
620
|
+
sponsored: sponsored.length,
|
|
611
621
|
signature: signature.type,
|
|
612
622
|
}).toMatchInlineSnapshot(`
|
|
613
623
|
{
|
|
@@ -616,6 +626,7 @@ describe('handleRawTransaction with sponsor', () => {
|
|
|
616
626
|
"hash": "${hash}",
|
|
617
627
|
"init": true,
|
|
618
628
|
"signature": "multisig",
|
|
629
|
+
"sponsored": 1,
|
|
619
630
|
}
|
|
620
631
|
`)
|
|
621
632
|
})
|
|
@@ -706,13 +717,77 @@ describe('handleRawTransaction with sponsor', () => {
|
|
|
706
717
|
})
|
|
707
718
|
})
|
|
708
719
|
|
|
720
|
+
describe.runIf(Runtime.get().mode === 'localnet' && process.env.TEMPO_IMAGE_TAG === 'sha-8968664')(
|
|
721
|
+
'e2e',
|
|
722
|
+
() => {
|
|
723
|
+
const owner_1 = Relay.accounts[1]!
|
|
724
|
+
const owner_2 = Relay.accounts[2]!
|
|
725
|
+
const feePayer = Relay.accounts[0]!
|
|
726
|
+
const sponsorFeeToken = Relay.addresses.pathUsd
|
|
727
|
+
const store = StateStore.memory()
|
|
728
|
+
let client: ReturnType<typeof Relay.getClient>
|
|
729
|
+
let server: Relay.Server
|
|
730
|
+
|
|
731
|
+
beforeAll(async () => {
|
|
732
|
+
server = await Relay.createServer(
|
|
733
|
+
(
|
|
734
|
+
await Relay.relay({
|
|
735
|
+
feePayer: {
|
|
736
|
+
account: feePayer,
|
|
737
|
+
feeToken: sponsorFeeToken,
|
|
738
|
+
},
|
|
739
|
+
multisig: { store },
|
|
740
|
+
})
|
|
741
|
+
).listener,
|
|
742
|
+
)
|
|
743
|
+
client = Relay.getClient({ url: server.url })
|
|
744
|
+
})
|
|
745
|
+
|
|
746
|
+
afterAll(() => {
|
|
747
|
+
server.close()
|
|
748
|
+
})
|
|
749
|
+
|
|
750
|
+
test('behavior: sponsors bootstrap multisig', async () => {
|
|
751
|
+
const account = Account.fromMultisig({
|
|
752
|
+
threshold: 2,
|
|
753
|
+
owners: [
|
|
754
|
+
{ owner: owner_1.address, weight: 1 },
|
|
755
|
+
{ owner: owner_2.address, weight: 1 },
|
|
756
|
+
],
|
|
757
|
+
})
|
|
758
|
+
const transaction = await prepareTransactionRequest(client, {
|
|
759
|
+
account,
|
|
760
|
+
feePayer: true,
|
|
761
|
+
to: account.address,
|
|
762
|
+
value: 0n,
|
|
763
|
+
})
|
|
764
|
+
const signatures = await Promise.all(
|
|
765
|
+
[owner_1, owner_2].map((owner) =>
|
|
766
|
+
signTransaction(client, { ...transaction, account: owner }),
|
|
767
|
+
),
|
|
768
|
+
)
|
|
769
|
+
const receipt = await sendTransactionSync(client, {
|
|
770
|
+
...transaction,
|
|
771
|
+
account,
|
|
772
|
+
signatures,
|
|
773
|
+
})
|
|
774
|
+
|
|
775
|
+
expect(receipt).toMatchObject({
|
|
776
|
+
feePayer: feePayer.address.toLowerCase(),
|
|
777
|
+
feeToken: sponsorFeeToken.toLowerCase(),
|
|
778
|
+
from: account.address.toLowerCase(),
|
|
779
|
+
status: 'success',
|
|
780
|
+
})
|
|
781
|
+
})
|
|
782
|
+
},
|
|
783
|
+
)
|
|
784
|
+
|
|
709
785
|
function createOperation(): Multisig.Operation {
|
|
710
786
|
const now = Date.now()
|
|
711
787
|
return {
|
|
712
788
|
account: '0x0000000000000000000000000000000000000001',
|
|
713
789
|
chainId: tempoDevnet.id,
|
|
714
790
|
createdAt: now,
|
|
715
|
-
genesisConfigId: `0x${'11'.repeat(32)}`,
|
|
716
791
|
id: `0x${'22'.repeat(32)}`,
|
|
717
792
|
payload: `0x${'33'.repeat(32)}`,
|
|
718
793
|
signatures: [],
|
|
@@ -737,7 +812,6 @@ function withoutInit(serialized: `0x${string}`) {
|
|
|
737
812
|
return TxEnvelopeTempo.serialize(TxEnvelopeTempo.from(unsigned as never), {
|
|
738
813
|
signature: SignatureEnvelope.from({
|
|
739
814
|
account: signature.account,
|
|
740
|
-
genesisConfigId: signature.genesisConfigId,
|
|
741
815
|
signatures: signature.signatures,
|
|
742
816
|
}),
|
|
743
817
|
})
|
|
@@ -66,7 +66,6 @@ async function collect(options: collect.Options): Promise<collect.ReturnType> {
|
|
|
66
66
|
const config = await resolveValidatedConfig({
|
|
67
67
|
account: input.account,
|
|
68
68
|
chainId: input.chainId,
|
|
69
|
-
genesisConfigId: input.genesisConfigId,
|
|
70
69
|
init: input.init,
|
|
71
70
|
pending,
|
|
72
71
|
resolveConfig,
|
|
@@ -78,7 +77,6 @@ async function collect(options: collect.Options): Promise<collect.ReturnType> {
|
|
|
78
77
|
})
|
|
79
78
|
const initConfig = resolveInitConfig({
|
|
80
79
|
config,
|
|
81
|
-
genesisConfigId: input.genesisConfigId,
|
|
82
80
|
init: input.init,
|
|
83
81
|
nonce: input.nonce,
|
|
84
82
|
pending,
|
|
@@ -91,7 +89,6 @@ async function collect(options: collect.Options): Promise<collect.ReturnType> {
|
|
|
91
89
|
claimExpiresAt: pending?.claimExpiresAt,
|
|
92
90
|
config,
|
|
93
91
|
createdAt: pending?.createdAt ?? now,
|
|
94
|
-
genesisConfigId: input.genesisConfigId,
|
|
95
92
|
id: input.id,
|
|
96
93
|
init: pending?.init || !!initConfig,
|
|
97
94
|
initConfig,
|
|
@@ -106,7 +103,6 @@ async function collect(options: collect.Options): Promise<collect.ReturnType> {
|
|
|
106
103
|
let approvals = getApprovals({
|
|
107
104
|
account: input.account,
|
|
108
105
|
config,
|
|
109
|
-
genesisConfigId: input.genesisConfigId,
|
|
110
106
|
payload: input.payload,
|
|
111
107
|
signatures: operation.signatures,
|
|
112
108
|
})
|
|
@@ -121,7 +117,6 @@ async function collect(options: collect.Options): Promise<collect.ReturnType> {
|
|
|
121
117
|
approvals = getApprovals({
|
|
122
118
|
account: operation.account,
|
|
123
119
|
config,
|
|
124
|
-
genesisConfigId: operation.genesisConfigId,
|
|
125
120
|
payload: operation.payload,
|
|
126
121
|
signatures: operation.signatures,
|
|
127
122
|
})
|
|
@@ -136,14 +131,12 @@ async function collect(options: collect.Options): Promise<collect.ReturnType> {
|
|
|
136
131
|
approvals = getApprovals({
|
|
137
132
|
account: operation.account,
|
|
138
133
|
config,
|
|
139
|
-
genesisConfigId: operation.genesisConfigId,
|
|
140
134
|
payload: operation.payload,
|
|
141
135
|
signatures: operation.signatures,
|
|
142
136
|
})
|
|
143
137
|
const client = getClient(operation.chainId)
|
|
144
138
|
const final = await serializeFinal({
|
|
145
139
|
account: operation.account,
|
|
146
|
-
genesisConfigId: operation.genesisConfigId,
|
|
147
140
|
init: operation.initConfig ?? initConfig,
|
|
148
141
|
signatures: approvals.signatures,
|
|
149
142
|
transaction: input.transaction,
|
|
@@ -199,6 +192,7 @@ async function collect(options: collect.Options): Promise<collect.ReturnType> {
|
|
|
199
192
|
: undefined,
|
|
200
193
|
getClient,
|
|
201
194
|
method: broadcastMethod,
|
|
195
|
+
onSponsored: sponsor.onSponsored,
|
|
202
196
|
request: { params: [final] },
|
|
203
197
|
sender: operation.account,
|
|
204
198
|
validate: sponsor.validate,
|
|
@@ -295,7 +289,6 @@ export async function getStatus(options: getStatus.Options): Promise<Status | nu
|
|
|
295
289
|
const config = await resolveValidatedConfig({
|
|
296
290
|
account: operation.account,
|
|
297
291
|
chainId: operation.chainId,
|
|
298
|
-
genesisConfigId: operation.genesisConfigId,
|
|
299
292
|
pending: operation,
|
|
300
293
|
resolveConfig: options.resolveConfig,
|
|
301
294
|
})
|
|
@@ -303,7 +296,6 @@ export async function getStatus(options: getStatus.Options): Promise<Status | nu
|
|
|
303
296
|
return {
|
|
304
297
|
account: operation.account,
|
|
305
298
|
chainId: operation.chainId,
|
|
306
|
-
genesisConfigId: operation.genesisConfigId,
|
|
307
299
|
id: operation.id,
|
|
308
300
|
signatures: operation.signatures.length,
|
|
309
301
|
status: operation.status,
|
|
@@ -312,7 +304,6 @@ export async function getStatus(options: getStatus.Options): Promise<Status | nu
|
|
|
312
304
|
const approvals = getApprovals({
|
|
313
305
|
account: operation.account,
|
|
314
306
|
config,
|
|
315
|
-
genesisConfigId: operation.genesisConfigId,
|
|
316
307
|
payload: operation.payload,
|
|
317
308
|
signatures: operation.signatures,
|
|
318
309
|
})
|
|
@@ -339,7 +330,6 @@ export async function listStatuses(options: listStatuses.Options): Promise<reado
|
|
|
339
330
|
const config = await resolveValidatedConfig({
|
|
340
331
|
account: operation.account,
|
|
341
332
|
chainId: operation.chainId,
|
|
342
|
-
genesisConfigId: operation.genesisConfigId,
|
|
343
333
|
pending: operation,
|
|
344
334
|
resolveConfig: options.resolveConfig,
|
|
345
335
|
})
|
|
@@ -347,7 +337,6 @@ export async function listStatuses(options: listStatuses.Options): Promise<reado
|
|
|
347
337
|
return {
|
|
348
338
|
account: operation.account,
|
|
349
339
|
chainId: operation.chainId,
|
|
350
|
-
genesisConfigId: operation.genesisConfigId,
|
|
351
340
|
id: operation.id,
|
|
352
341
|
signatures: operation.signatures.length,
|
|
353
342
|
status: operation.status,
|
|
@@ -356,7 +345,6 @@ export async function listStatuses(options: listStatuses.Options): Promise<reado
|
|
|
356
345
|
const approvals = getApprovals({
|
|
357
346
|
account: operation.account,
|
|
358
347
|
config,
|
|
359
|
-
genesisConfigId: operation.genesisConfigId,
|
|
360
348
|
payload: operation.payload,
|
|
361
349
|
signatures: operation.signatures,
|
|
362
350
|
})
|
|
@@ -497,8 +485,6 @@ export type ResolveConfig = (request: {
|
|
|
497
485
|
account: Address
|
|
498
486
|
/** Transaction chain id. */
|
|
499
487
|
chainId: number
|
|
500
|
-
/** Permanent genesis config id. */
|
|
501
|
-
genesisConfigId: Hex.Hex
|
|
502
488
|
/** Bootstrap config carried by the transaction, when present. */
|
|
503
489
|
init?: MultisigConfig.Config | undefined
|
|
504
490
|
}) => MultisigConfig.Config | Promise<MultisigConfig.Config | undefined> | undefined
|
|
@@ -509,6 +495,8 @@ export type Sponsor = {
|
|
|
509
495
|
account: LocalAccount
|
|
510
496
|
/** Fee token to set before fee payer signing. */
|
|
511
497
|
feeToken?: Address | undefined
|
|
498
|
+
/** Called once the fee payer has signed, before any broadcast. */
|
|
499
|
+
onSponsored?: Sponsorship.handleRawTransaction.Options['onSponsored']
|
|
512
500
|
/** Resolves the default fee token for raw sponsorship. */
|
|
513
501
|
resolveFeeToken?:
|
|
514
502
|
| ((chainId: number) => Address | Promise<Address | undefined> | undefined)
|
|
@@ -570,8 +558,6 @@ export type Operation = {
|
|
|
570
558
|
config?: MultisigConfig.Config | undefined
|
|
571
559
|
/** Creation timestamp in milliseconds. */
|
|
572
560
|
createdAt: number
|
|
573
|
-
/** Permanent genesis config id. */
|
|
574
|
-
genesisConfigId: Hex.Hex
|
|
575
561
|
/** Deterministic operation id. */
|
|
576
562
|
id: Hex.Hex
|
|
577
563
|
/** Whether the finalized transaction must carry the genesis init config. */
|
|
@@ -598,8 +584,6 @@ export type Status = {
|
|
|
598
584
|
account: Address
|
|
599
585
|
/** Transaction chain id. */
|
|
600
586
|
chainId: number
|
|
601
|
-
/** Permanent genesis config id. */
|
|
602
|
-
genesisConfigId: Hex.Hex
|
|
603
587
|
/** Deterministic operation id. */
|
|
604
588
|
id: Hex.Hex
|
|
605
589
|
/** Number of collected owner approvals. */
|
|
@@ -627,7 +611,6 @@ function parse(serialized: Hex.Hex) {
|
|
|
627
611
|
const chainId = Number(transaction['chainId'])
|
|
628
612
|
const id = MultisigConfig.getSignPayload({
|
|
629
613
|
account: signature.account,
|
|
630
|
-
genesisConfigId: signature.genesisConfigId,
|
|
631
614
|
payload,
|
|
632
615
|
})
|
|
633
616
|
const init = signature.init ? MultisigConfig.from(signature.init) : undefined
|
|
@@ -636,7 +619,6 @@ function parse(serialized: Hex.Hex) {
|
|
|
636
619
|
return {
|
|
637
620
|
account: signature.account,
|
|
638
621
|
chainId,
|
|
639
|
-
genesisConfigId: signature.genesisConfigId,
|
|
640
622
|
id,
|
|
641
623
|
init,
|
|
642
624
|
nonce,
|
|
@@ -652,7 +634,6 @@ function isMultisigSignature(value: unknown): value is SignatureEnvelope.Multisi
|
|
|
652
634
|
value !== null &&
|
|
653
635
|
(value as { type?: unknown }).type === 'multisig' &&
|
|
654
636
|
typeof (value as { account?: unknown }).account === 'string' &&
|
|
655
|
-
typeof (value as { genesisConfigId?: unknown }).genesisConfigId === 'string' &&
|
|
656
637
|
Array.isArray((value as { signatures?: unknown }).signatures)
|
|
657
638
|
)
|
|
658
639
|
}
|
|
@@ -660,50 +641,39 @@ function isMultisigSignature(value: unknown): value is SignatureEnvelope.Multisi
|
|
|
660
641
|
async function resolveValidatedConfig(options: {
|
|
661
642
|
account: Address
|
|
662
643
|
chainId: number
|
|
663
|
-
genesisConfigId: Hex.Hex
|
|
664
644
|
init?: MultisigConfig.Config | undefined
|
|
665
645
|
pending?: Operation | undefined
|
|
666
646
|
resolveConfig?: ResolveConfig | undefined
|
|
667
647
|
}) {
|
|
668
|
-
const { account, chainId,
|
|
669
|
-
const config =
|
|
670
|
-
(await resolveConfig?.({ account, chainId, genesisConfigId, init })) ?? pending?.config ?? init
|
|
648
|
+
const { account, chainId, init, pending, resolveConfig } = options
|
|
649
|
+
const config = (await resolveConfig?.({ account, chainId, init })) ?? pending?.config ?? init
|
|
671
650
|
if (!config) return undefined
|
|
672
651
|
|
|
673
|
-
if (init && !isGenesisConfig(init, genesisConfigId))
|
|
674
|
-
throw new RpcResponse.InvalidParamsError({
|
|
675
|
-
message: 'Bootstrap multisig init config does not match genesis config id.',
|
|
676
|
-
})
|
|
677
|
-
|
|
678
652
|
const normalized = MultisigConfig.from(config)
|
|
679
|
-
|
|
680
|
-
|
|
653
|
+
if (
|
|
654
|
+
init &&
|
|
655
|
+
MultisigConfig.getAddress(MultisigConfig.from(init)).toLowerCase() !== account.toLowerCase()
|
|
656
|
+
)
|
|
681
657
|
throw new RpcResponse.InvalidParamsError({
|
|
682
|
-
message: '
|
|
658
|
+
message: 'Bootstrap multisig init config does not match the multisig account.',
|
|
683
659
|
})
|
|
684
660
|
return normalized
|
|
685
661
|
}
|
|
686
662
|
|
|
687
663
|
function resolveInitConfig(options: {
|
|
688
664
|
config: MultisigConfig.Config
|
|
689
|
-
genesisConfigId: Hex.Hex
|
|
690
665
|
init?: MultisigConfig.Config | undefined
|
|
691
666
|
nonce?: number | undefined
|
|
692
667
|
pending?: Operation | undefined
|
|
693
668
|
}) {
|
|
694
|
-
const { config,
|
|
669
|
+
const { config, init, nonce, pending } = options
|
|
695
670
|
if (pending?.initConfig) return pending.initConfig
|
|
696
|
-
if (pending?.init && pending.config
|
|
697
|
-
return pending.config
|
|
671
|
+
if (pending?.init && pending.config) return pending.config
|
|
698
672
|
if (init) return init
|
|
699
|
-
if (nonce === 0
|
|
673
|
+
if (nonce === 0) return config
|
|
700
674
|
return undefined
|
|
701
675
|
}
|
|
702
676
|
|
|
703
|
-
function isGenesisConfig(config: MultisigConfig.Config, genesisConfigId: Hex.Hex) {
|
|
704
|
-
return MultisigConfig.toId(config).toLowerCase() === genesisConfigId.toLowerCase()
|
|
705
|
-
}
|
|
706
|
-
|
|
707
677
|
function mergeSignatures(signatures: readonly Hex.Hex[]) {
|
|
708
678
|
const seen = new Set<string>()
|
|
709
679
|
const out: Hex.Hex[] = []
|
|
@@ -719,12 +689,11 @@ function mergeSignatures(signatures: readonly Hex.Hex[]) {
|
|
|
719
689
|
function getApprovals(options: {
|
|
720
690
|
account: Address
|
|
721
691
|
config: MultisigConfig.Config
|
|
722
|
-
genesisConfigId: Hex.Hex
|
|
723
692
|
payload: Hex.Hex
|
|
724
693
|
signatures: readonly Hex.Hex[]
|
|
725
694
|
}) {
|
|
726
|
-
const { account, config,
|
|
727
|
-
const digest = MultisigConfig.getSignPayload({ account,
|
|
695
|
+
const { account, config, payload } = options
|
|
696
|
+
const digest = MultisigConfig.getSignPayload({ account, payload })
|
|
728
697
|
const owners = new Map(
|
|
729
698
|
config.owners.map((owner) => [
|
|
730
699
|
owner.owner.toLowerCase(),
|
|
@@ -764,7 +733,6 @@ function getApprovals(options: {
|
|
|
764
733
|
|
|
765
734
|
async function serializeFinal(options: {
|
|
766
735
|
account: Address
|
|
767
|
-
genesisConfigId: Hex.Hex
|
|
768
736
|
init?: MultisigConfig.Config | undefined
|
|
769
737
|
signatures: readonly Hex.Hex[]
|
|
770
738
|
transaction: Record<string, unknown>
|
|
@@ -804,13 +772,11 @@ async function serializeFinal(options: {
|
|
|
804
772
|
const signatures = options.signatures.map((approval) => SignatureEnvelope.from(approval))
|
|
805
773
|
const sorted = SignatureEnvelope.sortMultisigApprovals({
|
|
806
774
|
account: options.account,
|
|
807
|
-
genesisConfigId: options.genesisConfigId,
|
|
808
775
|
payload,
|
|
809
776
|
signatures,
|
|
810
777
|
})
|
|
811
778
|
const signature = SignatureEnvelope.from({
|
|
812
779
|
account: options.account,
|
|
813
|
-
genesisConfigId: options.genesisConfigId,
|
|
814
780
|
signatures: sorted,
|
|
815
781
|
...(options.init ? { init: options.init } : {}),
|
|
816
782
|
})
|
|
@@ -847,7 +813,6 @@ function toStatus(options: {
|
|
|
847
813
|
return {
|
|
848
814
|
account: operation.account,
|
|
849
815
|
chainId: operation.chainId,
|
|
850
|
-
genesisConfigId: operation.genesisConfigId,
|
|
851
816
|
id: operation.id,
|
|
852
817
|
signatures: approvals.signatures.length,
|
|
853
818
|
status: operation.status,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RpcResponse, Signature } from 'ox'
|
|
1
|
+
import { Hash, type Hex, RpcResponse, Signature } from 'ox'
|
|
2
2
|
import { TxEnvelopeTempo } from 'ox/tempo'
|
|
3
3
|
import type { Address, Client } from 'viem'
|
|
4
4
|
import type { LocalAccount } from 'viem/accounts'
|
|
@@ -6,6 +6,15 @@ import { Transaction } from 'viem/tempo'
|
|
|
6
6
|
|
|
7
7
|
import * as Utils from './utils.js'
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Sponsorship approval callback. The candidate always carries its `chainId`:
|
|
11
|
+
* raw submissions deserialize it, and fills validate only prepared/filled
|
|
12
|
+
* transactions.
|
|
13
|
+
*/
|
|
14
|
+
export type Validate = (
|
|
15
|
+
request: Transaction.TransactionRequest & { chainId?: number | Hex.Hex | undefined },
|
|
16
|
+
) => boolean | Promise<boolean>
|
|
17
|
+
|
|
9
18
|
/** Returns sponsor metadata for `eth_fillTransaction` responses. */
|
|
10
19
|
export function getSponsor(options: getSponsor.Options): getSponsor.ReturnType {
|
|
11
20
|
const { account, name, url } = options
|
|
@@ -53,7 +62,7 @@ export declare namespace shouldSponsor {
|
|
|
53
62
|
/** Filled transaction to validate. */
|
|
54
63
|
transaction: Record<string, unknown>
|
|
55
64
|
/** Optional sponsorship approval callback. */
|
|
56
|
-
validate?:
|
|
65
|
+
validate?: Validate | undefined
|
|
57
66
|
}
|
|
58
67
|
}
|
|
59
68
|
|
|
@@ -88,13 +97,28 @@ export async function sign(options: sign.Options) {
|
|
|
88
97
|
})
|
|
89
98
|
if (!account.sign) throw new Error('Fee payer account cannot sign transactions.')
|
|
90
99
|
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
)
|
|
100
|
+
const chainId = Utils.resolveChainId(transaction['chainId'])
|
|
101
|
+
if (chainId === undefined)
|
|
102
|
+
throw new RpcResponse.InvalidParamsError({
|
|
103
|
+
message: 'Transaction chainId must be provided before fee payer signing.',
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
const envelope = TxEnvelopeTempo.from(prepared as never)
|
|
107
|
+
const signPayload = TxEnvelopeTempo.getFeePayerSignPayload(envelope, { sender: prepared.from })
|
|
108
|
+
const feePayerSignature = Signature.from(await account.sign({ hash: signPayload }))
|
|
109
|
+
|
|
110
|
+
// Awaited before the signature leaves the relay: a fill-signed envelope can
|
|
111
|
+
// broadcast anywhere (even directly to a node), so the commitment records as
|
|
112
|
+
// an intent — no transaction hash until the sender signs.
|
|
113
|
+
const feeToken = transaction['feeToken'] as Address | null | undefined
|
|
114
|
+
await options.onSponsored?.({
|
|
115
|
+
chainId,
|
|
116
|
+
...(feeToken ? { feeToken } : {}),
|
|
117
|
+
method: 'eth_fillTransaction',
|
|
118
|
+
sender: prepared.from,
|
|
119
|
+
signPayload,
|
|
120
|
+
transaction: TxEnvelopeTempo.serialize(envelope, { feePayerSignature }),
|
|
121
|
+
})
|
|
98
122
|
|
|
99
123
|
return { ...prepared, feePayerSignature }
|
|
100
124
|
}
|
|
@@ -103,6 +127,8 @@ export declare namespace sign {
|
|
|
103
127
|
type Options = {
|
|
104
128
|
/** Account used as the fee payer. */
|
|
105
129
|
account: LocalAccount
|
|
130
|
+
/** Called once the fee payer has signed the fill. Awaited: a throw aborts the fill. */
|
|
131
|
+
onSponsored?: ((event: SponsoredEvent) => Promise<void> | void) | undefined
|
|
106
132
|
/** Filled transaction to sign. */
|
|
107
133
|
transaction: Record<string, unknown>
|
|
108
134
|
/** Sender address from the original request. */
|
|
@@ -146,16 +172,25 @@ export async function handleRawTransaction(options: handleRawTransaction.Options
|
|
|
146
172
|
})
|
|
147
173
|
|
|
148
174
|
const envelope = TxEnvelopeTempo.from(transaction_sponsored as never)
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
hash: TxEnvelopeTempo.getFeePayerSignPayload(envelope, { sender }),
|
|
152
|
-
}),
|
|
153
|
-
)
|
|
175
|
+
const signPayload = TxEnvelopeTempo.getFeePayerSignPayload(envelope, { sender })
|
|
176
|
+
const feePayerSignature = Signature.from(await account.sign({ hash: signPayload }))
|
|
154
177
|
const serializedTransaction = TxEnvelopeTempo.serialize(envelope, {
|
|
155
178
|
feePayerSignature,
|
|
156
179
|
signature: transaction.signature,
|
|
157
180
|
})
|
|
158
181
|
|
|
182
|
+
// Awaited before any broadcast so a recording failure refuses sponsorship —
|
|
183
|
+
// no sponsored transaction ever reaches the chain unrecorded.
|
|
184
|
+
await options.onSponsored?.({
|
|
185
|
+
chainId: transaction.chainId,
|
|
186
|
+
...(feeToken ? { feeToken } : {}),
|
|
187
|
+
method,
|
|
188
|
+
sender,
|
|
189
|
+
signPayload,
|
|
190
|
+
transaction: serializedTransaction,
|
|
191
|
+
transactionHash: Hash.keccak256(serializedTransaction),
|
|
192
|
+
})
|
|
193
|
+
|
|
159
194
|
// Raw-sign requests stop after fee-payer signature is added; send methods broadcast it.
|
|
160
195
|
if (method === 'eth_signRawTransaction') return serializedTransaction
|
|
161
196
|
return await client.request({
|
|
@@ -176,11 +211,35 @@ export declare namespace handleRawTransaction {
|
|
|
176
211
|
getClient: (chainId?: number) => Client
|
|
177
212
|
/** Raw transaction method to handle. */
|
|
178
213
|
method: 'eth_signRawTransaction' | 'eth_sendRawTransaction' | 'eth_sendRawTransactionSync'
|
|
214
|
+
/** Called once the fee payer has signed, before any broadcast. Awaited: a throw aborts the request. */
|
|
215
|
+
onSponsored?: ((event: SponsoredEvent) => Promise<void> | void) | undefined
|
|
179
216
|
/** Incoming JSON-RPC request. */
|
|
180
217
|
request: { params?: readonly unknown[] | undefined }
|
|
181
218
|
/** Sender address to use if it cannot be recovered from the raw envelope. */
|
|
182
219
|
sender?: Address | undefined
|
|
183
220
|
/** Optional sponsorship approval callback. */
|
|
184
|
-
validate?:
|
|
221
|
+
validate?: Validate | undefined
|
|
185
222
|
}
|
|
186
223
|
}
|
|
224
|
+
|
|
225
|
+
/** Facts of one sponsorship commitment, emitted at fee-payer signing time. */
|
|
226
|
+
export type SponsoredEvent = {
|
|
227
|
+
/** Chain the sponsored transaction targets. */
|
|
228
|
+
chainId: number
|
|
229
|
+
/** Fee token the sponsorship resolved, when known. */
|
|
230
|
+
feeToken?: Address | undefined
|
|
231
|
+
/** Method that triggered sponsorship: a fill (intent) or a raw submission. */
|
|
232
|
+
method:
|
|
233
|
+
| 'eth_fillTransaction'
|
|
234
|
+
| 'eth_signRawTransaction'
|
|
235
|
+
| 'eth_sendRawTransaction'
|
|
236
|
+
| 'eth_sendRawTransactionSync'
|
|
237
|
+
/** Transaction sender. */
|
|
238
|
+
sender: Address
|
|
239
|
+
/** Fee-payer sign payload — a stable identity for the sponsored envelope. */
|
|
240
|
+
signPayload: Hex.Hex
|
|
241
|
+
/** Serialized sponsored transaction (sender-unsigned for fill intents). */
|
|
242
|
+
transaction: Hex.Hex
|
|
243
|
+
/** Transaction hash (keccak256 of the signed envelope); absent for fill intents, whose senders have not signed yet. */
|
|
244
|
+
transactionHash?: Hex.Hex | undefined
|
|
245
|
+
}
|
|
@@ -5,8 +5,8 @@ import { fillTransaction, sendTransactionSync } from 'viem/actions'
|
|
|
5
5
|
import { Actions, Addresses, Capabilities, Tick, Transaction, VirtualAddress } from 'viem/tempo'
|
|
6
6
|
import { tempo, tempoModerato } from 'viem/tempo/chains'
|
|
7
7
|
|
|
8
|
-
import * as Relay from '
|
|
9
|
-
import * as Runtime from '
|
|
8
|
+
import * as Relay from '../../test/Relay.js'
|
|
9
|
+
import * as Runtime from '../../test/runtime.js'
|
|
10
10
|
|
|
11
11
|
type Server = Relay.Server
|
|
12
12
|
|