tapimo 0.12.0 → 0.14.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/dist/App.d.ts +11333 -9563
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +39 -3
- package/dist/App.js.map +1 -1
- package/dist/Scope.d.ts +2 -0
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +17 -0
- package/dist/Scope.js.map +1 -1
- package/dist/Webhooks.js +2 -2
- package/dist/Webhooks.js.map +1 -1
- package/dist/admin/App.d.ts +1064 -924
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +80 -0
- package/dist/admin/apps/api-keys.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.js +54 -0
- package/dist/admin/apps/api-keys.js.map +1 -1
- package/dist/admin/apps/earn-vaults.d.ts +63 -15
- package/dist/admin/apps/earn-vaults.d.ts.map +1 -1
- package/dist/admin/apps/earn-vaults.js +2 -1
- package/dist/admin/apps/earn-vaults.js.map +1 -1
- package/dist/admin/apps/organizations.d.ts +92 -3
- package/dist/admin/apps/organizations.d.ts.map +1 -1
- package/dist/admin/apps/organizations.js +69 -7
- package/dist/admin/apps/organizations.js.map +1 -1
- package/dist/admin/apps/verified-tokens.d.ts +7 -7
- package/dist/admin/ui.generated.d.ts +1 -1
- package/dist/admin/ui.generated.d.ts.map +1 -1
- package/dist/admin/ui.generated.js +151 -151
- package/dist/admin/ui.generated.js.map +1 -1
- package/dist/apps/Zones.d.ts +28 -28
- package/dist/apps/Zones.js +7 -7
- package/dist/apps/data/App.d.ts +2909 -2523
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/App.js +26 -21
- package/dist/apps/data/App.js.map +1 -1
- package/dist/apps/data/ZoneSelection.d.ts +8 -8
- package/dist/apps/data/ZoneSelection.d.ts.map +1 -1
- package/dist/apps/data/ZoneSelection.js +1 -1
- package/dist/apps/data/ZoneSelection.js.map +1 -1
- package/dist/apps/data/routes/activities.d.ts +588 -584
- package/dist/apps/data/routes/activities.d.ts.map +1 -1
- package/dist/apps/data/routes/activities.js +1561 -1239
- package/dist/apps/data/routes/activities.js.map +1 -1
- package/dist/apps/data/routes/addresses.d.ts +22 -22
- package/dist/apps/data/routes/balances.d.ts +26 -26
- package/dist/apps/data/routes/balances.d.ts.map +1 -1
- package/dist/apps/data/routes/balances.js +43 -16
- package/dist/apps/data/routes/balances.js.map +1 -1
- package/dist/apps/data/routes/blocks.d.ts +44 -44
- package/dist/apps/data/routes/blocks.d.ts.map +1 -1
- package/dist/apps/data/routes/blocks.js +21 -11
- package/dist/apps/data/routes/blocks.js.map +1 -1
- package/dist/apps/data/routes/coingecko.d.ts +3 -3
- package/dist/apps/data/routes/earn.d.ts +201 -25
- package/dist/apps/data/routes/earn.d.ts.map +1 -1
- package/dist/apps/data/routes/earn.js +434 -75
- package/dist/apps/data/routes/earn.js.map +1 -1
- package/dist/apps/data/routes/exchanges.d.ts +160 -145
- package/dist/apps/data/routes/exchanges.d.ts.map +1 -1
- package/dist/apps/data/routes/exchanges.js +180 -114
- package/dist/apps/data/routes/exchanges.js.map +1 -1
- package/dist/apps/data/routes/fee-amm.d.ts +2 -2
- package/dist/apps/data/routes/fee-amm.d.ts.map +1 -1
- package/dist/apps/data/routes/fee-amm.js +18 -19
- package/dist/apps/data/routes/fee-amm.js.map +1 -1
- package/dist/apps/data/routes/receipts.d.ts +155 -55
- package/dist/apps/data/routes/receipts.d.ts.map +1 -1
- package/dist/apps/data/routes/receipts.js +28 -10
- package/dist/apps/data/routes/receipts.js.map +1 -1
- package/dist/apps/data/routes/tokenlist.d.ts +13 -13
- package/dist/apps/data/routes/tokens.d.ts +5 -5
- package/dist/apps/data/routes/tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/tokens.js +51 -20
- package/dist/apps/data/routes/tokens.js.map +1 -1
- package/dist/apps/data/routes/transactions.d.ts +7 -2
- package/dist/apps/data/routes/transactions.d.ts.map +1 -1
- package/dist/apps/data/routes/transactions.js +37 -17
- package/dist/apps/data/routes/transactions.js.map +1 -1
- package/dist/apps/data/routes/transfers.d.ts +13 -13
- package/dist/apps/data/routes/transfers.d.ts.map +1 -1
- package/dist/apps/data/routes/transfers.js +18 -12
- package/dist/apps/data/routes/transfers.js.map +1 -1
- package/dist/apps/data/routes/valuation.d.ts +31 -31
- package/dist/apps/data/routes/valuation.d.ts.map +1 -1
- package/dist/apps/data/routes/valuation.js +12 -7
- package/dist/apps/data/routes/valuation.js.map +1 -1
- package/dist/apps/data/routes/verified-tokens.d.ts +8 -8
- package/dist/apps/data/routes/webhooks.d.ts +816 -113
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +47 -5
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/data/routes/zones.d.ts +14 -14
- package/dist/apps/data/routes/zones.js +1 -1
- package/dist/apps/funding/App.d.ts +466 -44
- package/dist/apps/funding/App.d.ts.map +1 -1
- package/dist/apps/funding/App.js +1 -1
- package/dist/apps/funding/App.js.map +1 -1
- package/dist/apps/funding/routes/deposit-addresses.d.ts +17 -17
- package/dist/apps/funding/routes/deposit-addresses.d.ts.map +1 -1
- package/dist/apps/funding/routes/deposit-addresses.js +17 -12
- package/dist/apps/funding/routes/deposit-addresses.js.map +1 -1
- package/dist/apps/funding/routes/transfers.d.ts +650 -57
- package/dist/apps/funding/routes/transfers.d.ts.map +1 -1
- package/dist/apps/funding/routes/transfers.js +238 -24
- package/dist/apps/funding/routes/transfers.js.map +1 -1
- package/dist/apps/management/App.d.ts +5120 -4152
- package/dist/apps/management/App.d.ts.map +1 -1
- package/dist/apps/management/Billing.d.ts +1 -1
- package/dist/apps/management/Billing.d.ts.map +1 -1
- package/dist/apps/management/Billing.js +17 -1
- package/dist/apps/management/Billing.js.map +1 -1
- package/dist/apps/management/routes/api-keys.d.ts +632 -81
- package/dist/apps/management/routes/api-keys.d.ts.map +1 -1
- package/dist/apps/management/routes/api-keys.js +236 -4
- package/dist/apps/management/routes/api-keys.js.map +1 -1
- package/dist/apps/management/routes/billing.d.ts +76 -76
- package/dist/apps/management/routes/faucet.d.ts +6 -6
- package/dist/apps/management/routes/invitations.d.ts +24 -24
- package/dist/apps/management/routes/invite-links.d.ts +4 -4
- package/dist/apps/management/routes/members.d.ts +16 -16
- package/dist/apps/management/routes/orgs.d.ts +20 -20
- package/dist/apps/management/routes/projects.d.ts +4 -4
- package/dist/apps/management/routes/usage.d.ts +8 -8
- package/dist/apps/management/routes/verified-token-requests.d.ts +17 -17
- package/dist/apps/management/routes/webhooks.d.ts +675 -25
- package/dist/apps/management/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/management/routes/webhooks.js +21 -21
- package/dist/apps/management/routes/webhooks.js.map +1 -1
- package/dist/apps/relay/App.d.ts.map +1 -1
- package/dist/apps/relay/App.js +115 -23
- package/dist/apps/relay/App.js.map +1 -1
- package/dist/apps/relay/Sponsorships.d.ts.map +1 -1
- package/dist/apps/relay/Sponsorships.js +27 -1
- package/dist/apps/relay/Sponsorships.js.map +1 -1
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +34 -1
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +11 -5
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +21 -3
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/fundingCatalog.d.ts +4 -2
- package/dist/db/tables/fundingCatalog.d.ts.map +1 -1
- package/dist/db/tables/fundingCatalog.js +5 -1
- package/dist/db/tables/fundingCatalog.js.map +1 -1
- package/dist/db/tables/fundingTransferTransactions.d.ts +38 -0
- package/dist/db/tables/fundingTransferTransactions.d.ts.map +1 -1
- package/dist/db/tables/fundingTransferTransactions.js +44 -3
- package/dist/db/tables/fundingTransferTransactions.js.map +1 -1
- package/dist/db/tables/fundingTransfers.d.ts +17 -0
- package/dist/db/tables/fundingTransfers.d.ts.map +1 -1
- package/dist/db/tables/fundingTransfers.js +21 -0
- package/dist/db/tables/fundingTransfers.js.map +1 -1
- package/dist/db/tables/organizations.d.ts +24 -0
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +27 -0
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/projects.d.ts +25 -1
- package/dist/db/tables/projects.d.ts.map +1 -1
- package/dist/db/tables/projects.js +26 -0
- package/dist/db/tables/projects.js.map +1 -1
- package/dist/db/tables/sponsoredTransactions.d.ts +44 -0
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -1
- package/dist/db/tables/sponsoredTransactions.js +146 -13
- package/dist/db/tables/sponsoredTransactions.js.map +1 -1
- package/dist/db/tables/webhookSubscriptions.d.ts +10 -6
- package/dist/db/tables/webhookSubscriptions.d.ts.map +1 -1
- package/dist/db/tables/webhookSubscriptions.js +9 -6
- package/dist/db/tables/webhookSubscriptions.js.map +1 -1
- package/dist/handlers/internal/utils.d.ts.map +1 -1
- package/dist/handlers/internal/utils.js +9 -0
- package/dist/handlers/internal/utils.js.map +1 -1
- package/dist/internal/Auth.d.ts +3 -1
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +6 -3
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/EarnVaults.d.ts +3 -3
- package/dist/internal/EarnVaults.js +5 -5
- package/dist/internal/EarnVaults.js.map +1 -1
- package/dist/internal/Fetch.d.ts +23 -0
- package/dist/internal/Fetch.d.ts.map +1 -0
- package/dist/internal/Fetch.js +26 -0
- package/dist/internal/Fetch.js.map +1 -0
- package/dist/internal/Log.d.ts +4 -2
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +16 -3
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/OpenApi.d.ts +5 -3
- package/dist/internal/OpenApi.d.ts.map +1 -1
- package/dist/internal/OpenApi.js +13 -3
- package/dist/internal/OpenApi.js.map +1 -1
- package/dist/internal/Response.d.ts +1 -1
- package/dist/internal/Response.d.ts.map +1 -1
- package/dist/internal/Schema.d.ts +6 -3
- package/dist/internal/Schema.d.ts.map +1 -1
- package/dist/internal/Schema.js +8 -2
- package/dist/internal/Schema.js.map +1 -1
- package/dist/internal/Store.d.ts +16 -3
- package/dist/internal/Store.d.ts.map +1 -1
- package/dist/internal/Store.js +82 -16
- package/dist/internal/Store.js.map +1 -1
- package/dist/internal/Tidx.d.ts.map +1 -1
- package/dist/internal/Tidx.js +7 -2
- package/dist/internal/Tidx.js.map +1 -1
- package/dist/internal/Timeout.d.ts +36 -0
- package/dist/internal/Timeout.d.ts.map +1 -0
- package/dist/internal/Timeout.js +37 -0
- package/dist/internal/Timeout.js.map +1 -0
- package/dist/internal/Timing.d.ts +9 -0
- package/dist/internal/Timing.d.ts.map +1 -1
- package/dist/internal/Timing.js +7 -0
- package/dist/internal/Timing.js.map +1 -1
- package/dist/internal/Viem.d.ts +16 -1
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Viem.js +12 -2
- package/dist/internal/Viem.js.map +1 -1
- package/dist/internal/WebhookDestination.d.ts.map +1 -1
- package/dist/internal/WebhookDestination.js +3 -0
- package/dist/internal/WebhookDestination.js.map +1 -1
- package/dist/internal/funding/Action.d.ts +9 -0
- package/dist/internal/funding/Action.d.ts.map +1 -1
- package/dist/internal/funding/Action.js +16 -8
- package/dist/internal/funding/Action.js.map +1 -1
- package/dist/internal/funding/Catalog.d.ts +9 -2
- package/dist/internal/funding/Catalog.d.ts.map +1 -1
- package/dist/internal/funding/Catalog.js +19 -8
- package/dist/internal/funding/Catalog.js.map +1 -1
- package/dist/internal/funding/DepositWebhook.d.ts.map +1 -1
- package/dist/internal/funding/DepositWebhook.js +2 -1
- package/dist/internal/funding/DepositWebhook.js.map +1 -1
- package/dist/internal/funding/Evidence.d.ts.map +1 -1
- package/dist/internal/funding/Evidence.js +2 -10
- package/dist/internal/funding/Evidence.js.map +1 -1
- package/dist/internal/funding/Provider.d.ts +108 -13
- package/dist/internal/funding/Provider.d.ts.map +1 -1
- package/dist/internal/funding/Provider.js +34 -8
- package/dist/internal/funding/Provider.js.map +1 -1
- package/dist/internal/funding/SourceObservation.d.ts.map +1 -1
- package/dist/internal/funding/SourceObservation.js +5 -7
- package/dist/internal/funding/SourceObservation.js.map +1 -1
- package/dist/internal/funding/Transfer.d.ts +114 -18
- package/dist/internal/funding/Transfer.d.ts.map +1 -1
- package/dist/internal/funding/Transfer.js +185 -55
- package/dist/internal/funding/Transfer.js.map +1 -1
- package/dist/internal/funding/TransferReconciliation.d.ts +52 -0
- package/dist/internal/funding/TransferReconciliation.d.ts.map +1 -0
- package/dist/internal/funding/TransferReconciliation.js +192 -0
- package/dist/internal/funding/TransferReconciliation.js.map +1 -0
- package/dist/internal/funding/TransferWebhook.d.ts +21 -0
- package/dist/internal/funding/TransferWebhook.d.ts.map +1 -0
- package/dist/internal/funding/TransferWebhook.js +43 -0
- package/dist/internal/funding/TransferWebhook.js.map +1 -0
- package/dist/internal/funding/index.d.ts +1 -0
- package/dist/internal/funding/index.d.ts.map +1 -1
- package/dist/internal/funding/index.js +1 -0
- package/dist/internal/funding/index.js.map +1 -1
- package/dist/internal/funding/providers/relay.d.ts.map +1 -1
- package/dist/internal/funding/providers/relay.js +3 -12
- package/dist/internal/funding/providers/relay.js.map +1 -1
- package/dist/internal/funding/providers/stargate.d.ts +127 -9
- package/dist/internal/funding/providers/stargate.d.ts.map +1 -1
- package/dist/internal/funding/providers/stargate.js +548 -112
- package/dist/internal/funding/providers/stargate.js.map +1 -1
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +1 -0
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/webhookDestinations/slack.d.ts.map +1 -1
- package/dist/internal/webhookDestinations/slack.js +16 -0
- package/dist/internal/webhookDestinations/slack.js.map +1 -1
- package/package.json +2 -2
- package/src/App.test.ts +100 -0
- package/src/App.ts +43 -3
- package/src/Client.test-d.ts +129 -2
- package/src/Scope.test.ts +20 -0
- package/src/Scope.ts +16 -0
- package/src/Webhooks.ts +2 -2
- package/src/admin/apps/api-keys.test.ts +75 -0
- package/src/admin/apps/api-keys.ts +64 -0
- package/src/admin/apps/earn-vaults.test.ts +1 -1
- package/src/admin/apps/earn-vaults.ts +2 -1
- package/src/admin/apps/organizations.test.ts +53 -1
- package/src/admin/apps/organizations.ts +90 -5
- package/src/admin/ui/src/lib/api-keys.ts +19 -0
- package/src/admin/ui/src/lib/organizations.test.ts +112 -1
- package/src/admin/ui/src/lib/organizations.ts +55 -0
- package/src/admin/ui/src/routes/api-keys.tsx +89 -2
- package/src/admin/ui/src/routes/organizations_.$orgId.tsx +116 -0
- package/src/admin/ui.generated.ts +189 -151
- package/src/apps/Zones.test.ts +7 -7
- package/src/apps/Zones.ts +7 -7
- package/src/apps/composition.test.ts +2 -1
- package/src/apps/data/App.test.ts +41 -0
- package/src/apps/data/App.ts +30 -21
- package/src/apps/data/ZoneSelection.test.ts +2 -2
- package/src/apps/data/ZoneSelection.ts +8 -8
- package/src/apps/data/routes/activities.test.ts +1526 -12
- package/src/apps/data/routes/activities.ts +1774 -1356
- package/src/apps/data/routes/balances.ts +133 -97
- package/src/apps/data/routes/blocks.test.ts +533 -0
- package/src/apps/data/routes/blocks.ts +35 -16
- package/src/apps/data/routes/earn.test.ts +373 -16
- package/src/apps/data/routes/earn.ts +548 -79
- package/src/apps/data/routes/earn.zone-access.test.ts +6 -6
- package/src/apps/data/routes/exchanges.test.ts +740 -15
- package/src/apps/data/routes/exchanges.ts +954 -753
- package/src/apps/data/routes/fee-amm.ts +17 -18
- package/src/apps/data/routes/receipts.ts +47 -16
- package/src/apps/data/routes/tokens.test.ts +578 -0
- package/src/apps/data/routes/tokens.ts +283 -225
- package/src/apps/data/routes/transactions.ts +68 -29
- package/src/apps/data/routes/transfers.test.ts +421 -0
- package/src/apps/data/routes/transfers.ts +45 -27
- package/src/apps/data/routes/valuation.ts +94 -78
- package/src/apps/data/routes/webhooks.test.ts +21 -5
- package/src/apps/data/routes/webhooks.ts +63 -8
- package/src/apps/data/routes/zones.test.ts +2 -2
- package/src/apps/data/routes/zones.ts +1 -1
- package/src/apps/funding/App.ts +12 -2
- package/src/apps/funding/routes/deposit-addresses.test.ts +29 -7
- package/src/apps/funding/routes/deposit-addresses.ts +19 -14
- package/src/apps/funding/routes/quotes.test.ts +5 -9
- package/src/apps/funding/routes/transfers.test.ts +901 -23
- package/src/apps/funding/routes/transfers.ts +347 -64
- package/src/apps/management/Billing.ts +18 -5
- package/src/apps/management/routes/api-keys.test.ts +220 -0
- package/src/apps/management/routes/api-keys.ts +280 -3
- package/src/apps/management/routes/webhooks.test.ts +3 -3
- package/src/apps/management/routes/webhooks.ts +24 -25
- package/src/apps/relay/App.test.ts +212 -1
- package/src/apps/relay/App.ts +158 -29
- package/src/apps/relay/Sponsorships.ts +24 -1
- package/src/db/Db.ts +48 -1
- package/src/db/Schema.ts +22 -4
- package/src/db/tables/earnVaults.test.ts +9 -9
- package/src/db/tables/fundingCatalog.test.ts +16 -2
- package/src/db/tables/fundingCatalog.ts +9 -3
- package/src/db/tables/fundingTransferTransactions.test.ts +43 -0
- package/src/db/tables/fundingTransferTransactions.ts +79 -3
- package/src/db/tables/fundingTransfers.test.ts +26 -0
- package/src/db/tables/fundingTransfers.ts +36 -0
- package/src/db/tables/organizations.test.ts +41 -0
- package/src/db/tables/organizations.ts +49 -0
- package/src/db/tables/projects.test.ts +55 -0
- package/src/db/tables/projects.ts +46 -1
- package/src/db/tables/sponsoredTransactions.test.ts +338 -0
- package/src/db/tables/sponsoredTransactions.ts +197 -13
- package/src/db/tables/webhookSubscriptions.ts +18 -11
- package/src/handlers/internal/utils.test.ts +53 -0
- package/src/handlers/internal/utils.ts +15 -0
- package/src/internal/Auth.ts +12 -4
- package/src/internal/EarnVaults.capabilities.test.ts +2 -2
- package/src/internal/EarnVaults.test.ts +1 -1
- package/src/internal/EarnVaults.ts +5 -5
- package/src/internal/Fetch.test.ts +46 -0
- package/src/internal/Fetch.ts +56 -0
- package/src/internal/Log.test-d.ts +2 -0
- package/src/internal/Log.test.ts +21 -0
- package/src/internal/Log.ts +22 -5
- package/src/internal/OpenApi.ts +14 -4
- package/src/internal/Response.ts +1 -1
- package/src/internal/Schema.test.ts +2 -0
- package/src/internal/Schema.ts +12 -2
- package/src/internal/Store.test.ts +178 -0
- package/src/internal/Store.ts +104 -18
- package/src/internal/Tidx.test.ts +2 -1
- package/src/internal/Tidx.ts +7 -2
- package/src/internal/Timeout.test.ts +35 -0
- package/src/internal/Timeout.ts +73 -0
- package/src/internal/Timing.ts +16 -0
- package/src/internal/Viem.ts +39 -3
- package/src/internal/WebhookDestination.ts +3 -0
- package/src/internal/Webhooks.test.ts +45 -0
- package/src/internal/funding/Action.test.ts +41 -1
- package/src/internal/funding/Action.ts +69 -41
- package/src/internal/funding/Catalog.test.ts +34 -0
- package/src/internal/funding/Catalog.ts +28 -11
- package/src/internal/funding/DepositWebhook.ts +2 -1
- package/src/internal/funding/Evidence.ts +2 -13
- package/src/internal/funding/Provider.test.ts +73 -0
- package/src/internal/funding/Provider.ts +125 -28
- package/src/internal/funding/SourceObservation.ts +5 -9
- package/src/internal/funding/Transfer.test.ts +155 -0
- package/src/internal/funding/Transfer.ts +387 -147
- package/src/internal/funding/TransferReconciliation.test.ts +147 -0
- package/src/internal/funding/TransferReconciliation.ts +264 -0
- package/src/internal/funding/TransferWebhook.test.ts +128 -0
- package/src/internal/funding/TransferWebhook.ts +67 -0
- package/src/internal/funding/index.test.ts +1 -0
- package/src/internal/funding/index.ts +1 -0
- package/src/internal/funding/providers/index.test.ts +4 -167
- package/src/internal/funding/providers/relay.test.ts +2 -2
- package/src/internal/funding/providers/relay.ts +3 -15
- package/src/internal/funding/providers/stargate.test.ts +328 -0
- package/src/internal/funding/providers/stargate.ts +807 -135
- package/src/internal/index.test.ts +1 -0
- package/src/internal/index.ts +1 -0
- package/src/internal/webhookDestinations/slack.ts +15 -0
|
@@ -22,10 +22,7 @@ const providers = [
|
|
|
22
22
|
integratorId: 'squid-integrator-id',
|
|
23
23
|
userAddress: '0x1111111111111111111111111111111111111111',
|
|
24
24
|
}),
|
|
25
|
-
Stargate.stargate(
|
|
26
|
-
apiKey: 'layerzero-api-key',
|
|
27
|
-
userAddress: '0x1111111111111111111111111111111111111111',
|
|
28
|
-
}),
|
|
25
|
+
Stargate.stargate(),
|
|
29
26
|
Symbiosis.symbiosis({ userAddress: '0x1111111111111111111111111111111111111111' }),
|
|
30
27
|
] as const
|
|
31
28
|
|
|
@@ -340,126 +337,12 @@ describe('funding providers', () => {
|
|
|
340
337
|
})
|
|
341
338
|
})
|
|
342
339
|
|
|
343
|
-
test('maps the best Stargate quote to an available quote result', async () => {
|
|
344
|
-
const requests: RecordedRequest[] = []
|
|
345
|
-
const candidate = quoteCandidate('stargate')
|
|
346
|
-
const fetch = recordingFetch(requests, async () => jsonResponse(stargateQuotes(candidate)))
|
|
347
|
-
const provider = Stargate.stargate({
|
|
348
|
-
apiKey: 'layerzero-api-key',
|
|
349
|
-
baseUrl: 'https://layerzero.test/v1/',
|
|
350
|
-
fetch,
|
|
351
|
-
now,
|
|
352
|
-
userAddress: '0x1111111111111111111111111111111111111111',
|
|
353
|
-
})
|
|
354
|
-
|
|
355
|
-
const result = await provider.getQuote(getQuoteInput(candidate), new AbortController().signal)
|
|
356
|
-
|
|
357
|
-
expect(requests).toHaveLength(1)
|
|
358
|
-
expect(requests[0]?.url.pathname).toBe('/v1/quotes')
|
|
359
|
-
expect(new Headers(requests[0]?.init?.headers).get('user-agent')).toBe('tempo-api')
|
|
360
|
-
expect(new Headers(requests[0]?.init?.headers).get('x-api-key')).toBe('layerzero-api-key')
|
|
361
|
-
expect(jsonRequestBody(requests[0])).toEqual({
|
|
362
|
-
amount: '1000000',
|
|
363
|
-
dstChainKey: 'tempo',
|
|
364
|
-
dstTokenAddress: candidate.destinationToken.address,
|
|
365
|
-
dstWalletAddress: '0x1111111111111111111111111111111111111111',
|
|
366
|
-
options: { amountType: 'EXACT_SRC_AMOUNT' },
|
|
367
|
-
srcChainKey: 'base',
|
|
368
|
-
srcTokenAddress: candidate.sourceToken.address,
|
|
369
|
-
srcWalletAddress: '0x1111111111111111111111111111111111111111',
|
|
370
|
-
})
|
|
371
|
-
expect(result).toEqual({
|
|
372
|
-
expiresAt: '2026-01-01T00:01:00.000Z',
|
|
373
|
-
destinationAmountMin: '999100',
|
|
374
|
-
destinationAmount: '999600',
|
|
375
|
-
quality: {
|
|
376
|
-
estimatedSeconds: 259,
|
|
377
|
-
liquiditySource: 'providerQuote',
|
|
378
|
-
sourceDetail: 'stargate:value-transfer-v1:bus',
|
|
379
|
-
tier: 'liquid',
|
|
380
|
-
},
|
|
381
|
-
sampledAt: '2026-01-01T00:00:00.000Z',
|
|
382
|
-
status: 'available',
|
|
383
|
-
})
|
|
384
|
-
})
|
|
385
|
-
|
|
386
|
-
test('skips expired Stargate alternatives', async () => {
|
|
387
|
-
const candidate = quoteCandidate('stargate')
|
|
388
|
-
const response = stargateQuotes(candidate)
|
|
389
|
-
response.quotes[2]!.expiresAt = '2026-01-01T00:00:00.000Z'
|
|
390
|
-
const provider = Stargate.stargate({
|
|
391
|
-
apiKey: 'layerzero-api-key',
|
|
392
|
-
fetch: recordingFetch([], async () => jsonResponse(response)),
|
|
393
|
-
now,
|
|
394
|
-
userAddress: '0x1111111111111111111111111111111111111111',
|
|
395
|
-
})
|
|
396
|
-
|
|
397
|
-
await expect(
|
|
398
|
-
provider.getQuote(getQuoteInput(candidate), new AbortController().signal),
|
|
399
|
-
).resolves.toMatchObject({
|
|
400
|
-
destinationAmountMin: '999000',
|
|
401
|
-
destinationAmount: '999500',
|
|
402
|
-
quality: {
|
|
403
|
-
sourceDetail: 'stargate:value-transfer-v1:taxi',
|
|
404
|
-
tier: 'liquid',
|
|
405
|
-
},
|
|
406
|
-
status: 'available',
|
|
407
|
-
})
|
|
408
|
-
})
|
|
409
|
-
|
|
410
340
|
test('exposes Base and Ethereum Stargate quote candidates', () => {
|
|
411
341
|
expect(
|
|
412
342
|
['base', 'ethereum'].map((sourceChain) => quoteCandidate('stargate', { sourceChain }).id),
|
|
413
343
|
).toEqual(['base-usdc-tempo-usdce-stargate', 'ethereum-usdc-tempo-usdce-stargate'])
|
|
414
344
|
})
|
|
415
345
|
|
|
416
|
-
test('maps responses without Stargate routes to unavailable quote results', async () => {
|
|
417
|
-
const candidate = quoteCandidate('stargate')
|
|
418
|
-
const response = stargateQuotes(candidate)
|
|
419
|
-
response.quotes = response.quotes.filter((quote) => quote.routeSteps[0]?.type === 'CCTP')
|
|
420
|
-
const provider = Stargate.stargate({
|
|
421
|
-
apiKey: 'layerzero-api-key',
|
|
422
|
-
fetch: recordingFetch([], async () => jsonResponse(response)),
|
|
423
|
-
now,
|
|
424
|
-
userAddress: '0x1111111111111111111111111111111111111111',
|
|
425
|
-
})
|
|
426
|
-
|
|
427
|
-
await expect(
|
|
428
|
-
provider.getQuote(getQuoteInput(candidate), new AbortController().signal),
|
|
429
|
-
).resolves.toMatchObject({
|
|
430
|
-
quality: {
|
|
431
|
-
sourceDetail: 'stargate:value-transfer-v1:NO_STARGATE_ROUTE',
|
|
432
|
-
tier: 'unavailable',
|
|
433
|
-
},
|
|
434
|
-
status: 'unavailable',
|
|
435
|
-
})
|
|
436
|
-
})
|
|
437
|
-
|
|
438
|
-
test('rejects malformed Stargate quotes', async () => {
|
|
439
|
-
const candidate = quoteCandidate('stargate')
|
|
440
|
-
const response = stargateQuotes(candidate)
|
|
441
|
-
response.quotes[2]!.srcAmount = '1'
|
|
442
|
-
const provider = Stargate.stargate({
|
|
443
|
-
apiKey: 'layerzero-api-key',
|
|
444
|
-
fetch: recordingFetch([], async () => jsonResponse(response)),
|
|
445
|
-
now,
|
|
446
|
-
userAddress: '0x1111111111111111111111111111111111111111',
|
|
447
|
-
})
|
|
448
|
-
|
|
449
|
-
await expect(
|
|
450
|
-
provider.getQuote(getQuoteInput(candidate), new AbortController().signal),
|
|
451
|
-
).rejects.toThrowErrorMatchingInlineSnapshot(`[FundingProvider.ProviderPayloadError]`)
|
|
452
|
-
})
|
|
453
|
-
|
|
454
|
-
test('rejects invalid Stargate configuration', () => {
|
|
455
|
-
expect(() =>
|
|
456
|
-
Stargate.stargate({
|
|
457
|
-
apiKey: '',
|
|
458
|
-
userAddress: '0x1111111111111111111111111111111111111111',
|
|
459
|
-
}),
|
|
460
|
-
).toThrowErrorMatchingInlineSnapshot(`[FundingProvider.ProviderConfigurationError]`)
|
|
461
|
-
})
|
|
462
|
-
|
|
463
346
|
test('maps successful Symbiosis quotes to available quote results', async () => {
|
|
464
347
|
const requests: RecordedRequest[] = []
|
|
465
348
|
const candidate = quoteCandidate('symbiosis')
|
|
@@ -1086,29 +969,17 @@ describe('funding providers', () => {
|
|
|
1086
969
|
})
|
|
1087
970
|
})
|
|
1088
971
|
|
|
1089
|
-
test('returns bounded Stargate failure diagnostics',
|
|
1090
|
-
const candidate = quoteCandidate('stargate')
|
|
1091
|
-
const provider = Stargate.stargate({
|
|
1092
|
-
apiKey: 'layerzero-api-key',
|
|
1093
|
-
fetch: recordingFetch([], async () => jsonResponse({ message: 'Unauthorized' }, 401)),
|
|
1094
|
-
now,
|
|
1095
|
-
userAddress: '0x1111111111111111111111111111111111111111',
|
|
1096
|
-
})
|
|
1097
|
-
const cause = await provider
|
|
1098
|
-
.getQuote(getQuoteInput(candidate), new AbortController().signal)
|
|
1099
|
-
.catch((error: unknown) => error)
|
|
1100
|
-
|
|
972
|
+
test('returns bounded Stargate failure diagnostics', () => {
|
|
1101
973
|
expect(
|
|
1102
974
|
FundingProvider.failure({
|
|
1103
|
-
cause,
|
|
975
|
+
cause: new TypeError('network failure'),
|
|
1104
976
|
operation: 'getQuote',
|
|
1105
977
|
provider: getProvider('stargate'),
|
|
1106
978
|
}),
|
|
1107
979
|
).toEqual({
|
|
1108
|
-
failure: '
|
|
980
|
+
failure: 'network',
|
|
1109
981
|
id: 'stargate',
|
|
1110
982
|
operation: 'getQuote',
|
|
1111
|
-
status: 401,
|
|
1112
983
|
})
|
|
1113
984
|
})
|
|
1114
985
|
|
|
@@ -1210,40 +1081,6 @@ function squidQuote(candidate: FundingProvider.getQuote.Parameters['candidate'])
|
|
|
1210
1081
|
}
|
|
1211
1082
|
}
|
|
1212
1083
|
|
|
1213
|
-
function stargateQuotes(candidate: FundingProvider.getQuote.Parameters['candidate']) {
|
|
1214
|
-
return {
|
|
1215
|
-
error: null,
|
|
1216
|
-
quotes: [
|
|
1217
|
-
{
|
|
1218
|
-
dstAmount: '999900',
|
|
1219
|
-
dstAmountMin: '999800',
|
|
1220
|
-
duration: { estimated: '10000' },
|
|
1221
|
-
id: 'quote-cctp',
|
|
1222
|
-
routeSteps: [{ srcChainKey: 'base', type: 'CCTP' }],
|
|
1223
|
-
srcAmount: candidate.sourceAmount.amount,
|
|
1224
|
-
},
|
|
1225
|
-
{
|
|
1226
|
-
dstAmount: '999500',
|
|
1227
|
-
dstAmountMin: '999000',
|
|
1228
|
-
duration: { estimated: '27600' },
|
|
1229
|
-
expiresAt: '2026-01-01T00:01:00.000Z',
|
|
1230
|
-
id: 'quote-stargate-taxi',
|
|
1231
|
-
routeSteps: [{ srcChainKey: 'base', type: 'STARGATE_V2_TAXI' }],
|
|
1232
|
-
srcAmount: candidate.sourceAmount.amount,
|
|
1233
|
-
},
|
|
1234
|
-
{
|
|
1235
|
-
dstAmount: '999600',
|
|
1236
|
-
dstAmountMin: '999100',
|
|
1237
|
-
duration: { estimated: '258899.99999999997' },
|
|
1238
|
-
expiresAt: '2026-01-01T00:01:00.000Z',
|
|
1239
|
-
id: 'quote-stargate-bus',
|
|
1240
|
-
routeSteps: [{ srcChainKey: 'base', type: 'STARGATE_V2_BUS' }],
|
|
1241
|
-
srcAmount: candidate.sourceAmount.amount,
|
|
1242
|
-
},
|
|
1243
|
-
],
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
1084
|
function symbiosisQuote(candidate: FundingProvider.getQuote.Parameters['candidate']) {
|
|
1248
1085
|
const source =
|
|
1249
1086
|
candidate.sourceChain.kind === 'tron'
|
|
@@ -147,8 +147,8 @@ describe.skipIf(!apiKey)('relay.prepareTransfer (live)', () => {
|
|
|
147
147
|
expect(call.data).toMatch(/^0x[0-9a-fA-F]*$/)
|
|
148
148
|
expect(call.value).toBe('0x0')
|
|
149
149
|
}
|
|
150
|
-
expect(result.correlation
|
|
151
|
-
expect(result.correlation
|
|
150
|
+
expect(result.correlation?.requestId).toMatch(/^0x[0-9a-f]{64}$/)
|
|
151
|
+
expect(result.correlation?.checkEndpoint).toContain('/intents/status/v3')
|
|
152
152
|
expect(BigInt(result.destinationAmount) > 0n).toBe(true)
|
|
153
153
|
expect(BigInt(result.destinationAmountMin) > 0n).toBe(true)
|
|
154
154
|
expect(BigInt(result.destinationAmountMin) <= BigInt(result.destinationAmount)).toBe(true)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { AbiEvent, AbiFunction, Address, Base58, Bytes, Hash, Hex
|
|
2
|
-
import { createClient, custom, fallback } from 'viem'
|
|
1
|
+
import { AbiEvent, AbiFunction, Address, Base58, Bytes, Hash, Hex } from 'ox'
|
|
3
2
|
import { getBlockNumber, getLogs, getTransaction, getTransactionReceipt } from 'viem/actions'
|
|
4
3
|
import * as z from 'zod/mini'
|
|
5
4
|
|
|
@@ -820,7 +819,7 @@ function createDepositAddressObserver(
|
|
|
820
819
|
const stored = schema.DeliveryObservation.safeParse(parameters.providerState)
|
|
821
820
|
const sourceObservation = await (async () => {
|
|
822
821
|
if (stored.success) return stored.data.relay
|
|
823
|
-
const sourceClient =
|
|
822
|
+
const sourceClient = Viem.createEvmClient({ fetch: options.fetch, urls: sourceUrls })
|
|
824
823
|
const sourceReceipt = await getTransactionReceipt(sourceClient, {
|
|
825
824
|
hash: parameters.source.transactionHash as Hex.Hex,
|
|
826
825
|
})
|
|
@@ -868,7 +867,7 @@ function createDepositAddressObserver(
|
|
|
868
867
|
})()
|
|
869
868
|
if (!sourceObservation) return { type: 'pending' }
|
|
870
869
|
|
|
871
|
-
const destinationClient =
|
|
870
|
+
const destinationClient = Viem.createEvmClient({ fetch: options.fetch, urls: destinationUrls })
|
|
872
871
|
const destinationHead = await getBlockNumber(destinationClient, { cacheTime: 0 })
|
|
873
872
|
const destinationLogs = await getLogs(destinationClient, {
|
|
874
873
|
address: parameters.destinationToken.address as Address.Address,
|
|
@@ -1001,17 +1000,6 @@ function decodeEvent<const event extends AbiEvent.AbiEvent>(
|
|
|
1001
1000
|
}
|
|
1002
1001
|
}
|
|
1003
1002
|
|
|
1004
|
-
function jsonRpcClient(options: { fetch: FundingProvider.Fetch; urls: readonly string[] }) {
|
|
1005
|
-
return createClient({
|
|
1006
|
-
transport: fallback(
|
|
1007
|
-
options.urls.map((url) => {
|
|
1008
|
-
const transport = RpcTransport.fromHttp(url, { fetchFn: options.fetch })
|
|
1009
|
-
return custom(transport, { retryCount: 0 })
|
|
1010
|
-
}),
|
|
1011
|
-
),
|
|
1012
|
-
})
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
1003
|
function minimum(left: bigint, right: bigint): bigint {
|
|
1016
1004
|
return left < right ? left : right
|
|
1017
1005
|
}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { AbiFunction, Hex } from 'ox'
|
|
2
|
+
import { base } from 'viem/chains'
|
|
3
|
+
import { tempoMainnet } from 'viem/tempo/chains'
|
|
4
|
+
|
|
5
|
+
import * as Anvil from '../../../../test/Anvil.js'
|
|
6
|
+
|
|
7
|
+
import type * as Action from '../Action.js'
|
|
8
|
+
import type * as Catalog from '../Catalog.js'
|
|
9
|
+
import * as FundingChain from '../Chain.js'
|
|
10
|
+
import * as FundingProvider from '../Provider.js'
|
|
11
|
+
import * as Stargate from './stargate.js'
|
|
12
|
+
|
|
13
|
+
const amount = 1_000_000n
|
|
14
|
+
const destinationPool = '0x8c76e2f6c5ceda9aa7772e7eff30280226c44392'
|
|
15
|
+
const destinationToken = '0x20C000000000000000000000b9537d11c60E8b50'
|
|
16
|
+
const nativeFee = 10_000n
|
|
17
|
+
const otherAddress = '0x9999999999999999999999999999999999999999'
|
|
18
|
+
const pool = '0x27a16dc786820B16E5c9028b75B99F6f604b5d26'
|
|
19
|
+
const recipient = '0x1111111111111111111111111111111111111111'
|
|
20
|
+
const sender = '0x2222222222222222222222222222222222222222'
|
|
21
|
+
const sourceToken = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
|
|
22
|
+
const sourceTransactionHash = '0xfd71359adf5095f2ab512a19e0a2df6c8cc0db14ac8a52286d61287daabdccd4'
|
|
23
|
+
const validAfter = '2020-01-01T00:00:00.000Z'
|
|
24
|
+
const destinationTransactionHash =
|
|
25
|
+
'0x3dfaba0a78b8f4bc09e55e05211c8120729e7b6879efe32613883befbca666da'
|
|
26
|
+
const guid = '0x5549d117c8b23f0ecdf05c2604ed989cf0034f378707bd81319e93834f2f85f2'
|
|
27
|
+
|
|
28
|
+
const approve = AbiFunction.from('function approve(address spender, uint256 amount)')
|
|
29
|
+
const sendToken = AbiFunction.from(
|
|
30
|
+
'function sendToken((uint32 dstEid, bytes32 to, uint256 amountLD, uint256 minAmountLD, bytes extraOptions, bytes composeMsg, bytes oftCmd) sendParam, (uint256 nativeFee, uint256 lzTokenFee) fee, address refundAddress) payable returns ((bytes32 guid, uint64 nonce, (uint256 nativeFee, uint256 lzTokenFee) fee) msgReceipt, (uint256 amountSentLD, uint256 amountReceivedLD) oftReceipt, (uint72 ticketId, bytes passengerBytes) ticket)',
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
describe('stargate', () => {
|
|
34
|
+
test('creates a credential-free quote and transfer provider', () => {
|
|
35
|
+
expect(Stargate.stargate()).toMatchObject({
|
|
36
|
+
getQuote: expect.any(Function),
|
|
37
|
+
id: 'stargate',
|
|
38
|
+
name: 'Stargate',
|
|
39
|
+
prepareTransfer: expect.any(Function),
|
|
40
|
+
verifySourceTransaction: expect.any(Function),
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
describe('validateAction', () => {
|
|
46
|
+
test('accepts the exact approval and Taxi send calls', () => {
|
|
47
|
+
expect(validate(action())).toEqual([{ to: pool, value: Hex.fromNumber(nativeFee) }])
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
test('rejects calls outside the curated Stargate route', () => {
|
|
51
|
+
const invalid = [
|
|
52
|
+
action({ approvalAmount: amount + 1n }),
|
|
53
|
+
action({ approvalSpender: otherAddress }),
|
|
54
|
+
action({ composeMsg: '0x01' }),
|
|
55
|
+
action({ destinationEid: 1 }),
|
|
56
|
+
action({ executionTarget: otherAddress }),
|
|
57
|
+
action({ extraOptions: '0x01' }),
|
|
58
|
+
action({ lzTokenFee: 1n }),
|
|
59
|
+
action({ minimumAmount: amount - 1n }),
|
|
60
|
+
action({ oftCmd: '0x01' }),
|
|
61
|
+
action({ recipient: otherAddress }),
|
|
62
|
+
action({ refundAddress: otherAddress }),
|
|
63
|
+
action({ sourceAmount: amount + 1n }),
|
|
64
|
+
]
|
|
65
|
+
for (const candidate of invalid)
|
|
66
|
+
expect(() => validate(candidate)).toThrowError(FundingProvider.ProviderPayloadError)
|
|
67
|
+
expect(() => validate(action(), { sourceTokenAddress: otherAddress })).toThrowError(
|
|
68
|
+
FundingProvider.ProviderPayloadError,
|
|
69
|
+
)
|
|
70
|
+
expect(() => validate(action(), { destinationTokenAddress: otherAddress })).toThrowError(
|
|
71
|
+
FundingProvider.ProviderPayloadError,
|
|
72
|
+
)
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
test('rejects malformed selectors and mismatched native value', () => {
|
|
76
|
+
const malformed = action()
|
|
77
|
+
malformed.calls[1]!.data = '0xdeadbeef'
|
|
78
|
+
expect(() => validate(malformed)).toThrowError(FundingProvider.ProviderPayloadError)
|
|
79
|
+
|
|
80
|
+
const mismatched = action()
|
|
81
|
+
mismatched.calls[1]!.value = Hex.fromNumber(nativeFee + 1n)
|
|
82
|
+
expect(() => validate(mismatched)).toThrowError(FundingProvider.ProviderPayloadError)
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
test('rejects missing or mismatched route configuration', () => {
|
|
86
|
+
expect(() =>
|
|
87
|
+
Stargate.validateAction({
|
|
88
|
+
action: action(),
|
|
89
|
+
destinationTokenAddress: destinationToken,
|
|
90
|
+
recipient,
|
|
91
|
+
sender,
|
|
92
|
+
sourceAmount: amount.toString(),
|
|
93
|
+
sourceChainId: 'eip155:8453',
|
|
94
|
+
sourceTokenAddress: sourceToken,
|
|
95
|
+
}),
|
|
96
|
+
).toThrowError(FundingProvider.ProviderPayloadError)
|
|
97
|
+
expect(() =>
|
|
98
|
+
validate(action(), {
|
|
99
|
+
configuration: {
|
|
100
|
+
destinationPoolAddress: destinationPool,
|
|
101
|
+
poolAddress: otherAddress,
|
|
102
|
+
sourceEid: 30_184,
|
|
103
|
+
},
|
|
104
|
+
}),
|
|
105
|
+
).toThrowError(FundingProvider.ProviderPayloadError)
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
describe.skipIf(!Anvil.available)('source and destination evidence', () => {
|
|
110
|
+
const bridgedAmount = '200000'
|
|
111
|
+
const bridgedRecipient = '0x7212623e4cff9ad010d28aa065fad2bf58578783'
|
|
112
|
+
const bridgedSender = '0x52b650a62e384f68880d0a1dc2b84dfed47d5660'
|
|
113
|
+
const configuration = {
|
|
114
|
+
destinationPoolAddress: destinationPool,
|
|
115
|
+
poolAddress: pool,
|
|
116
|
+
sourceEid: 30_184,
|
|
117
|
+
}
|
|
118
|
+
let destinationChain: FundingChain.Chain
|
|
119
|
+
let destination: Anvil.start.ReturnType
|
|
120
|
+
let sourceChain: FundingChain.Chain
|
|
121
|
+
let source: Anvil.start.ReturnType
|
|
122
|
+
|
|
123
|
+
beforeAll(async () => {
|
|
124
|
+
;[destination, source] = await Promise.all([
|
|
125
|
+
Anvil.start({ chain: tempoMainnet, forkUrl: tempoMainnet.rpcUrls.default.http[0]! }),
|
|
126
|
+
Anvil.start({ chain: base, forkUrl: base.rpcUrls.default.http[0]! }),
|
|
127
|
+
])
|
|
128
|
+
destinationChain = FundingChain.from({
|
|
129
|
+
id: 'eip155:4217',
|
|
130
|
+
name: 'Tempo',
|
|
131
|
+
rpcUrls: [destination.rpcUrl],
|
|
132
|
+
slug: 'tempo',
|
|
133
|
+
})
|
|
134
|
+
sourceChain = FundingChain.from({
|
|
135
|
+
id: 'eip155:8453',
|
|
136
|
+
name: 'Base',
|
|
137
|
+
rpcUrls: [source.rpcUrl],
|
|
138
|
+
slug: 'base',
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
afterAll(async () => {
|
|
143
|
+
await Promise.all([destination?.stop(), source?.stop()])
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
test('verifies a direct Base Stargate send and its LayerZero GUID', async () => {
|
|
147
|
+
const receipt = await source.client.getTransactionReceipt({ hash: sourceTransactionHash })
|
|
148
|
+
await expect(
|
|
149
|
+
Stargate.verifySourceTransaction({
|
|
150
|
+
configuration,
|
|
151
|
+
destinationTokenAddress: destinationToken,
|
|
152
|
+
recipient: bridgedRecipient,
|
|
153
|
+
sender: bridgedSender,
|
|
154
|
+
sourceAmount: bridgedAmount,
|
|
155
|
+
sourceChain,
|
|
156
|
+
sourceTokenAddress: sourceToken,
|
|
157
|
+
transactionHash: sourceTransactionHash,
|
|
158
|
+
validAfter,
|
|
159
|
+
}),
|
|
160
|
+
).resolves.toEqual({
|
|
161
|
+
guid,
|
|
162
|
+
sourceBlock: { hash: receipt.blockHash, number: receipt.blockNumber },
|
|
163
|
+
sourceEid: 30_184,
|
|
164
|
+
type: 'verified',
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
test('keeps missing transactions pending and rejects mismatched terms', async () => {
|
|
169
|
+
const options = {
|
|
170
|
+
configuration,
|
|
171
|
+
destinationTokenAddress: destinationToken,
|
|
172
|
+
recipient: bridgedRecipient,
|
|
173
|
+
sender: bridgedSender,
|
|
174
|
+
sourceAmount: bridgedAmount,
|
|
175
|
+
sourceChain,
|
|
176
|
+
sourceTokenAddress: sourceToken,
|
|
177
|
+
transactionHash: sourceTransactionHash,
|
|
178
|
+
validAfter,
|
|
179
|
+
}
|
|
180
|
+
await expect(
|
|
181
|
+
Stargate.verifySourceTransaction({
|
|
182
|
+
...options,
|
|
183
|
+
transactionHash: `0x${'99'.repeat(32)}`,
|
|
184
|
+
}),
|
|
185
|
+
).resolves.toEqual({ type: 'pending' })
|
|
186
|
+
await expect(
|
|
187
|
+
Stargate.verifySourceTransaction({ ...options, recipient: otherAddress }),
|
|
188
|
+
).resolves.toEqual({ type: 'invalid' })
|
|
189
|
+
await expect(
|
|
190
|
+
Stargate.verifySourceTransaction({ ...options, validAfter: '2099-01-01T00:00:00.000Z' }),
|
|
191
|
+
).resolves.toEqual({ type: 'invalid' })
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
test('rejects reverted and malformed source transactions', async () => {
|
|
195
|
+
const account = Anvil.getAccount(1)
|
|
196
|
+
const reverted = await source.client.sendTransactionSync({
|
|
197
|
+
account,
|
|
198
|
+
data: '0xdeadbeef',
|
|
199
|
+
gas: 100_000n,
|
|
200
|
+
to: pool,
|
|
201
|
+
})
|
|
202
|
+
const malformed = await source.client.sendTransactionSync({
|
|
203
|
+
account,
|
|
204
|
+
data: '0xdeadbeef',
|
|
205
|
+
gas: 100_000n,
|
|
206
|
+
to: account.address,
|
|
207
|
+
})
|
|
208
|
+
const options = {
|
|
209
|
+
configuration,
|
|
210
|
+
destinationTokenAddress: destinationToken,
|
|
211
|
+
recipient: bridgedRecipient,
|
|
212
|
+
sender: account.address,
|
|
213
|
+
sourceAmount: bridgedAmount,
|
|
214
|
+
sourceChain,
|
|
215
|
+
sourceTokenAddress: sourceToken,
|
|
216
|
+
validAfter,
|
|
217
|
+
}
|
|
218
|
+
await expect(
|
|
219
|
+
Stargate.verifySourceTransaction({
|
|
220
|
+
...options,
|
|
221
|
+
transactionHash: reverted.transactionHash,
|
|
222
|
+
}),
|
|
223
|
+
).resolves.toEqual({ type: 'invalid' })
|
|
224
|
+
await expect(
|
|
225
|
+
Stargate.verifySourceTransaction({
|
|
226
|
+
...options,
|
|
227
|
+
transactionHash: malformed.transactionHash,
|
|
228
|
+
}),
|
|
229
|
+
).resolves.toEqual({ type: 'invalid' })
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
test('discovers and verifies the exact Tempo USDC.e delivery', async () => {
|
|
233
|
+
const receipt = await destination.client.getTransactionReceipt({
|
|
234
|
+
hash: destinationTransactionHash,
|
|
235
|
+
})
|
|
236
|
+
await expect(
|
|
237
|
+
Stargate.verifyDestinationDelivery({
|
|
238
|
+
configuration,
|
|
239
|
+
destinationAmount: bridgedAmount,
|
|
240
|
+
destinationBlockNumber: receipt.blockNumber.toString(),
|
|
241
|
+
destinationChain,
|
|
242
|
+
destinationTokenAddress: destinationToken,
|
|
243
|
+
guid,
|
|
244
|
+
recipient: bridgedRecipient,
|
|
245
|
+
sourceChainId: 'eip155:8453',
|
|
246
|
+
sourceTokenAddress: sourceToken,
|
|
247
|
+
}),
|
|
248
|
+
).resolves.toEqual({ transactionHash: destinationTransactionHash, type: 'verified' })
|
|
249
|
+
})
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
function action(options: action.Options = {}): Action.EvmCalls {
|
|
253
|
+
const executionFee = options.nativeFee ?? nativeFee
|
|
254
|
+
const sendParam = {
|
|
255
|
+
amountLD: options.sourceAmount ?? amount,
|
|
256
|
+
composeMsg: options.composeMsg ?? '0x',
|
|
257
|
+
dstEid: options.destinationEid ?? 30_410,
|
|
258
|
+
extraOptions: options.extraOptions ?? '0x',
|
|
259
|
+
minAmountLD: options.minimumAmount ?? amount,
|
|
260
|
+
oftCmd: options.oftCmd ?? '0x',
|
|
261
|
+
to: Hex.padLeft(options.recipient ?? recipient, 32),
|
|
262
|
+
} as const
|
|
263
|
+
return {
|
|
264
|
+
calls: [
|
|
265
|
+
{
|
|
266
|
+
data: AbiFunction.encodeData(approve, [
|
|
267
|
+
options.approvalSpender ?? pool,
|
|
268
|
+
options.approvalAmount ?? amount,
|
|
269
|
+
]),
|
|
270
|
+
to: sourceToken,
|
|
271
|
+
value: '0x0',
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
data: AbiFunction.encodeData(sendToken, [
|
|
275
|
+
sendParam,
|
|
276
|
+
{ lzTokenFee: options.lzTokenFee ?? 0n, nativeFee: executionFee },
|
|
277
|
+
options.refundAddress ?? sender,
|
|
278
|
+
]),
|
|
279
|
+
to: options.executionTarget ?? pool,
|
|
280
|
+
value: Hex.fromNumber(executionFee),
|
|
281
|
+
},
|
|
282
|
+
],
|
|
283
|
+
type: 'evm:calls',
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
declare namespace action {
|
|
288
|
+
type Options = {
|
|
289
|
+
approvalAmount?: bigint | undefined
|
|
290
|
+
approvalSpender?: `0x${string}` | undefined
|
|
291
|
+
composeMsg?: Hex.Hex | undefined
|
|
292
|
+
destinationEid?: number | undefined
|
|
293
|
+
executionTarget?: `0x${string}` | undefined
|
|
294
|
+
extraOptions?: Hex.Hex | undefined
|
|
295
|
+
lzTokenFee?: bigint | undefined
|
|
296
|
+
minimumAmount?: bigint | undefined
|
|
297
|
+
nativeFee?: bigint | undefined
|
|
298
|
+
oftCmd?: Hex.Hex | undefined
|
|
299
|
+
recipient?: Hex.Hex | undefined
|
|
300
|
+
refundAddress?: `0x${string}` | undefined
|
|
301
|
+
sourceAmount?: bigint | undefined
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function validate(candidate: Action.EvmCalls, options: validate.Options = {}) {
|
|
306
|
+
return Stargate.validateAction({
|
|
307
|
+
action: candidate,
|
|
308
|
+
configuration: options.configuration ?? {
|
|
309
|
+
destinationPoolAddress: destinationPool,
|
|
310
|
+
poolAddress: pool,
|
|
311
|
+
sourceEid: 30_184,
|
|
312
|
+
},
|
|
313
|
+
destinationTokenAddress: options.destinationTokenAddress ?? destinationToken,
|
|
314
|
+
recipient,
|
|
315
|
+
sender,
|
|
316
|
+
sourceAmount: amount.toString(),
|
|
317
|
+
sourceChainId: 'eip155:8453',
|
|
318
|
+
sourceTokenAddress: options.sourceTokenAddress ?? sourceToken,
|
|
319
|
+
})
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
declare namespace validate {
|
|
323
|
+
type Options = {
|
|
324
|
+
configuration?: Catalog.Configuration | undefined
|
|
325
|
+
destinationTokenAddress?: string | undefined
|
|
326
|
+
sourceTokenAddress?: string | undefined
|
|
327
|
+
}
|
|
328
|
+
}
|