tapimo 0.10.2 → 0.12.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 +4896 -2166
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +2 -2
- package/dist/App.js.map +1 -1
- package/dist/Assets.d.ts +15 -0
- package/dist/Assets.d.ts.map +1 -1
- package/dist/Assets.js +7 -0
- package/dist/Assets.js.map +1 -1
- package/dist/Webhooks.d.ts +0 -75
- package/dist/Webhooks.d.ts.map +1 -1
- package/dist/Webhooks.js +1 -143
- package/dist/Webhooks.js.map +1 -1
- package/dist/admin/App.d.ts +127 -78
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/apps/earn-vaults.d.ts +115 -1
- package/dist/admin/apps/earn-vaults.d.ts.map +1 -1
- package/dist/admin/apps/earn-vaults.js +59 -6
- package/dist/admin/apps/earn-vaults.js.map +1 -1
- package/dist/admin/apps/organizations.d.ts +3 -3
- package/dist/admin/apps/organizations.d.ts.map +1 -1
- package/dist/admin/apps/organizations.js +4 -2
- package/dist/admin/apps/organizations.js.map +1 -1
- package/dist/admin/apps/verified-tokens.d.ts +83 -83
- 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/data/App.d.ts +5924 -4310
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/App.js +61 -9
- package/dist/apps/data/App.js.map +1 -1
- package/dist/apps/data/ZoneSelection.d.ts +62 -0
- package/dist/apps/data/ZoneSelection.d.ts.map +1 -0
- package/dist/apps/data/ZoneSelection.js +44 -0
- package/dist/apps/data/ZoneSelection.js.map +1 -0
- package/dist/apps/data/routes/activities.d.ts +2368 -5
- package/dist/apps/data/routes/activities.d.ts.map +1 -1
- package/dist/apps/data/routes/activities.js +423 -114
- package/dist/apps/data/routes/activities.js.map +1 -1
- package/dist/apps/data/routes/addresses.d.ts +131 -0
- package/dist/apps/data/routes/addresses.d.ts.map +1 -1
- package/dist/apps/data/routes/balances.d.ts +25 -25
- package/dist/apps/data/routes/balances.js +1 -1
- package/dist/apps/data/routes/balances.js.map +1 -1
- package/dist/apps/data/routes/blocks.d.ts +1 -1
- package/dist/apps/data/routes/blocks.js +1 -1
- package/dist/apps/data/routes/blocks.js.map +1 -1
- package/dist/apps/data/routes/earn.d.ts +135 -10
- package/dist/apps/data/routes/earn.d.ts.map +1 -1
- package/dist/apps/data/routes/earn.js +157 -25
- package/dist/apps/data/routes/earn.js.map +1 -1
- package/dist/apps/data/routes/exchanges.d.ts +829 -123
- package/dist/apps/data/routes/exchanges.d.ts.map +1 -1
- package/dist/apps/data/routes/exchanges.js +16 -13
- package/dist/apps/data/routes/exchanges.js.map +1 -1
- package/dist/apps/data/routes/fee-amm.d.ts +26 -26
- package/dist/apps/data/routes/fee-amm.d.ts.map +1 -1
- package/dist/apps/data/routes/fee-amm.js +9 -11
- package/dist/apps/data/routes/fee-amm.js.map +1 -1
- package/dist/apps/data/routes/receipts.d.ts +54 -54
- package/dist/apps/data/routes/receipts.js +1 -1
- package/dist/apps/data/routes/receipts.js.map +1 -1
- package/dist/apps/data/routes/rpc.js +24 -10
- package/dist/apps/data/routes/rpc.js.map +1 -1
- package/dist/apps/data/routes/tokenlist.d.ts +12 -12
- package/dist/apps/data/routes/tokenlist.d.ts.map +1 -1
- package/dist/apps/data/routes/tokenlist.js +16 -15
- package/dist/apps/data/routes/tokenlist.js.map +1 -1
- package/dist/apps/data/routes/tokens.d.ts +17 -3
- package/dist/apps/data/routes/tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/tokens.js +34 -15
- package/dist/apps/data/routes/tokens.js.map +1 -1
- package/dist/apps/data/routes/transactions.d.ts +1 -1
- package/dist/apps/data/routes/transactions.js +1 -1
- 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 +7 -9
- package/dist/apps/data/routes/transfers.js.map +1 -1
- package/dist/apps/data/routes/valuation.d.ts +21 -21
- package/dist/apps/data/routes/verified-tokens.d.ts +5 -5
- package/dist/apps/data/routes/webhooks.d.ts +1011 -151
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +126 -739
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/data/routes/zones.d.ts +15 -15
- package/dist/apps/funding/App.d.ts +27 -27
- package/dist/apps/funding/routes/chains.d.ts.map +1 -1
- package/dist/apps/funding/routes/chains.js +5 -4
- package/dist/apps/funding/routes/chains.js.map +1 -1
- package/dist/apps/funding/routes/deposit-addresses.d.ts +18 -18
- package/dist/apps/funding/routes/deposit-addresses.d.ts.map +1 -1
- package/dist/apps/funding/routes/deposit-addresses.js +8 -8
- package/dist/apps/funding/routes/deposit-addresses.js.map +1 -1
- package/dist/apps/funding/routes/providers.d.ts.map +1 -1
- package/dist/apps/funding/routes/providers.js +3 -2
- package/dist/apps/funding/routes/providers.js.map +1 -1
- package/dist/apps/funding/routes/quotes.d.ts.map +1 -1
- package/dist/apps/funding/routes/quotes.js +2 -2
- package/dist/apps/funding/routes/quotes.js.map +1 -1
- package/dist/apps/funding/routes/transfers.d.ts +33 -33
- package/dist/apps/management/App.d.ts +1433 -322
- package/dist/apps/management/App.d.ts.map +1 -1
- package/dist/apps/management/Billing.d.ts.map +1 -1
- package/dist/apps/management/Billing.js +19 -6
- package/dist/apps/management/Billing.js.map +1 -1
- package/dist/apps/management/routes/api-keys.d.ts +154 -94
- package/dist/apps/management/routes/api-keys.d.ts.map +1 -1
- package/dist/apps/management/routes/api-keys.js +76 -30
- package/dist/apps/management/routes/api-keys.js.map +1 -1
- package/dist/apps/management/routes/billing.d.ts +103 -30
- package/dist/apps/management/routes/billing.d.ts.map +1 -1
- package/dist/apps/management/routes/billing.js +91 -32
- package/dist/apps/management/routes/billing.js.map +1 -1
- package/dist/apps/management/routes/faucet.d.ts +12 -12
- package/dist/apps/management/routes/faucet.d.ts.map +1 -1
- package/dist/apps/management/routes/faucet.js +23 -12
- package/dist/apps/management/routes/faucet.js.map +1 -1
- package/dist/apps/management/routes/invitations.d.ts +46 -13
- package/dist/apps/management/routes/invitations.d.ts.map +1 -1
- package/dist/apps/management/routes/invitations.js +79 -29
- package/dist/apps/management/routes/invitations.js.map +1 -1
- package/dist/apps/management/routes/invite-links.d.ts +128 -83
- package/dist/apps/management/routes/invite-links.d.ts.map +1 -1
- package/dist/apps/management/routes/invite-links.js +100 -41
- package/dist/apps/management/routes/invite-links.js.map +1 -1
- package/dist/apps/management/routes/me.d.ts +5 -5
- package/dist/apps/management/routes/me.d.ts.map +1 -1
- package/dist/apps/management/routes/me.js +14 -10
- package/dist/apps/management/routes/me.js.map +1 -1
- package/dist/apps/management/routes/members.d.ts +68 -47
- package/dist/apps/management/routes/members.d.ts.map +1 -1
- package/dist/apps/management/routes/members.js +37 -18
- package/dist/apps/management/routes/members.js.map +1 -1
- package/dist/apps/management/routes/orgs.d.ts +48 -8
- package/dist/apps/management/routes/orgs.d.ts.map +1 -1
- package/dist/apps/management/routes/orgs.js +48 -19
- package/dist/apps/management/routes/orgs.js.map +1 -1
- package/dist/apps/management/routes/projects.d.ts +130 -68
- package/dist/apps/management/routes/projects.d.ts.map +1 -1
- package/dist/apps/management/routes/projects.js +72 -21
- package/dist/apps/management/routes/projects.js.map +1 -1
- package/dist/apps/management/routes/scopes.d.ts.map +1 -1
- package/dist/apps/management/routes/scopes.js +8 -5
- package/dist/apps/management/routes/scopes.js.map +1 -1
- package/dist/apps/management/routes/usage.d.ts +38 -38
- package/dist/apps/management/routes/usage.d.ts.map +1 -1
- package/dist/apps/management/routes/usage.js +41 -31
- package/dist/apps/management/routes/usage.js.map +1 -1
- package/dist/apps/management/routes/verified-token-requests.d.ts +34 -6
- package/dist/apps/management/routes/verified-token-requests.d.ts.map +1 -1
- package/dist/apps/management/routes/verified-token-requests.js +36 -17
- package/dist/apps/management/routes/verified-token-requests.js.map +1 -1
- package/dist/apps/management/routes/webhooks.d.ts +1186 -197
- package/dist/apps/management/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/management/routes/webhooks.js +106 -38
- package/dist/apps/management/routes/webhooks.js.map +1 -1
- package/dist/apps/mpp/internal/Adapter.d.ts +1 -1
- package/dist/apps/mpp/internal/Adapter.d.ts.map +1 -1
- package/dist/apps/mpp/internal/Adapter.js +12 -0
- package/dist/apps/mpp/internal/Adapter.js.map +1 -1
- package/dist/db/Db.d.ts +2 -0
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +61 -0
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +30 -2
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +28 -3
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/earnVaults.d.ts +5 -1
- package/dist/db/tables/earnVaults.d.ts.map +1 -1
- package/dist/db/tables/earnVaults.js +5 -0
- package/dist/db/tables/earnVaults.js.map +1 -1
- package/dist/db/tables/webhookDeliveries.d.ts.map +1 -1
- package/dist/db/tables/webhookDeliveries.js +10 -0
- package/dist/db/tables/webhookDeliveries.js.map +1 -1
- package/dist/db/tables/webhookQueueCompletions.d.ts +15 -0
- package/dist/db/tables/webhookQueueCompletions.d.ts.map +1 -0
- package/dist/db/tables/webhookQueueCompletions.js +32 -0
- package/dist/db/tables/webhookQueueCompletions.js.map +1 -0
- package/dist/db/tables/webhookQueueEvents.d.ts +16 -20
- package/dist/db/tables/webhookQueueEvents.d.ts.map +1 -1
- package/dist/db/tables/webhookQueueEvents.js +68 -43
- package/dist/db/tables/webhookQueueEvents.js.map +1 -1
- package/dist/db/tables/webhookSubscriptions.d.ts +47 -72
- package/dist/db/tables/webhookSubscriptions.d.ts.map +1 -1
- package/dist/db/tables/webhookSubscriptions.js +92 -105
- package/dist/db/tables/webhookSubscriptions.js.map +1 -1
- package/dist/internal/Auth.d.ts +8 -1
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +13 -3
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/Cache.d.ts.map +1 -1
- package/dist/internal/Cache.js +11 -7
- package/dist/internal/Cache.js.map +1 -1
- package/dist/internal/EarnVaults.d.ts +41 -2
- package/dist/internal/EarnVaults.d.ts.map +1 -1
- package/dist/internal/EarnVaults.js +167 -0
- package/dist/internal/EarnVaults.js.map +1 -1
- package/dist/internal/MetricSink.d.ts +35 -125
- package/dist/internal/MetricSink.d.ts.map +1 -1
- package/dist/internal/MetricSink.js +50 -121
- package/dist/internal/MetricSink.js.map +1 -1
- package/dist/internal/OpenApi.d.ts +26 -22
- package/dist/internal/OpenApi.d.ts.map +1 -1
- package/dist/internal/OpenApi.js +128 -39
- package/dist/internal/OpenApi.js.map +1 -1
- package/dist/internal/Response.d.ts +13 -8
- package/dist/internal/Response.d.ts.map +1 -1
- package/dist/internal/Response.js +16 -5
- package/dist/internal/Response.js.map +1 -1
- package/dist/internal/Schema.d.ts +8 -8
- package/dist/internal/Schema.d.ts.map +1 -1
- package/dist/internal/Schema.js +10 -9
- package/dist/internal/Schema.js.map +1 -1
- package/dist/internal/Store.d.ts +15 -6
- package/dist/internal/Store.d.ts.map +1 -1
- package/dist/internal/Store.js +45 -15
- package/dist/internal/Store.js.map +1 -1
- package/dist/internal/Tidx.d.ts +2 -0
- package/dist/internal/Tidx.d.ts.map +1 -1
- package/dist/internal/Tidx.js +16 -4
- package/dist/internal/Tidx.js.map +1 -1
- package/dist/internal/WebhookTransfer.d.ts +1 -55
- package/dist/internal/WebhookTransfer.d.ts.map +1 -1
- package/dist/internal/WebhookTransfer.js +1 -239
- package/dist/internal/WebhookTransfer.js.map +1 -1
- package/dist/internal/Webhooks.d.ts +112 -56
- package/dist/internal/Webhooks.d.ts.map +1 -1
- package/dist/internal/Webhooks.js +124 -93
- package/dist/internal/Webhooks.js.map +1 -1
- package/dist/internal/funding/Deposit.d.ts +2 -2
- package/dist/internal/funding/Deposit.d.ts.map +1 -1
- package/dist/internal/funding/Deposit.js +9 -8
- package/dist/internal/funding/Deposit.js.map +1 -1
- package/dist/internal/funding/DepositAddress.d.ts +4 -4
- package/dist/internal/funding/DepositAddress.d.ts.map +1 -1
- package/dist/internal/funding/DepositAddress.js +9 -8
- package/dist/internal/funding/DepositAddress.js.map +1 -1
- package/dist/internal/funding/DepositWebhook.d.ts +25 -0
- package/dist/internal/funding/DepositWebhook.d.ts.map +1 -0
- package/dist/internal/funding/DepositWebhook.js +74 -0
- package/dist/internal/funding/DepositWebhook.js.map +1 -0
- package/dist/internal/funding/Provider.d.ts.map +1 -1
- package/dist/internal/funding/Provider.js +13 -12
- package/dist/internal/funding/Provider.js.map +1 -1
- package/dist/internal/funding/Reconciliation.d.ts +6 -0
- package/dist/internal/funding/Reconciliation.d.ts.map +1 -1
- package/dist/internal/funding/Reconciliation.js +42 -10
- package/dist/internal/funding/Reconciliation.js.map +1 -1
- 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/stargate.d.ts +19 -0
- package/dist/internal/funding/providers/stargate.d.ts.map +1 -0
- package/dist/internal/funding/providers/stargate.js +143 -0
- package/dist/internal/funding/providers/stargate.js.map +1 -0
- 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/dist/providers/index.d.ts +7 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +3 -0
- package/dist/providers/index.js.map +1 -1
- package/package.json +2 -2
- package/src/App.test.ts +48 -0
- package/src/App.ts +7 -2
- package/src/Assets.test.ts +18 -0
- package/src/Assets.ts +22 -0
- package/src/Client.test-d.ts +287 -17
- package/src/Webhooks.ts +1 -220
- package/src/admin/apps/earn-vaults.test.ts +143 -0
- package/src/admin/apps/earn-vaults.ts +83 -6
- package/src/admin/apps/organizations.ts +6 -2
- package/src/admin/ui/src/routes/api-keys.tsx +36 -0
- package/src/admin/ui.generated.ts +151 -189
- package/src/apps/data/App.test.ts +31 -0
- package/src/apps/data/App.ts +64 -10
- package/src/apps/data/ZoneSelection.test.ts +196 -0
- package/src/apps/data/ZoneSelection.ts +108 -0
- package/src/apps/data/routes/activities.test.ts +435 -12
- package/src/apps/data/routes/activities.ts +562 -125
- package/src/apps/data/routes/balances.ts +1 -1
- package/src/apps/data/routes/blocks.ts +1 -1
- package/src/apps/data/routes/earn.test.ts +183 -23
- package/src/apps/data/routes/earn.ts +225 -29
- package/src/apps/data/routes/earn.zone-access.test.ts +46 -0
- package/src/apps/data/routes/exchanges.test.ts +31 -1
- package/src/apps/data/routes/exchanges.ts +19 -15
- package/src/apps/data/routes/fee-amm.ts +18 -11
- package/src/apps/data/routes/receipts.ts +1 -1
- package/src/apps/data/routes/rpc.test.ts +75 -0
- package/src/apps/data/routes/rpc.ts +23 -9
- package/src/apps/data/routes/tokenlist.ts +21 -18
- package/src/apps/data/routes/tokens.test.ts +29 -0
- package/src/apps/data/routes/tokens.ts +38 -15
- package/src/apps/data/routes/transactions.ts +1 -1
- package/src/apps/data/routes/transfers.test.ts +3 -3
- package/src/apps/data/routes/transfers.ts +12 -9
- package/src/apps/data/routes/webhooks.test.ts +179 -1497
- package/src/apps/data/routes/webhooks.ts +156 -976
- package/src/apps/data/routes/zones.test.ts +19 -13
- package/src/apps/funding/routes/chains.test.ts +211 -7
- package/src/apps/funding/routes/chains.ts +19 -12
- package/src/apps/funding/routes/deposit-addresses.test.ts +394 -0
- package/src/apps/funding/routes/deposit-addresses.ts +84 -72
- package/src/apps/funding/routes/providers.ts +9 -5
- package/src/apps/funding/routes/quotes.test.ts +46 -0
- package/src/apps/funding/routes/quotes.ts +8 -5
- package/src/apps/funding/routes/transfers.test.ts +35 -32
- package/src/apps/management/Billing.test.ts +26 -0
- package/src/apps/management/Billing.ts +24 -7
- package/src/apps/management/routes/api-keys.test.ts +178 -0
- package/src/apps/management/routes/api-keys.ts +203 -144
- package/src/apps/management/routes/billing.test.ts +209 -0
- package/src/apps/management/routes/billing.ts +254 -177
- package/src/apps/management/routes/faucet.test.ts +39 -0
- package/src/apps/management/routes/faucet.ts +75 -41
- package/src/apps/management/routes/invitations.test.ts +216 -0
- package/src/apps/management/routes/invitations.ts +186 -109
- package/src/apps/management/routes/invite-links.test.ts +263 -1
- package/src/apps/management/routes/invite-links.ts +295 -214
- package/src/apps/management/routes/me.test.ts +49 -0
- package/src/apps/management/routes/me.ts +42 -32
- package/src/apps/management/routes/members.test.ts +124 -1
- package/src/apps/management/routes/members.ts +81 -51
- package/src/apps/management/routes/orgs.test.ts +176 -0
- package/src/apps/management/routes/orgs.ts +101 -59
- package/src/apps/management/routes/projects.test.ts +183 -0
- package/src/apps/management/routes/projects.ts +124 -60
- package/src/apps/management/routes/scopes.test.ts +44 -0
- package/src/apps/management/routes/scopes.ts +37 -28
- package/src/apps/management/routes/usage.test.ts +92 -0
- package/src/apps/management/routes/usage.ts +186 -151
- package/src/apps/management/routes/verified-token-requests.test.ts +114 -0
- package/src/apps/management/routes/verified-token-requests.ts +166 -133
- package/src/apps/management/routes/webhooks.test.ts +313 -1
- package/src/apps/management/routes/webhooks.ts +220 -71
- package/src/apps/mpp/internal/Adapter.ts +13 -1
- package/src/db/Db.test.ts +42 -5
- package/src/db/Db.ts +85 -0
- package/src/db/Schema.ts +41 -3
- package/src/db/tables/earnVaults.test.ts +22 -0
- package/src/db/tables/earnVaults.ts +11 -1
- package/src/db/tables/organizations.test.ts +5 -2
- package/src/db/tables/webhookDeliveries.ts +13 -0
- package/src/db/tables/webhookQueueCompletions.ts +55 -0
- package/src/db/tables/webhookQueueEvents.ts +97 -57
- package/src/db/tables/webhookSubscriptions.ts +134 -144
- package/src/internal/Auth.ts +23 -5
- package/src/internal/Cache.ts +14 -7
- package/src/internal/EarnVaults.capabilities.test.ts +33 -0
- package/src/internal/EarnVaults.test.ts +79 -0
- package/src/internal/EarnVaults.ts +277 -0
- package/src/internal/MetricSink.test.ts +41 -373
- package/src/internal/MetricSink.ts +92 -273
- package/src/internal/OpenApi.ts +165 -49
- package/src/internal/Response.test.ts +95 -0
- package/src/internal/Response.ts +40 -2
- package/src/internal/Schema.test.ts +34 -0
- package/src/internal/Schema.ts +20 -9
- package/src/internal/Store.test.ts +186 -0
- package/src/internal/Store.ts +57 -17
- package/src/internal/Tidx.test.ts +19 -0
- package/src/internal/Tidx.ts +16 -4
- package/src/internal/WebhookTransfer.ts +1 -351
- package/src/internal/Webhooks.test.ts +222 -145
- package/src/internal/Webhooks.ts +234 -135
- package/src/internal/funding/Deposit.ts +71 -64
- package/src/internal/funding/DepositAddress.ts +50 -43
- package/src/internal/funding/DepositWebhook.test.ts +131 -0
- package/src/internal/funding/DepositWebhook.ts +101 -0
- package/src/internal/funding/Provider.ts +164 -142
- package/src/internal/funding/Reconciliation.test.ts +14 -0
- package/src/internal/funding/Reconciliation.ts +161 -86
- 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 +185 -0
- package/src/internal/funding/providers/stargate.ts +184 -0
- package/src/internal/webhookDestinations/slack.ts +15 -0
- package/src/providers/index.test.ts +1 -0
- package/src/providers/index.ts +9 -0
- package/src/Webhooks.bench.ts +0 -714
- package/src/Webhooks.memory.bench.ts +0 -250
- package/src/Webhooks.test.ts +0 -146
|
@@ -6,7 +6,9 @@ import * as FundingDepositRequestObservations from '../../db/tables/fundingDepos
|
|
|
6
6
|
import * as FundingDeposits from '../../db/tables/fundingDeposits.js'
|
|
7
7
|
import type * as Metrics from '../../Metrics.js'
|
|
8
8
|
import * as Value from '../Value.js'
|
|
9
|
+
import type * as Webhooks from '../Webhooks.js'
|
|
9
10
|
import * as Deposit from './Deposit.js'
|
|
11
|
+
import * as DepositWebhook from './DepositWebhook.js'
|
|
10
12
|
import * as Provider from './Provider.js'
|
|
11
13
|
import * as Subsidy from './Subsidy.js'
|
|
12
14
|
|
|
@@ -119,6 +121,17 @@ export function createTracker(options: createTracker.Options): createTracker.Tra
|
|
|
119
121
|
})()
|
|
120
122
|
heartbeat.assert()
|
|
121
123
|
let created = 0
|
|
124
|
+
const depositWebhookReferences = new Map<string, Webhooks.QueueReference>()
|
|
125
|
+
const onDeposit: NonNullable<reconcileRequest.Options['onDeposit']> = (
|
|
126
|
+
_deposit,
|
|
127
|
+
references,
|
|
128
|
+
) => {
|
|
129
|
+
for (const reference of references)
|
|
130
|
+
depositWebhookReferences.set(
|
|
131
|
+
`${reference.subscriptionId}:${reference.eventId}`,
|
|
132
|
+
reference,
|
|
133
|
+
)
|
|
134
|
+
}
|
|
122
135
|
let updated = 0
|
|
123
136
|
const pendingRequestIds = new Set([
|
|
124
137
|
...requests.pendingRequestIds,
|
|
@@ -129,6 +142,7 @@ export function createTracker(options: createTracker.Options): createTracker.Tra
|
|
|
129
142
|
const result = await reconcileRequest(database, {
|
|
130
143
|
address: claimed,
|
|
131
144
|
metrics: options.metrics,
|
|
145
|
+
onDeposit,
|
|
132
146
|
provider,
|
|
133
147
|
request,
|
|
134
148
|
signal: options.signal,
|
|
@@ -148,6 +162,7 @@ export function createTracker(options: createTracker.Options): createTracker.Tra
|
|
|
148
162
|
const unattributed = await reconcileUnattributed(database, {
|
|
149
163
|
address: claimed,
|
|
150
164
|
metrics: options.metrics,
|
|
165
|
+
onDeposit,
|
|
151
166
|
provider,
|
|
152
167
|
signal: options.signal,
|
|
153
168
|
subsidies: options.subsidies,
|
|
@@ -166,6 +181,24 @@ export function createTracker(options: createTracker.Options): createTracker.Tra
|
|
|
166
181
|
trigger,
|
|
167
182
|
})
|
|
168
183
|
|
|
184
|
+
if (options.dispatchDepositUpdates && depositWebhookReferences.size > 0) {
|
|
185
|
+
const references = [...depositWebhookReferences.values()]
|
|
186
|
+
await options.dispatchDepositUpdates(references).then(
|
|
187
|
+
(count) =>
|
|
188
|
+
options.metrics?.count('funding_deposit_webhook_enqueue_count', count, {
|
|
189
|
+
outcome: 'succeeded',
|
|
190
|
+
provider: claimed.providerId,
|
|
191
|
+
}),
|
|
192
|
+
(cause) => {
|
|
193
|
+
options.metrics?.count('funding_deposit_webhook_enqueue_count', references.length, {
|
|
194
|
+
outcome: 'failed',
|
|
195
|
+
provider: claimed.providerId,
|
|
196
|
+
})
|
|
197
|
+
throw cause
|
|
198
|
+
},
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
|
|
169
202
|
const leaseFailure = await heartbeat.stop()
|
|
170
203
|
if (leaseFailure !== undefined) throw leaseFailure
|
|
171
204
|
const completedAt = now()
|
|
@@ -295,6 +328,10 @@ export declare namespace createTracker {
|
|
|
295
328
|
message: Provider.Webhook.receive.Dispatchable,
|
|
296
329
|
options?: createTracker.DispatchOptions,
|
|
297
330
|
) => Promise<void>
|
|
331
|
+
/** Stages and dispatches committed funding deposit webhook updates. */
|
|
332
|
+
dispatchDepositUpdates?:
|
|
333
|
+
| ((references: readonly Webhooks.QueueReference[]) => Promise<number>)
|
|
334
|
+
| undefined
|
|
298
335
|
/** Duration of one reconciliation lease. */
|
|
299
336
|
leaseMs?: number | undefined
|
|
300
337
|
/** Optional bounded operational metrics sink. */
|
|
@@ -589,6 +626,7 @@ type VerifiedDeposit = {
|
|
|
589
626
|
type ReconcileDeliveryOptions = {
|
|
590
627
|
address: FundingDepositAddresses.Record
|
|
591
628
|
metrics?: Metrics.Metrics | undefined
|
|
629
|
+
onDeposit?: reconcileRequest.Options['onDeposit'] | undefined
|
|
592
630
|
provider?: Provider.Provider | undefined
|
|
593
631
|
request?: Provider.listDepositAddressRequests.ReturnType['requests'][number] | undefined
|
|
594
632
|
signal?: AbortSignal | undefined
|
|
@@ -690,7 +728,11 @@ async function reconcileUnattributed(db: Db.Db, options: reconcileUnattributed.O
|
|
|
690
728
|
if (!delivery.terminal) terminal = false
|
|
691
729
|
for (const id of delivery.updatedIds) updatedIds.add(id)
|
|
692
730
|
}
|
|
693
|
-
return {
|
|
731
|
+
return {
|
|
732
|
+
...(followUp ? { followUp } : {}),
|
|
733
|
+
terminal,
|
|
734
|
+
updatedIds,
|
|
735
|
+
}
|
|
694
736
|
}
|
|
695
737
|
|
|
696
738
|
declare namespace reconcileUnattributed {
|
|
@@ -843,21 +885,25 @@ export async function reconcileRequest(
|
|
|
843
885
|
deposit.providerRequestId === null ||
|
|
844
886
|
!deposit.providerRequestIds.includes(options.request.id)
|
|
845
887
|
) {
|
|
846
|
-
const result = await
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
888
|
+
const result = await transitionDeposit(
|
|
889
|
+
db,
|
|
890
|
+
{
|
|
891
|
+
expectedVersion: deposit.version,
|
|
892
|
+
id: deposit.id,
|
|
893
|
+
providerRequestId: options.request.id,
|
|
894
|
+
providerRequestIds: unique([...deposit.providerRequestIds, options.request.id]),
|
|
895
|
+
providerTransferIndex,
|
|
896
|
+
snapshot: {
|
|
897
|
+
...deposit.snapshot,
|
|
898
|
+
...(options.address.snapshot.subsidize ? { destinationAmountRequired } : {}),
|
|
899
|
+
...(transfer.sender ? { sender: transfer.sender } : {}),
|
|
900
|
+
sourceAmount,
|
|
901
|
+
},
|
|
902
|
+
sourceTransferIndex: transfer.transferIndex,
|
|
903
|
+
status: deposit.status === 'detected' ? 'bridging' : deposit.status,
|
|
857
904
|
},
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
})
|
|
905
|
+
options.onDeposit,
|
|
906
|
+
)
|
|
861
907
|
if (result.type === 'applied') {
|
|
862
908
|
deposit = result.record
|
|
863
909
|
updatedIds.add(deposit.id)
|
|
@@ -867,7 +913,9 @@ export async function reconcileRequest(
|
|
|
867
913
|
}
|
|
868
914
|
}
|
|
869
915
|
if (verified.length === 0) return { created, terminal: false, updated: updatedIds.size }
|
|
870
|
-
if (!sourceEvidenceComplete)
|
|
916
|
+
if (!sourceEvidenceComplete) {
|
|
917
|
+
return { created, terminal: false, updated: updatedIds.size }
|
|
918
|
+
}
|
|
871
919
|
const recovery = await reconcileProviderRecovery(db, { ...options, verified })
|
|
872
920
|
if (recovery) {
|
|
873
921
|
for (const id of recovery.updatedIds) updatedIds.add(id)
|
|
@@ -895,6 +943,10 @@ export declare namespace reconcileRequest {
|
|
|
895
943
|
address: FundingDepositAddresses.Record
|
|
896
944
|
/** Optional bounded operational metrics sink. */
|
|
897
945
|
metrics?: Metrics.Metrics | undefined
|
|
946
|
+
/** Observes the latest committed form of each verified deposit. */
|
|
947
|
+
onDeposit?:
|
|
948
|
+
| ((deposit: FundingDeposits.Record, references: readonly Webhooks.QueueReference[]) => void)
|
|
949
|
+
| undefined
|
|
898
950
|
/** Provider integration that discovered the request. */
|
|
899
951
|
provider?: Provider.Provider | undefined
|
|
900
952
|
/** Provider request containing discovered chain transactions. */
|
|
@@ -922,6 +974,17 @@ export declare namespace reconcileRequest {
|
|
|
922
974
|
}
|
|
923
975
|
}
|
|
924
976
|
|
|
977
|
+
async function transitionDeposit(
|
|
978
|
+
db: Db.Db,
|
|
979
|
+
options: Deposit.transition.Options,
|
|
980
|
+
onDeposit: reconcileRequest.Options['onDeposit'],
|
|
981
|
+
): Promise<Deposit.transition.Result> {
|
|
982
|
+
const committed = await DepositWebhook.transition(db, options)
|
|
983
|
+
if (committed.result.type === 'applied')
|
|
984
|
+
onDeposit?.(committed.result.record, committed.references)
|
|
985
|
+
return committed.result
|
|
986
|
+
}
|
|
987
|
+
|
|
925
988
|
async function reconcileProviderRecovery(db: Db.Db, options: ReconcileDeliveryOptions) {
|
|
926
989
|
const failed = (providerFailureStatuses as readonly string[]).includes(
|
|
927
990
|
options.request?.status ?? '',
|
|
@@ -991,15 +1054,19 @@ async function reconcileProviderRecovery(db: Db.Db, options: ReconcileDeliveryOp
|
|
|
991
1054
|
if (Deposit.isTerminal(entry.deposit.status)) continue
|
|
992
1055
|
let deposit = entry.deposit
|
|
993
1056
|
if (deposit.status !== 'refunding') {
|
|
994
|
-
const result = await
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1057
|
+
const result = await transitionDeposit(
|
|
1058
|
+
db,
|
|
1059
|
+
{
|
|
1060
|
+
expectedVersion: deposit.version,
|
|
1061
|
+
id: deposit.id,
|
|
1062
|
+
providerTransactionHashes: unique([
|
|
1063
|
+
...deposit.providerTransactionHashes,
|
|
1064
|
+
...providerRefundTransactionHashes,
|
|
1065
|
+
]),
|
|
1066
|
+
status: 'refunding',
|
|
1067
|
+
},
|
|
1068
|
+
options.onDeposit,
|
|
1069
|
+
)
|
|
1003
1070
|
if (result.type === 'applied') {
|
|
1004
1071
|
deposit = result.record
|
|
1005
1072
|
updatedIds.add(deposit.id)
|
|
@@ -1011,20 +1078,24 @@ async function reconcileProviderRecovery(db: Db.Db, options: ReconcileDeliveryOp
|
|
|
1011
1078
|
terminal = false
|
|
1012
1079
|
continue
|
|
1013
1080
|
}
|
|
1014
|
-
const result = await
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1081
|
+
const result = await transitionDeposit(
|
|
1082
|
+
db,
|
|
1083
|
+
{
|
|
1084
|
+
expectedVersion: deposit.version,
|
|
1085
|
+
id: deposit.id,
|
|
1086
|
+
snapshot: {
|
|
1087
|
+
...deposit.snapshot,
|
|
1088
|
+
refundAmount: Value.tokenAmount({
|
|
1089
|
+
baseUnits: amount,
|
|
1090
|
+
currency: options.address.snapshot.sourceToken.currency,
|
|
1091
|
+
decimals: options.address.snapshot.sourceToken.decimals,
|
|
1092
|
+
}),
|
|
1093
|
+
refundTransactionHashes,
|
|
1094
|
+
},
|
|
1095
|
+
status: 'refunded',
|
|
1025
1096
|
},
|
|
1026
|
-
|
|
1027
|
-
|
|
1097
|
+
options.onDeposit,
|
|
1098
|
+
)
|
|
1028
1099
|
if (result.type === 'applied') updatedIds.add(deposit.id)
|
|
1029
1100
|
else if (result.type !== 'stale' || !Deposit.isTerminal(result.current.status)) terminal = false
|
|
1030
1101
|
}
|
|
@@ -1116,57 +1187,61 @@ async function reconcileDelivery(db: Db.Db, options: ReconcileDeliveryOptions) {
|
|
|
1116
1187
|
currency: options.address.snapshot.destinationToken.currency,
|
|
1117
1188
|
decimals: options.address.snapshot.destinationToken.decimals,
|
|
1118
1189
|
})
|
|
1119
|
-
const result = await
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
:
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
...deposit.providerTransactionHashes,
|
|
1144
|
-
...providerTransactionHashes,
|
|
1145
|
-
...(deliveryObservation?.providerTransactionHashes ?? []),
|
|
1146
|
-
]),
|
|
1147
|
-
...(settlement.settlementTransaction
|
|
1148
|
-
? { settlementTransaction: settlement.settlementTransaction }
|
|
1149
|
-
: {}),
|
|
1150
|
-
...(settlement.settlementTransactionHash
|
|
1151
|
-
? { settlementTransactionHash: settlement.settlementTransactionHash }
|
|
1152
|
-
: {}),
|
|
1153
|
-
snapshot: {
|
|
1154
|
-
...deposit.snapshot,
|
|
1155
|
-
...(delivered + settlement.delivered > 0n ? { destinationAmount } : {}),
|
|
1156
|
-
...(settlement.status === 'completed' && !options.address.snapshot.subsidize
|
|
1157
|
-
? { destinationAmountRequired: destinationAmount }
|
|
1190
|
+
const result = await transitionDeposit(
|
|
1191
|
+
db,
|
|
1192
|
+
{
|
|
1193
|
+
expectedVersion: deposit.version,
|
|
1194
|
+
id: deposit.id,
|
|
1195
|
+
...(delivered > 0n
|
|
1196
|
+
? {
|
|
1197
|
+
providerOutputAmount: Value.tokenAmount({
|
|
1198
|
+
baseUnits: delivered,
|
|
1199
|
+
currency: options.address.providerOutputToken.currency,
|
|
1200
|
+
decimals: options.address.providerOutputToken.decimals,
|
|
1201
|
+
}),
|
|
1202
|
+
}
|
|
1203
|
+
: {}),
|
|
1204
|
+
providerRequestIds: options.request
|
|
1205
|
+
? unique([...deposit.providerRequestIds, options.request.id])
|
|
1206
|
+
: deposit.providerRequestIds,
|
|
1207
|
+
...(deliveryObservation?.providerState
|
|
1208
|
+
? {
|
|
1209
|
+
providerState: {
|
|
1210
|
+
...deposit.providerState,
|
|
1211
|
+
...deliveryObservation.providerState,
|
|
1212
|
+
},
|
|
1213
|
+
}
|
|
1158
1214
|
: {}),
|
|
1159
|
-
|
|
1160
|
-
...
|
|
1161
|
-
...
|
|
1162
|
-
...
|
|
1215
|
+
providerTransactionHashes: unique([
|
|
1216
|
+
...deposit.providerTransactionHashes,
|
|
1217
|
+
...providerTransactionHashes,
|
|
1218
|
+
...(deliveryObservation?.providerTransactionHashes ?? []),
|
|
1163
1219
|
]),
|
|
1220
|
+
...(settlement.settlementTransaction
|
|
1221
|
+
? { settlementTransaction: settlement.settlementTransaction }
|
|
1222
|
+
: {}),
|
|
1223
|
+
...(settlement.settlementTransactionHash
|
|
1224
|
+
? { settlementTransactionHash: settlement.settlementTransactionHash }
|
|
1225
|
+
: {}),
|
|
1226
|
+
snapshot: {
|
|
1227
|
+
...deposit.snapshot,
|
|
1228
|
+
...(delivered + settlement.delivered > 0n ? { destinationAmount } : {}),
|
|
1229
|
+
...(settlement.status === 'completed' && !options.address.snapshot.subsidize
|
|
1230
|
+
? { destinationAmountRequired: destinationAmount }
|
|
1231
|
+
: {}),
|
|
1232
|
+
destinationTransactionHashes: unique([
|
|
1233
|
+
...(deposit.snapshot.destinationTransactionHashes ?? []),
|
|
1234
|
+
...destinationTransfers.map((evidence) => evidence.transactionHash),
|
|
1235
|
+
...settlement.destinationTransactionHashes,
|
|
1236
|
+
]),
|
|
1237
|
+
},
|
|
1238
|
+
status: settlement.status,
|
|
1239
|
+
...(settlement.statusReason ? { statusReason: settlement.statusReason } : {}),
|
|
1240
|
+
...(settlement.subsidyAmount ? { subsidyAmount: settlement.subsidyAmount } : {}),
|
|
1241
|
+
...(settlement.tempoGasPaid ? { tempoGasPaid: settlement.tempoGasPaid } : {}),
|
|
1164
1242
|
},
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
...(settlement.subsidyAmount ? { subsidyAmount: settlement.subsidyAmount } : {}),
|
|
1168
|
-
...(settlement.tempoGasPaid ? { tempoGasPaid: settlement.tempoGasPaid } : {}),
|
|
1169
|
-
})
|
|
1243
|
+
options.onDeposit,
|
|
1244
|
+
)
|
|
1170
1245
|
if (result.type === 'applied') {
|
|
1171
1246
|
updatedIds.add(deposit.id)
|
|
1172
1247
|
if (settlement.broadcast && options.subsidies) {
|
|
@@ -3,6 +3,7 @@ export * as Chain from './Chain.js'
|
|
|
3
3
|
export * as Catalog from './Catalog.js'
|
|
4
4
|
export * as Deposit from './Deposit.js'
|
|
5
5
|
export * as DepositAddress from './DepositAddress.js'
|
|
6
|
+
export * as DepositWebhook from './DepositWebhook.js'
|
|
6
7
|
export * as Evidence from './Evidence.js'
|
|
7
8
|
export * as Provider from './Provider.js'
|
|
8
9
|
export * as Reconciliation from './Reconciliation.js'
|
|
@@ -4,6 +4,7 @@ import * as Across from './across.js'
|
|
|
4
4
|
import * as Relay from './relay.js'
|
|
5
5
|
import * as Rhino from './rhino.js'
|
|
6
6
|
import * as Squid from './squid.js'
|
|
7
|
+
import * as Stargate from './stargate.js'
|
|
7
8
|
import * as Symbiosis from './symbiosis.js'
|
|
8
9
|
|
|
9
10
|
const now = () => new Date('2026-01-01T00:00:00.000Z')
|
|
@@ -21,6 +22,10 @@ const providers = [
|
|
|
21
22
|
integratorId: 'squid-integrator-id',
|
|
22
23
|
userAddress: '0x1111111111111111111111111111111111111111',
|
|
23
24
|
}),
|
|
25
|
+
Stargate.stargate({
|
|
26
|
+
apiKey: 'layerzero-api-key',
|
|
27
|
+
userAddress: '0x1111111111111111111111111111111111111111',
|
|
28
|
+
}),
|
|
24
29
|
Symbiosis.symbiosis({ userAddress: '0x1111111111111111111111111111111111111111' }),
|
|
25
30
|
] as const
|
|
26
31
|
|
|
@@ -335,6 +340,126 @@ describe('funding providers', () => {
|
|
|
335
340
|
})
|
|
336
341
|
})
|
|
337
342
|
|
|
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
|
+
test('exposes Base and Ethereum Stargate quote candidates', () => {
|
|
411
|
+
expect(
|
|
412
|
+
['base', 'ethereum'].map((sourceChain) => quoteCandidate('stargate', { sourceChain }).id),
|
|
413
|
+
).toEqual(['base-usdc-tempo-usdce-stargate', 'ethereum-usdc-tempo-usdce-stargate'])
|
|
414
|
+
})
|
|
415
|
+
|
|
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
|
+
|
|
338
463
|
test('maps successful Symbiosis quotes to available quote results', async () => {
|
|
339
464
|
const requests: RecordedRequest[] = []
|
|
340
465
|
const candidate = quoteCandidate('symbiosis')
|
|
@@ -961,6 +1086,32 @@ describe('funding providers', () => {
|
|
|
961
1086
|
})
|
|
962
1087
|
})
|
|
963
1088
|
|
|
1089
|
+
test('returns bounded Stargate failure diagnostics', async () => {
|
|
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
|
+
|
|
1101
|
+
expect(
|
|
1102
|
+
FundingProvider.failure({
|
|
1103
|
+
cause,
|
|
1104
|
+
operation: 'getQuote',
|
|
1105
|
+
provider: getProvider('stargate'),
|
|
1106
|
+
}),
|
|
1107
|
+
).toEqual({
|
|
1108
|
+
failure: 'http',
|
|
1109
|
+
id: 'stargate',
|
|
1110
|
+
operation: 'getQuote',
|
|
1111
|
+
status: 401,
|
|
1112
|
+
})
|
|
1113
|
+
})
|
|
1114
|
+
|
|
964
1115
|
test('returns bounded Symbiosis failure diagnostics', () => {
|
|
965
1116
|
expect(
|
|
966
1117
|
FundingProvider.failure({
|
|
@@ -1059,6 +1210,40 @@ function squidQuote(candidate: FundingProvider.getQuote.Parameters['candidate'])
|
|
|
1059
1210
|
}
|
|
1060
1211
|
}
|
|
1061
1212
|
|
|
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
|
+
|
|
1062
1247
|
function symbiosisQuote(candidate: FundingProvider.getQuote.Parameters['candidate']) {
|
|
1063
1248
|
const source =
|
|
1064
1249
|
candidate.sourceChain.kind === 'tron'
|