tapimo 0.15.1 → 0.18.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 +137 -0
- package/dist/ApiKey.d.ts +1 -0
- package/dist/ApiKey.d.ts.map +1 -1
- package/dist/ApiKey.js +4 -2
- package/dist/ApiKey.js.map +1 -1
- package/dist/ApiKeys.d.ts +37 -11
- package/dist/ApiKeys.d.ts.map +1 -1
- package/dist/ApiKeys.js +163 -10
- package/dist/ApiKeys.js.map +1 -1
- package/dist/App.d.ts +13085 -11974
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +46 -15
- package/dist/App.js.map +1 -1
- package/dist/Scope.d.ts +1 -1
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +1 -1
- package/dist/Scope.js.map +1 -1
- package/dist/admin/App.d.ts +893 -191
- package/dist/admin/App.d.ts.map +1 -1
- package/dist/admin/App.js +5 -1
- package/dist/admin/App.js.map +1 -1
- package/dist/admin/apps/api-keys.d.ts +70 -70
- package/dist/admin/apps/api-keys.d.ts.map +1 -1
- package/dist/admin/apps/api-keys.js +8 -3
- package/dist/admin/apps/api-keys.js.map +1 -1
- package/dist/admin/apps/earn-vaults.d.ts +66 -27
- package/dist/admin/apps/earn-vaults.d.ts.map +1 -1
- package/dist/admin/apps/earn-vaults.js +36 -7
- package/dist/admin/apps/earn-vaults.js.map +1 -1
- package/dist/admin/apps/organizations.d.ts +25 -25
- package/dist/admin/apps/organizations.d.ts.map +1 -1
- package/dist/admin/apps/organizations.js +5 -4
- package/dist/admin/apps/organizations.js.map +1 -1
- package/dist/admin/apps/route-policies.d.ts +632 -0
- package/dist/admin/apps/route-policies.d.ts.map +1 -0
- package/dist/admin/apps/route-policies.js +257 -0
- package/dist/admin/apps/route-policies.js.map +1 -0
- package/dist/admin/apps/routes-support.js +39 -3
- package/dist/admin/apps/routes-support.js.map +1 -1
- package/dist/admin/apps/routes.d.ts +529 -76
- package/dist/admin/apps/routes.d.ts.map +1 -1
- package/dist/admin/apps/routes.js +82 -1
- package/dist/admin/apps/routes.js.map +1 -1
- package/dist/admin/apps/verified-tokens.d.ts +157 -157
- package/dist/admin/index.d.ts +0 -1
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +0 -1
- package/dist/admin/index.js.map +1 -1
- 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 +205 -201
- package/dist/admin/ui.generated.js.map +1 -1
- package/dist/analytics/Analytics.d.ts.map +1 -1
- package/dist/analytics/Analytics.js +65 -1
- package/dist/analytics/Analytics.js.map +1 -1
- package/dist/analytics/tables/requestEvents.d.ts +1 -1
- package/dist/analytics/tables/requestEvents.d.ts.map +1 -1
- package/dist/analytics/tables/requestEvents.js +58 -59
- package/dist/analytics/tables/requestEvents.js.map +1 -1
- package/dist/apps/data/App.d.ts +2709 -2670
- package/dist/apps/data/App.d.ts.map +1 -1
- package/dist/apps/data/routes/activities.d.ts +357 -357
- package/dist/apps/data/routes/activities.d.ts.map +1 -1
- package/dist/apps/data/routes/activities.js +50 -0
- package/dist/apps/data/routes/activities.js.map +1 -1
- package/dist/apps/data/routes/addresses.d.ts +248 -248
- package/dist/apps/data/routes/balances.d.ts +22 -22
- package/dist/apps/data/routes/balances.d.ts.map +1 -1
- package/dist/apps/data/routes/balances.js +5 -7
- package/dist/apps/data/routes/balances.js.map +1 -1
- package/dist/apps/data/routes/blocks.d.ts +125 -125
- package/dist/apps/data/routes/coingecko.d.ts +54 -54
- package/dist/apps/data/routes/earn.d.ts +103 -12
- package/dist/apps/data/routes/earn.d.ts.map +1 -1
- package/dist/apps/data/routes/earn.js +456 -220
- package/dist/apps/data/routes/earn.js.map +1 -1
- package/dist/apps/data/routes/exchanges.d.ts.map +1 -1
- package/dist/apps/data/routes/exchanges.js +267 -97
- package/dist/apps/data/routes/exchanges.js.map +1 -1
- package/dist/apps/data/routes/fee-amm.d.ts +109 -127
- package/dist/apps/data/routes/fee-amm.d.ts.map +1 -1
- package/dist/apps/data/routes/fee-amm.js +83 -54
- package/dist/apps/data/routes/fee-amm.js.map +1 -1
- package/dist/apps/data/routes/indexer.d.ts +43 -43
- package/dist/apps/data/routes/receipts.d.ts +235 -235
- package/dist/apps/data/routes/rpc.d.ts +30 -30
- package/dist/apps/data/routes/tokens.d.ts.map +1 -1
- package/dist/apps/data/routes/tokens.js +11 -6
- package/dist/apps/data/routes/tokens.js.map +1 -1
- package/dist/apps/data/routes/transactions.d.ts +2 -0
- package/dist/apps/data/routes/transactions.d.ts.map +1 -1
- package/dist/apps/data/routes/transactions.js +30 -22
- package/dist/apps/data/routes/transactions.js.map +1 -1
- package/dist/apps/data/routes/transfers.d.ts +77 -77
- package/dist/apps/data/routes/valuation.d.ts +32 -32
- package/dist/apps/data/routes/verified-tokens.d.ts +86 -86
- package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
- package/dist/apps/data/routes/webhooks.js +1 -1
- package/dist/apps/data/routes/webhooks.js.map +1 -1
- package/dist/apps/data/routes/zones.d.ts +31 -31
- package/dist/apps/management/App.d.ts +2909 -2064
- package/dist/apps/management/App.d.ts.map +1 -1
- package/dist/apps/management/App.js +2 -0
- package/dist/apps/management/App.js.map +1 -1
- package/dist/apps/management/Billing.d.ts +2 -4
- package/dist/apps/management/Billing.d.ts.map +1 -1
- package/dist/apps/management/Billing.js +65 -26
- package/dist/apps/management/Billing.js.map +1 -1
- package/dist/apps/management/routes/api-keys.d.ts +257 -245
- package/dist/apps/management/routes/api-keys.d.ts.map +1 -1
- package/dist/apps/management/routes/api-keys.js +70 -11
- package/dist/apps/management/routes/api-keys.js.map +1 -1
- package/dist/apps/management/routes/billing.d.ts +84 -84
- package/dist/apps/management/routes/cli.d.ts +912 -0
- package/dist/apps/management/routes/cli.d.ts.map +1 -0
- package/dist/apps/management/routes/cli.js +416 -0
- package/dist/apps/management/routes/cli.js.map +1 -0
- package/dist/apps/management/routes/faucet.d.ts +8 -8
- package/dist/apps/management/routes/invitations.d.ts +138 -138
- package/dist/apps/management/routes/invite-links.d.ts +172 -172
- package/dist/apps/management/routes/members.d.ts +16 -16
- package/dist/apps/management/routes/orgs.d.ts +104 -104
- package/dist/apps/management/routes/orgs.d.ts.map +1 -1
- package/dist/apps/management/routes/orgs.js +8 -2
- package/dist/apps/management/routes/orgs.js.map +1 -1
- package/dist/apps/management/routes/projects.d.ts +125 -125
- package/dist/apps/management/routes/usage.d.ts +8 -8
- package/dist/apps/management/routes/verified-token-requests.d.ts +86 -86
- package/dist/apps/management/routes/webhooks.d.ts +485 -485
- package/dist/apps/mpp/App.d.ts +44 -44
- package/dist/apps/mpp/internal/Policy.d.ts.map +1 -1
- package/dist/apps/mpp/internal/Policy.js +4 -2
- package/dist/apps/mpp/internal/Policy.js.map +1 -1
- package/dist/apps/mpp/internal/Sponsorship.d.ts.map +1 -1
- package/dist/apps/mpp/internal/Sponsorship.js +6 -4
- package/dist/apps/mpp/internal/Sponsorship.js.map +1 -1
- package/dist/apps/relay/App.d.ts +8 -0
- package/dist/apps/relay/App.d.ts.map +1 -1
- package/dist/apps/relay/App.js +16 -4
- package/dist/apps/relay/App.js.map +1 -1
- package/dist/apps/relay/Sponsorships.d.ts +4 -6
- package/dist/apps/relay/Sponsorships.d.ts.map +1 -1
- package/dist/apps/relay/Sponsorships.js +71 -60
- package/dist/apps/relay/Sponsorships.js.map +1 -1
- package/dist/apps/routes/Access.d.ts +53 -0
- package/dist/apps/routes/Access.d.ts.map +1 -1
- package/dist/apps/routes/Access.js +121 -0
- package/dist/apps/routes/Access.js.map +1 -1
- package/dist/apps/routes/App.d.ts +397 -158
- package/dist/apps/routes/App.d.ts.map +1 -1
- package/dist/apps/routes/App.js.map +1 -1
- package/dist/apps/routes/routes/chains.d.ts +25 -25
- package/dist/apps/routes/routes/deposit-addresses.d.ts +169 -61
- package/dist/apps/routes/routes/deposit-addresses.d.ts.map +1 -1
- package/dist/apps/routes/routes/deposit-addresses.js +217 -32
- package/dist/apps/routes/routes/deposit-addresses.js.map +1 -1
- package/dist/apps/routes/routes/quotes.d.ts +171 -81
- package/dist/apps/routes/routes/quotes.d.ts.map +1 -1
- package/dist/apps/routes/routes/quotes.js +101 -27
- package/dist/apps/routes/routes/quotes.js.map +1 -1
- package/dist/apps/routes/routes/transfers.d.ts +532 -480
- package/dist/apps/routes/routes/transfers.d.ts.map +1 -1
- package/dist/apps/routes/routes/transfers.js +182 -37
- package/dist/apps/routes/routes/transfers.js.map +1 -1
- package/dist/cli/ApiKeys.d.ts +120 -0
- package/dist/cli/ApiKeys.d.ts.map +1 -0
- package/dist/cli/ApiKeys.js +138 -0
- package/dist/cli/ApiKeys.js.map +1 -0
- package/dist/cli/Cli.d.ts +92 -34
- package/dist/cli/Cli.d.ts.map +1 -1
- package/dist/cli/Cli.js +188 -11
- package/dist/cli/Cli.js.map +1 -1
- package/dist/cli/Credentials.d.ts +95 -0
- package/dist/cli/Credentials.d.ts.map +1 -0
- package/dist/cli/Credentials.js +110 -0
- package/dist/cli/Credentials.js.map +1 -0
- package/dist/cli/Spec.d.ts +59 -0
- package/dist/cli/Spec.d.ts.map +1 -0
- package/dist/cli/Spec.js +77 -0
- package/dist/cli/Spec.js.map +1 -0
- package/dist/cli/bin.js +5 -1
- package/dist/cli/bin.js.map +1 -1
- package/dist/cli/commands/admin.d.ts +5 -5
- package/dist/cli/commands/admin.d.ts.map +1 -1
- package/dist/cli/commands/auth.d.ts +73 -0
- package/dist/cli/commands/auth.d.ts.map +1 -0
- package/dist/cli/commands/auth.js +204 -0
- package/dist/cli/commands/auth.js.map +1 -0
- package/dist/cli/commands/keys.d.ts +17 -0
- package/dist/cli/commands/keys.d.ts.map +1 -0
- package/dist/cli/commands/keys.js +109 -0
- package/dist/cli/commands/keys.js.map +1 -0
- package/dist/cloudflare.d.ts +27 -2
- package/dist/cloudflare.d.ts.map +1 -1
- package/dist/cloudflare.js +144 -17
- package/dist/cloudflare.js.map +1 -1
- package/dist/db/Db.d.ts +23 -0
- package/dist/db/Db.d.ts.map +1 -1
- package/dist/db/Db.js +413 -1
- package/dist/db/Db.js.map +1 -1
- package/dist/db/Schema.d.ts +44 -1
- package/dist/db/Schema.d.ts.map +1 -1
- package/dist/db/Schema.js +56 -3
- package/dist/db/Schema.js.map +1 -1
- package/dist/db/tables/apiKeyAdmissions.d.ts +28 -2
- package/dist/db/tables/apiKeyAdmissions.d.ts.map +1 -1
- package/dist/db/tables/apiKeyAdmissions.js +65 -9
- package/dist/db/tables/apiKeyAdmissions.js.map +1 -1
- package/dist/db/tables/apiKeyOwnerTombstones.d.ts +2 -0
- package/dist/db/tables/apiKeyOwnerTombstones.d.ts.map +1 -1
- package/dist/db/tables/apiKeyOwnerTombstones.js +2 -2
- package/dist/db/tables/apiKeyOwnerTombstones.js.map +1 -1
- package/dist/db/tables/authAccounts.d.ts.map +1 -1
- package/dist/db/tables/authAccounts.js +1 -0
- package/dist/db/tables/authAccounts.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 +12 -1
- package/dist/db/tables/earnVaults.js.map +1 -1
- package/dist/db/tables/organizations.d.ts +4 -2
- package/dist/db/tables/organizations.d.ts.map +1 -1
- package/dist/db/tables/organizations.js +8 -34
- package/dist/db/tables/organizations.js.map +1 -1
- package/dist/db/tables/requestUsage.d.ts +5 -1
- package/dist/db/tables/requestUsage.d.ts.map +1 -1
- package/dist/db/tables/requestUsage.js +10 -2
- package/dist/db/tables/requestUsage.js.map +1 -1
- package/dist/db/tables/rewardEligibilityAssociations.d.ts +13 -0
- package/dist/db/tables/rewardEligibilityAssociations.d.ts.map +1 -1
- package/dist/db/tables/rewardEligibilityAssociations.js +11 -0
- package/dist/db/tables/rewardEligibilityAssociations.js.map +1 -1
- package/dist/db/tables/rewardRuns.d.ts.map +1 -1
- package/dist/db/tables/rewardRuns.js +4 -0
- package/dist/db/tables/rewardRuns.js.map +1 -1
- package/dist/db/tables/rewardTransactionAttempts.d.ts.map +1 -1
- package/dist/db/tables/rewardTransactionAttempts.js +2 -0
- package/dist/db/tables/rewardTransactionAttempts.js.map +1 -1
- package/dist/db/tables/routesDepositAddresses.d.ts +29 -0
- package/dist/db/tables/routesDepositAddresses.d.ts.map +1 -1
- package/dist/db/tables/routesDepositAddresses.js +84 -31
- package/dist/db/tables/routesDepositAddresses.js.map +1 -1
- package/dist/db/tables/routesDeposits.d.ts.map +1 -1
- package/dist/db/tables/routesDeposits.js +31 -21
- package/dist/db/tables/routesDeposits.js.map +1 -1
- package/dist/db/tables/routesIdempotency.d.ts.map +1 -1
- package/dist/db/tables/routesIdempotency.js +2 -0
- package/dist/db/tables/routesIdempotency.js.map +1 -1
- package/dist/db/tables/routesPolicies.d.ts +58 -0
- package/dist/db/tables/routesPolicies.d.ts.map +1 -0
- package/dist/db/tables/routesPolicies.js +198 -0
- package/dist/db/tables/routesPolicies.js.map +1 -0
- package/dist/db/tables/routesTransferSubsidies.d.ts +22 -0
- package/dist/db/tables/routesTransferSubsidies.d.ts.map +1 -1
- package/dist/db/tables/routesTransferSubsidies.js +41 -0
- package/dist/db/tables/routesTransferSubsidies.js.map +1 -1
- package/dist/db/tables/routesTransferSubsidyNonces.d.ts.map +1 -1
- package/dist/db/tables/routesTransferSubsidyNonces.js +12 -4
- package/dist/db/tables/routesTransferSubsidyNonces.js.map +1 -1
- package/dist/db/tables/routesTransfers.d.ts +26 -1
- package/dist/db/tables/routesTransfers.d.ts.map +1 -1
- package/dist/db/tables/routesTransfers.js +36 -6
- package/dist/db/tables/routesTransfers.js.map +1 -1
- package/dist/db/tables/sponsoredTransactions.d.ts +45 -13
- package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -1
- package/dist/db/tables/sponsoredTransactions.js +144 -33
- package/dist/db/tables/sponsoredTransactions.js.map +1 -1
- package/dist/db/tables/users.d.ts +2 -0
- package/dist/db/tables/users.d.ts.map +1 -1
- package/dist/db/tables/users.js +11 -0
- package/dist/db/tables/users.js.map +1 -1
- package/dist/handlers/internal/multisig.d.ts +1 -1
- package/dist/handlers/internal/multisig.d.ts.map +1 -1
- package/dist/handlers/internal/multisig.js +3 -2
- package/dist/handlers/internal/multisig.js.map +1 -1
- package/dist/handlers/relay.d.ts +2 -0
- package/dist/handlers/relay.d.ts.map +1 -1
- package/dist/handlers/relay.js +34 -15
- package/dist/handlers/relay.js.map +1 -1
- package/dist/internal/Auth.d.ts +57 -6
- package/dist/internal/Auth.d.ts.map +1 -1
- package/dist/internal/Auth.js +182 -78
- package/dist/internal/Auth.js.map +1 -1
- package/dist/internal/BetterAuth.d.ts +22 -0
- package/dist/internal/BetterAuth.d.ts.map +1 -1
- package/dist/internal/BetterAuth.js +17 -14
- package/dist/internal/BetterAuth.js.map +1 -1
- package/dist/internal/Cache.d.ts +5 -0
- package/dist/internal/Cache.d.ts.map +1 -1
- package/dist/internal/Cache.js +3 -1
- package/dist/internal/Cache.js.map +1 -1
- package/dist/internal/CliAuth.d.ts +243 -0
- package/dist/internal/CliAuth.d.ts.map +1 -0
- package/dist/internal/CliAuth.js +249 -0
- package/dist/internal/CliAuth.js.map +1 -0
- package/dist/internal/EarnSharePrices.d.ts +1 -1
- package/dist/internal/EarnSharePrices.d.ts.map +1 -1
- package/dist/internal/EarnSharePrices.js +7 -3
- package/dist/internal/EarnSharePrices.js.map +1 -1
- package/dist/internal/EarnVaults.d.ts +47 -0
- package/dist/internal/EarnVaults.d.ts.map +1 -1
- package/dist/internal/EarnVaults.js +188 -4
- package/dist/internal/EarnVaults.js.map +1 -1
- package/dist/internal/EarnWithdrawals.d.ts +73 -0
- package/dist/internal/EarnWithdrawals.d.ts.map +1 -0
- package/dist/internal/EarnWithdrawals.js +189 -0
- package/dist/internal/EarnWithdrawals.js.map +1 -0
- package/dist/internal/ExecutionContext.d.ts +21 -0
- package/dist/internal/ExecutionContext.d.ts.map +1 -0
- package/dist/internal/ExecutionContext.js +16 -0
- package/dist/internal/ExecutionContext.js.map +1 -0
- package/dist/internal/Log.d.ts +7 -3
- package/dist/internal/Log.d.ts.map +1 -1
- package/dist/internal/Log.js +163 -130
- package/dist/internal/Log.js.map +1 -1
- package/dist/internal/MetricSink.d.ts.map +1 -1
- package/dist/internal/MetricSink.js +26 -1
- package/dist/internal/MetricSink.js.map +1 -1
- package/dist/internal/RateLimit.d.ts +67 -0
- package/dist/internal/RateLimit.d.ts.map +1 -1
- package/dist/internal/RateLimit.js +174 -27
- package/dist/internal/RateLimit.js.map +1 -1
- package/dist/internal/Store.d.ts +6 -0
- package/dist/internal/Store.d.ts.map +1 -1
- package/dist/internal/Store.js +4 -5
- package/dist/internal/Store.js.map +1 -1
- package/dist/internal/Timing.d.ts +6 -0
- package/dist/internal/Timing.d.ts.map +1 -1
- package/dist/internal/Timing.js +21 -1
- package/dist/internal/Timing.js.map +1 -1
- package/dist/internal/Tron.d.ts +124 -0
- package/dist/internal/Tron.d.ts.map +1 -0
- package/dist/internal/Tron.js +202 -0
- package/dist/internal/Tron.js.map +1 -0
- package/dist/internal/Viem.d.ts +4 -0
- package/dist/internal/Viem.d.ts.map +1 -1
- package/dist/internal/Viem.js +25 -6
- package/dist/internal/Viem.js.map +1 -1
- package/dist/internal/rewards/Read.d.ts +2 -2
- package/dist/internal/rewards/Read.d.ts.map +1 -1
- package/dist/internal/rewards/Read.js +11 -2
- package/dist/internal/rewards/Read.js.map +1 -1
- package/dist/internal/routes/Action.d.ts +27 -0
- package/dist/internal/routes/Action.d.ts.map +1 -1
- package/dist/internal/routes/Action.js +49 -1
- package/dist/internal/routes/Action.js.map +1 -1
- package/dist/internal/routes/Chain.d.ts +2 -0
- package/dist/internal/routes/Chain.d.ts.map +1 -1
- package/dist/internal/routes/Chain.js +4 -0
- package/dist/internal/routes/Chain.js.map +1 -1
- package/dist/internal/routes/DepositAddress.d.ts.map +1 -1
- package/dist/internal/routes/DepositAddress.js +5 -0
- package/dist/internal/routes/DepositAddress.js.map +1 -1
- package/dist/internal/routes/Evidence.d.ts.map +1 -1
- package/dist/internal/routes/Evidence.js +6 -2
- package/dist/internal/routes/Evidence.js.map +1 -1
- package/dist/internal/routes/EvmTransferSettlement.d.ts +17 -0
- package/dist/internal/routes/EvmTransferSettlement.d.ts.map +1 -0
- package/dist/internal/routes/EvmTransferSettlement.js +196 -0
- package/dist/internal/routes/EvmTransferSettlement.js.map +1 -0
- package/dist/internal/routes/Policy.d.ts +161 -0
- package/dist/internal/routes/Policy.d.ts.map +1 -0
- package/dist/internal/routes/Policy.js +249 -0
- package/dist/internal/routes/Policy.js.map +1 -0
- package/dist/internal/routes/Provider.d.ts +66 -3
- package/dist/internal/routes/Provider.d.ts.map +1 -1
- package/dist/internal/routes/Provider.js +106 -27
- package/dist/internal/routes/Provider.js.map +1 -1
- package/dist/internal/routes/Quota.d.ts +57 -0
- package/dist/internal/routes/Quota.d.ts.map +1 -0
- package/dist/internal/routes/Quota.js +144 -0
- package/dist/internal/routes/Quota.js.map +1 -0
- package/dist/internal/routes/Reconciliation.d.ts.map +1 -1
- package/dist/internal/routes/Reconciliation.js +163 -47
- package/dist/internal/routes/Reconciliation.js.map +1 -1
- package/dist/internal/routes/SolanaTransferSettlement.d.ts +12 -0
- package/dist/internal/routes/SolanaTransferSettlement.d.ts.map +1 -0
- package/dist/internal/routes/SolanaTransferSettlement.js +220 -0
- package/dist/internal/routes/SolanaTransferSettlement.js.map +1 -0
- package/dist/internal/routes/SolanaTransferSubsidy.d.ts +172 -0
- package/dist/internal/routes/SolanaTransferSubsidy.d.ts.map +1 -0
- package/dist/internal/routes/SolanaTransferSubsidy.js +564 -0
- package/dist/internal/routes/SolanaTransferSubsidy.js.map +1 -0
- package/dist/internal/routes/Subsidy.d.ts +2 -2
- package/dist/internal/routes/Subsidy.d.ts.map +1 -1
- package/dist/internal/routes/Subsidy.js +2 -2
- package/dist/internal/routes/Subsidy.js.map +1 -1
- package/dist/internal/routes/Transfer.d.ts +229 -1
- package/dist/internal/routes/Transfer.d.ts.map +1 -1
- package/dist/internal/routes/Transfer.js +644 -7
- package/dist/internal/routes/Transfer.js.map +1 -1
- package/dist/internal/routes/TransferReconciliation.d.ts +6 -0
- package/dist/internal/routes/TransferReconciliation.d.ts.map +1 -1
- package/dist/internal/routes/TransferReconciliation.js +83 -159
- package/dist/internal/routes/TransferReconciliation.js.map +1 -1
- package/dist/internal/routes/TransferSettlement.d.ts +45 -0
- package/dist/internal/routes/TransferSettlement.d.ts.map +1 -0
- package/dist/internal/routes/TransferSettlement.js +2 -0
- package/dist/internal/routes/TransferSettlement.js.map +1 -0
- package/dist/internal/routes/TransferSubsidy.d.ts +23 -8
- package/dist/internal/routes/TransferSubsidy.d.ts.map +1 -1
- package/dist/internal/routes/TransferSubsidy.js +64 -5
- package/dist/internal/routes/TransferSubsidy.js.map +1 -1
- package/dist/internal/routes/TronTransferSettlement.d.ts +12 -0
- package/dist/internal/routes/TronTransferSettlement.d.ts.map +1 -0
- package/dist/internal/routes/TronTransferSettlement.js +201 -0
- package/dist/internal/routes/TronTransferSettlement.js.map +1 -0
- package/dist/internal/routes/TronTransferSubsidy.d.ts +174 -0
- package/dist/internal/routes/TronTransferSubsidy.d.ts.map +1 -0
- package/dist/internal/routes/TronTransferSubsidy.js +439 -0
- package/dist/internal/routes/TronTransferSubsidy.js.map +1 -0
- package/dist/internal/routes/index.d.ts +3 -0
- package/dist/internal/routes/index.d.ts.map +1 -1
- package/dist/internal/routes/index.js +3 -0
- package/dist/internal/routes/index.js.map +1 -1
- package/dist/internal/routes/providers/across.d.ts +3 -0
- package/dist/internal/routes/providers/across.d.ts.map +1 -1
- package/dist/internal/routes/providers/across.js +11 -0
- package/dist/internal/routes/providers/across.js.map +1 -1
- package/dist/internal/routes/providers/legacyMesh.d.ts +29 -0
- package/dist/internal/routes/providers/legacyMesh.d.ts.map +1 -0
- package/dist/internal/routes/providers/legacyMesh.js +474 -0
- package/dist/internal/routes/providers/legacyMesh.js.map +1 -0
- package/dist/internal/routes/providers/legacyMeshDelivery.d.ts +59 -0
- package/dist/internal/routes/providers/legacyMeshDelivery.d.ts.map +1 -0
- package/dist/internal/routes/providers/legacyMeshDelivery.js +229 -0
- package/dist/internal/routes/providers/legacyMeshDelivery.js.map +1 -0
- package/dist/internal/routes/providers/legacyMeshOutbound.d.ts +19 -0
- package/dist/internal/routes/providers/legacyMeshOutbound.d.ts.map +1 -0
- package/dist/internal/routes/providers/legacyMeshOutbound.js +457 -0
- package/dist/internal/routes/providers/legacyMeshOutbound.js.map +1 -0
- package/dist/internal/routes/providers/legacyMeshOutboundDelivery.d.ts +123 -0
- package/dist/internal/routes/providers/legacyMeshOutboundDelivery.d.ts.map +1 -0
- package/dist/internal/routes/providers/legacyMeshOutboundDelivery.js +333 -0
- package/dist/internal/routes/providers/legacyMeshOutboundDelivery.js.map +1 -0
- package/dist/internal/routes/providers/propAmm.d.ts +70 -0
- package/dist/internal/routes/providers/propAmm.d.ts.map +1 -0
- package/dist/internal/routes/providers/propAmm.js +524 -0
- package/dist/internal/routes/providers/propAmm.js.map +1 -0
- package/dist/internal/routes/providers/relay.d.ts +3 -0
- package/dist/internal/routes/providers/relay.d.ts.map +1 -1
- package/dist/internal/routes/providers/relay.js +352 -41
- package/dist/internal/routes/providers/relay.js.map +1 -1
- package/dist/internal/routes/providers/rhino.d.ts +3 -0
- package/dist/internal/routes/providers/rhino.d.ts.map +1 -1
- package/dist/internal/routes/providers/rhino.js +11 -0
- package/dist/internal/routes/providers/rhino.js.map +1 -1
- package/dist/internal/routes/providers/squid.d.ts +3 -0
- package/dist/internal/routes/providers/squid.d.ts.map +1 -1
- package/dist/internal/routes/providers/squid.js +19 -0
- package/dist/internal/routes/providers/squid.js.map +1 -1
- package/dist/internal/routes/providers/stargate.d.ts.map +1 -1
- package/dist/internal/routes/providers/stargate.js +22 -9
- package/dist/internal/routes/providers/stargate.js.map +1 -1
- package/dist/internal/routes/providers/symbiosis.d.ts.map +1 -1
- package/dist/internal/routes/providers/symbiosis.js +13 -17
- package/dist/internal/routes/providers/symbiosis.js.map +1 -1
- package/dist/providers/index.d.ts +14 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +6 -0
- package/dist/providers/index.js.map +1 -1
- package/package.json +16 -6
- package/src/ApiKey.ts +7 -3
- package/src/ApiKeys.test.ts +652 -8
- package/src/ApiKeys.ts +191 -11
- package/src/App.test.ts +405 -18
- package/src/App.ts +51 -15
- package/src/Client.test-d.ts +157 -10
- package/src/Client.test.ts +4 -4
- package/src/Scope.ts +1 -2
- package/src/admin/App.ts +11 -5
- package/src/admin/apps/api-keys.test.ts +98 -2
- package/src/admin/apps/api-keys.ts +21 -12
- package/src/admin/apps/earn-vaults.test.ts +76 -7
- package/src/admin/apps/earn-vaults.ts +47 -8
- package/src/admin/apps/organizations.test.ts +147 -31
- package/src/admin/apps/organizations.ts +5 -4
- package/src/admin/apps/route-policies.test.ts +220 -0
- package/src/admin/apps/route-policies.ts +322 -0
- package/src/admin/apps/routes-support.test.ts +107 -2
- package/src/admin/apps/routes-support.ts +43 -3
- package/src/admin/apps/routes.test.ts +150 -0
- package/src/admin/apps/routes.ts +97 -1
- package/src/admin/apps/scopes.test.ts +1 -1
- package/src/admin/index.ts +0 -1
- package/src/admin/ui/plugin.ts +2 -1
- package/src/admin/ui/src/components/Dialog.tsx +1 -1
- package/src/admin/ui/src/components/EarnVaultForm.tsx +45 -0
- package/src/admin/ui/src/components/RoutePicker.tsx +79 -0
- package/src/admin/ui/src/lib/earn-vaults.ts +1 -1
- package/src/admin/ui/src/lib/route-policies.test.ts +452 -0
- package/src/admin/ui/src/lib/route-policies.ts +232 -0
- package/src/admin/ui/src/lib/routes.ts +34 -0
- package/src/admin/ui/src/routeTree.gen.ts +21 -0
- package/src/admin/ui/src/routes/api-keys.tsx +21 -2
- package/src/admin/ui/src/routes/early-access.tsx +1 -0
- package/src/admin/ui/src/routes/earn.vaults.tsx +1 -0
- package/src/admin/ui/src/routes/earn.vaults_.$vaultId.edit.tsx +22 -0
- package/src/admin/ui/src/routes/earn.vaults_.new.tsx +10 -0
- package/src/admin/ui/src/routes/organizations.tsx +1 -0
- package/src/admin/ui/src/routes/organizations_.$orgId.tsx +18 -3
- package/src/admin/ui/src/routes/route-policies.tsx +678 -0
- package/src/admin/ui/src/routes/routes.tsx +85 -2
- package/src/admin/ui/src/routes/routes_.support.tsx +6 -22
- package/src/admin/ui/src/routes/subsidies.tsx +1 -0
- package/src/admin/ui/src/routes/verified-tokens.tsx +1 -0
- package/src/admin/ui.generated.ts +258 -202
- package/src/analytics/Analytics.test.ts +4 -50
- package/src/analytics/Analytics.ts +65 -1
- package/src/analytics/tables/requestEvents.test.ts +402 -1
- package/src/analytics/tables/requestEvents.ts +62 -93
- package/src/apps/data/routes/activities.test.ts +315 -14
- package/src/apps/data/routes/activities.ts +60 -0
- package/src/apps/data/routes/balances.ts +5 -7
- package/src/apps/data/routes/earn.bench.ts +18 -0
- package/src/apps/data/routes/earn.local.test.ts +507 -0
- package/src/apps/data/routes/earn.test.ts +405 -127
- package/src/apps/data/routes/earn.ts +660 -270
- package/src/apps/data/routes/exchanges.bench.ts +3 -1
- package/src/apps/data/routes/exchanges.test.ts +166 -2
- package/src/apps/data/routes/exchanges.ts +308 -101
- package/src/apps/data/routes/fee-amm.test.ts +134 -2
- package/src/apps/data/routes/fee-amm.ts +122 -60
- package/src/apps/data/routes/receipts.test.ts +21 -18
- package/src/apps/data/routes/rpc.test.ts +2 -2
- package/src/apps/data/routes/tokens.provenance.test.ts +157 -0
- package/src/apps/data/routes/tokens.test.ts +4 -4
- package/src/apps/data/routes/tokens.ts +11 -6
- package/src/apps/data/routes/transactions.test.ts +29 -0
- package/src/apps/data/routes/transactions.ts +33 -22
- package/src/apps/data/routes/webhooks.test.ts +12 -3
- package/src/apps/data/routes/webhooks.ts +2 -1
- package/src/apps/management/App.ts +4 -0
- package/src/apps/management/Billing.test.ts +253 -27
- package/src/apps/management/Billing.ts +83 -29
- package/src/apps/management/routes/api-keys.test.ts +1 -1
- package/src/apps/management/routes/api-keys.ts +85 -11
- package/src/apps/management/routes/billing.test.ts +68 -4
- package/src/apps/management/routes/cli.test.ts +370 -0
- package/src/apps/management/routes/cli.ts +533 -0
- package/src/apps/management/routes/me.test.ts +14 -4
- package/src/apps/management/routes/orgs.test.ts +108 -4
- package/src/apps/management/routes/orgs.ts +7 -2
- package/src/apps/management/routes/usage.test.ts +2 -2
- package/src/apps/mpp/internal/Policy.test.ts +51 -4
- package/src/apps/mpp/internal/Policy.ts +6 -2
- package/src/apps/mpp/internal/Sponsorship.test.ts +29 -0
- package/src/apps/mpp/internal/Sponsorship.ts +6 -4
- package/src/apps/relay/App.test.ts +85 -1
- package/src/apps/relay/App.ts +28 -4
- package/src/apps/relay/Sponsorships.test.ts +97 -1
- package/src/apps/relay/Sponsorships.ts +77 -66
- package/src/apps/routes/Access.test.ts +319 -0
- package/src/apps/routes/Access.ts +147 -0
- package/src/apps/routes/App.ts +10 -0
- package/src/apps/routes/routes/chains.test.ts +3 -2
- package/src/apps/routes/routes/deposit-addresses.test.ts +978 -34
- package/src/apps/routes/routes/deposit-addresses.ts +243 -32
- package/src/apps/routes/routes/propAmm.local.test.ts +951 -0
- package/src/apps/routes/routes/quotes.test.ts +81 -8
- package/src/apps/routes/routes/quotes.ts +109 -27
- package/src/apps/routes/routes/transfers.test.ts +252 -15
- package/src/apps/routes/routes/transfers.ts +212 -33
- package/src/cli/ApiKeys.test.ts +265 -0
- package/src/cli/ApiKeys.ts +189 -0
- package/src/cli/Cli.test.ts +188 -0
- package/src/cli/Cli.ts +280 -12
- package/src/cli/Credentials.test.ts +122 -0
- package/src/cli/Credentials.ts +144 -0
- package/src/cli/Spec.test.ts +133 -0
- package/src/cli/Spec.ts +132 -0
- package/src/cli/bin.test.ts +49 -0
- package/src/cli/bin.ts +5 -1
- package/src/cli/commands/auth.test.ts +138 -0
- package/src/cli/commands/auth.ts +254 -0
- package/src/cli/commands/keys.test.ts +68 -0
- package/src/cli/commands/keys.ts +125 -0
- package/src/cloudflare.ts +184 -36
- package/src/db/Db.test.ts +877 -0
- package/src/db/Db.ts +498 -1
- package/src/db/Schema.ts +75 -4
- package/src/db/tables/apiKeyAdmissions.test.ts +57 -0
- package/src/db/tables/apiKeyAdmissions.ts +101 -11
- package/src/db/tables/apiKeyOwnerTombstones.ts +2 -2
- package/src/db/tables/authAccounts.test.ts +30 -0
- package/src/db/tables/authAccounts.ts +1 -0
- package/src/db/tables/earnVaults.test.ts +34 -0
- package/src/db/tables/earnVaults.ts +17 -2
- package/src/db/tables/organizations.test.ts +148 -84
- package/src/db/tables/organizations.ts +11 -43
- package/src/db/tables/requestUsage.ts +13 -2
- package/src/db/tables/rewardCampaigns.test.ts +163 -0
- package/src/db/tables/rewardEligibilityAssociations.test.ts +14 -0
- package/src/db/tables/rewardEligibilityAssociations.ts +24 -0
- package/src/db/tables/rewardRuns.ts +4 -0
- package/src/db/tables/rewardTransactionAttempts.ts +2 -0
- package/src/db/tables/routesDepositAddresses.test.ts +263 -0
- package/src/db/tables/routesDepositAddresses.ts +118 -34
- package/src/db/tables/routesDeposits.test.ts +66 -5
- package/src/db/tables/routesDeposits.ts +47 -26
- package/src/db/tables/routesIdempotency.test.ts +80 -0
- package/src/db/tables/routesIdempotency.ts +2 -0
- package/src/db/tables/routesPolicies.test.ts +143 -0
- package/src/db/tables/routesPolicies.ts +251 -0
- package/src/db/tables/routesTransferSubsidies.ts +64 -0
- package/src/db/tables/routesTransferSubsidyNonces.ts +16 -4
- package/src/db/tables/routesTransfers.test.ts +183 -2
- package/src/db/tables/routesTransfers.ts +65 -6
- package/src/db/tables/sponsoredTransactions.test.ts +351 -76
- package/src/db/tables/sponsoredTransactions.ts +182 -38
- package/src/db/tables/users.test.ts +51 -0
- package/src/db/tables/users.ts +12 -0
- package/src/handlers/internal/multisig.store.test.ts +120 -0
- package/src/handlers/internal/multisig.test.ts +389 -0
- package/src/handlers/internal/multisig.ts +13 -10
- package/src/handlers/relay.test.ts +259 -83
- package/src/handlers/relay.ts +36 -17
- package/src/internal/Auth.test.ts +291 -8
- package/src/internal/Auth.ts +227 -96
- package/src/internal/BetterAuth.test.ts +58 -22
- package/src/internal/BetterAuth.ts +23 -17
- package/src/internal/Cache.ts +3 -1
- package/src/internal/CliAuth.test.ts +279 -0
- package/src/internal/CliAuth.ts +319 -0
- package/src/internal/EarnSharePrices.test.ts +25 -0
- package/src/internal/EarnSharePrices.ts +9 -2
- package/src/internal/EarnVaults.test.ts +67 -0
- package/src/internal/EarnVaults.ts +299 -4
- package/src/internal/EarnWithdrawals.test.ts +315 -0
- package/src/internal/EarnWithdrawals.ts +266 -0
- package/src/internal/ExecutionContext.ts +31 -0
- package/src/internal/Log.test.ts +210 -0
- package/src/internal/Log.ts +180 -142
- package/src/internal/MetricSink.test.ts +190 -15
- package/src/internal/MetricSink.ts +27 -1
- package/src/internal/RateLimit.test.ts +144 -8
- package/src/internal/RateLimit.ts +254 -26
- package/src/internal/Store.ts +4 -5
- package/src/internal/Timing.test.ts +32 -0
- package/src/internal/Timing.ts +20 -1
- package/src/internal/Tron.test-d.ts +22 -0
- package/src/internal/Tron.test.ts +94 -0
- package/src/internal/Tron.ts +289 -0
- package/src/internal/Viem.rpc.test.ts +76 -0
- package/src/internal/Viem.ts +29 -6
- package/src/internal/rewards/Read.test.ts +109 -0
- package/src/internal/rewards/Read.ts +13 -4
- package/src/internal/routes/Action.test.ts +70 -0
- package/src/internal/routes/Action.ts +76 -1
- package/src/internal/routes/Chain.test.ts +18 -0
- package/src/internal/routes/Chain.ts +5 -0
- package/src/internal/routes/DepositAddress.ts +5 -0
- package/src/internal/routes/Evidence.test.ts +64 -0
- package/src/internal/routes/Evidence.ts +11 -3
- package/src/internal/routes/EvmTransferSettlement.ts +213 -0
- package/src/internal/routes/Policy.test.ts +316 -0
- package/src/internal/routes/Policy.ts +399 -0
- package/src/internal/routes/Provider.test.ts +103 -2
- package/src/internal/routes/Provider.ts +149 -27
- package/src/internal/routes/Quota.test.ts +149 -0
- package/src/internal/routes/Quota.ts +226 -0
- package/src/internal/routes/Reconciliation.local.test.ts +285 -0
- package/src/internal/routes/Reconciliation.test.ts +371 -13
- package/src/internal/routes/Reconciliation.ts +193 -42
- package/src/internal/routes/SolanaTransferSettlement.ts +232 -0
- package/src/internal/routes/SolanaTransferSubsidy.test.ts +471 -0
- package/src/internal/routes/SolanaTransferSubsidy.ts +760 -0
- package/src/internal/routes/SourceObservation.test.ts +221 -0
- package/src/internal/routes/Subsidy.local.test.ts +46 -0
- package/src/internal/routes/Subsidy.ts +4 -2
- package/src/internal/routes/Transfer.solana.test.ts +389 -0
- package/src/internal/routes/Transfer.test.ts +130 -1
- package/src/internal/routes/Transfer.tron.test.ts +172 -0
- package/src/internal/routes/Transfer.ts +866 -8
- package/src/internal/routes/TransferReconciliation.test.ts +26 -4
- package/src/internal/routes/TransferReconciliation.ts +91 -166
- package/src/internal/routes/TransferSettlement.ts +48 -0
- package/src/internal/routes/TransferSubsidy.local.test.ts +143 -0
- package/src/internal/routes/TransferSubsidy.test.ts +34 -4
- package/src/internal/routes/TransferSubsidy.ts +87 -12
- package/src/internal/routes/TronTransferSettlement.ts +212 -0
- package/src/internal/routes/TronTransferSubsidy.test.ts +109 -0
- package/src/internal/routes/TronTransferSubsidy.ts +619 -0
- package/src/internal/routes/index.test.ts +3 -0
- package/src/internal/routes/index.ts +3 -0
- package/src/internal/routes/providers/across.ts +13 -0
- package/src/internal/routes/providers/index.test.ts +141 -0
- package/src/internal/routes/providers/legacyMesh.test.ts +484 -0
- package/src/internal/routes/providers/legacyMesh.ts +633 -0
- package/src/internal/routes/providers/legacyMeshDelivery.test.ts +306 -0
- package/src/internal/routes/providers/legacyMeshDelivery.ts +320 -0
- package/src/internal/routes/providers/legacyMeshOutbound.test.ts +401 -0
- package/src/internal/routes/providers/legacyMeshOutbound.ts +566 -0
- package/src/internal/routes/providers/legacyMeshOutboundDelivery.ts +473 -0
- package/src/internal/routes/providers/propAmm.ts +640 -0
- package/src/internal/routes/providers/relay.test.ts +1263 -41
- package/src/internal/routes/providers/relay.ts +423 -38
- package/src/internal/routes/providers/rhino.ts +14 -1
- package/src/internal/routes/providers/squid.ts +21 -0
- package/src/internal/routes/providers/stargate.test.ts +105 -1
- package/src/internal/routes/providers/stargate.ts +22 -9
- package/src/internal/routes/providers/symbiosis.ts +13 -47
- package/src/providers/index.test.ts +2 -0
- package/src/providers/index.ts +18 -0
- package/dist/admin/Access.d.ts +0 -39
- package/dist/admin/Access.d.ts.map +0 -1
- package/dist/admin/Access.js +0 -73
- package/dist/admin/Access.js.map +0 -1
- package/src/admin/Access.test.ts +0 -130
- package/src/admin/Access.ts +0 -85
|
@@ -324,7 +324,7 @@ describe.skipIf(!Anvil.available)('createTracker', () => {
|
|
|
324
324
|
}),
|
|
325
325
|
})
|
|
326
326
|
const snapshot = TestRoutes.transferSnapshot()
|
|
327
|
-
const account = Anvil.
|
|
327
|
+
const account = Anvil.getSubsidyAccount(5)
|
|
328
328
|
const recipient = '0x10a3097afe2c7ebc8f1c621bc9bb371c4dff76a8'
|
|
329
329
|
const sourceTransactionHash =
|
|
330
330
|
'0x9664a5b8dff87c44181abb174b295fd91b2eedae5cff6dacfbd83ab3d8350e88'
|
|
@@ -359,7 +359,7 @@ describe.skipIf(!Anvil.available)('createTracker', () => {
|
|
|
359
359
|
policy: { maxAmount: '5' },
|
|
360
360
|
})
|
|
361
361
|
const rotatedSubsidies = TransferSubsidy.create({
|
|
362
|
-
account: Anvil.
|
|
362
|
+
account: Anvil.getSubsidyAccount(6),
|
|
363
363
|
fetch: globalThis.fetch,
|
|
364
364
|
policy: { maxAmount: '5' },
|
|
365
365
|
})
|
|
@@ -445,8 +445,30 @@ describe.skipIf(!Anvil.available)('createTracker', () => {
|
|
|
445
445
|
await expect(
|
|
446
446
|
tracker.reconcile({ transferId: transfer.id, type: 'routes:transfer:reconcile' }),
|
|
447
447
|
).resolves.toEqual({ type: 'pending' })
|
|
448
|
-
|
|
449
|
-
|
|
448
|
+
const pending = await RoutesTransfers.get(database, transfer.id)
|
|
449
|
+
const transaction = TransferSubsidy.read(pending?.providerState?.['transferSubsidy'])
|
|
450
|
+
expect(transaction).toBeDefined()
|
|
451
|
+
if (!transaction) throw new Error('The destination subsidy was not prepared.')
|
|
452
|
+
const subsidyReceipt = await source.client.waitForTransactionReceipt({
|
|
453
|
+
hash: transaction.hash,
|
|
454
|
+
timeout: 10_000,
|
|
455
|
+
})
|
|
456
|
+
expect(subsidyReceipt.status).toBe('success')
|
|
457
|
+
|
|
458
|
+
const deadline = Date.now() + 20_000
|
|
459
|
+
let finalized = await source.client.getBlock({ blockTag: 'finalized' })
|
|
460
|
+
for (
|
|
461
|
+
let i = 0;
|
|
462
|
+
i < 32 && finalized.number < subsidyReceipt.blockNumber && Date.now() < deadline;
|
|
463
|
+
i++
|
|
464
|
+
) {
|
|
465
|
+
await source.client.mine({ blocks: 8 })
|
|
466
|
+
finalized = await source.client.getBlock({ blockTag: 'finalized' })
|
|
467
|
+
}
|
|
468
|
+
expect(
|
|
469
|
+
finalized.number,
|
|
470
|
+
`Subsidy receipt block ${subsidyReceipt.blockNumber} was not finalized; finalized block is ${finalized.number}.`,
|
|
471
|
+
).toBeGreaterThanOrEqual(subsidyReceipt.blockNumber)
|
|
450
472
|
await expect(tracker.reconcile(dispatches[0]!)).resolves.toEqual({ type: 'completed' })
|
|
451
473
|
const completed = await RoutesTransfers.get(database, transfer.id)
|
|
452
474
|
expect(completed).toMatchObject({
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { getAddress } from 'viem'
|
|
2
|
-
|
|
3
1
|
import * as Db from '../../db/Db.js'
|
|
4
2
|
import * as RoutesTransferTransactions from '../../db/tables/routesTransferTransactions.js'
|
|
5
3
|
import * as RoutesTransfers from '../../db/tables/routesTransfers.js'
|
|
@@ -8,10 +6,15 @@ import * as MetricSink from '../MetricSink.js'
|
|
|
8
6
|
import * as Value from '../Value.js'
|
|
9
7
|
import type * as Webhooks from '../Webhooks.js'
|
|
10
8
|
import * as Catalog from './Catalog.js'
|
|
9
|
+
import * as EvmTransferSettlement from './EvmTransferSettlement.js'
|
|
11
10
|
import * as Observability from './Observability.js'
|
|
12
11
|
import * as Provider from './Provider.js'
|
|
12
|
+
import * as SolanaTransferSubsidy from './SolanaTransferSubsidy.js'
|
|
13
|
+
import * as SolanaTransferSettlement from './SolanaTransferSettlement.js'
|
|
13
14
|
import * as Transfer from './Transfer.js'
|
|
14
15
|
import * as TransferSubsidy from './TransferSubsidy.js'
|
|
16
|
+
import * as TronTransferSubsidy from './TronTransferSubsidy.js'
|
|
17
|
+
import * as TronTransferSettlement from './TronTransferSettlement.js'
|
|
15
18
|
|
|
16
19
|
const followUpDelaySeconds = 2
|
|
17
20
|
const maximumFollowUpAttempts = 900
|
|
@@ -97,9 +100,32 @@ export function createTracker(options: createTracker.Options): createTracker.Tra
|
|
|
97
100
|
),
|
|
98
101
|
{ onAttempt: recordProviderOperation, operation: 'verifyDestinationDelivery' },
|
|
99
102
|
)
|
|
103
|
+
if (delivery.type === 'action-required')
|
|
104
|
+
return actionRequired(transfer, options, delivery.statusReason)
|
|
100
105
|
if (delivery.type === 'invalid')
|
|
101
106
|
throw new EvidenceError('Tempo delivery conflicts with registered transfer terms.')
|
|
102
107
|
if (delivery.type === 'pending') {
|
|
108
|
+
const cursor = delivery.providerState?.['tronEventCursor']
|
|
109
|
+
if (cursor !== undefined) {
|
|
110
|
+
const packet = transfer.providerState?.['legacyMeshOutbound']
|
|
111
|
+
const guid =
|
|
112
|
+
packet && typeof packet === 'object' && 'guid' in packet ? packet.guid : undefined
|
|
113
|
+
const previousCursor = transfer.providerState?.['tronEventCursor'] ?? null
|
|
114
|
+
if (
|
|
115
|
+
transfer.providerId !== 'legacy-mesh' ||
|
|
116
|
+
typeof guid !== 'string' ||
|
|
117
|
+
!isTronEventCursor(cursor) ||
|
|
118
|
+
!isTronEventCursor(previousCursor)
|
|
119
|
+
)
|
|
120
|
+
throw new EvidenceError('Destination scan cursor conflicts with provider evidence.')
|
|
121
|
+
if (cursor !== null || previousCursor !== null)
|
|
122
|
+
await RoutesTransfers.recordTronEventCursor(db, {
|
|
123
|
+
cursor,
|
|
124
|
+
guid,
|
|
125
|
+
id: transfer.id,
|
|
126
|
+
previousCursor,
|
|
127
|
+
})
|
|
128
|
+
}
|
|
103
129
|
const verified = await Provider.observe(
|
|
104
130
|
provider,
|
|
105
131
|
() =>
|
|
@@ -141,6 +167,12 @@ export function createTracker(options: createTracker.Options): createTracker.Tra
|
|
|
141
167
|
return followUp(message, options, recordOutcome)
|
|
142
168
|
}
|
|
143
169
|
|
|
170
|
+
const verifiedAmount = Value.tokenAmount({
|
|
171
|
+
baseUnits: delivery.destinationAmount ?? destinationAmount.baseUnits,
|
|
172
|
+
currency: destinationAmount.currency,
|
|
173
|
+
decimals: destinationAmount.decimals,
|
|
174
|
+
})
|
|
175
|
+
|
|
144
176
|
const providerDelivery = await Transfer.recordProviderDelivery(db, { id: transfer.id })
|
|
145
177
|
if (providerDelivery.type === 'invalid' || providerDelivery.type === 'not_found') {
|
|
146
178
|
recordOutcome('invalid_state')
|
|
@@ -154,173 +186,54 @@ export function createTracker(options: createTracker.Options): createTracker.Tra
|
|
|
154
186
|
}
|
|
155
187
|
let current = providerDelivery.record
|
|
156
188
|
const transactionHashes: [string, ...string[]] = [delivery.transactionHash]
|
|
157
|
-
let deliveredAmount =
|
|
189
|
+
let deliveredAmount = verifiedAmount
|
|
158
190
|
if (transfer.snapshot.subsidize) {
|
|
159
191
|
const required = transfer.snapshot.destinationAmountRequired
|
|
160
192
|
if (!required) throw new EvidenceError('Normalized destination amount is missing.')
|
|
161
|
-
const deficit = BigInt(required.baseUnits) - BigInt(
|
|
162
|
-
// A fully covered quote may have no subsidy signer commitment.
|
|
193
|
+
const deficit = BigInt(required.baseUnits) - BigInt(verifiedAmount.baseUnits)
|
|
163
194
|
if (deficit > 0n) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
recordSubsidy('unavailable')
|
|
172
|
-
return actionRequired(current, options, {
|
|
173
|
-
code: 'subsidy_failed',
|
|
174
|
-
message: 'Destination subsidy settlement is unavailable.',
|
|
175
|
-
})
|
|
176
|
-
}
|
|
177
|
-
if (!transaction) {
|
|
178
|
-
const commitment = current.subsidyCommitmentAmount
|
|
179
|
-
if (!commitment || deficit > BigInt(commitment.baseUnits)) {
|
|
180
|
-
recordSubsidy('routes_subsidy_limit_exceeded')
|
|
181
|
-
return actionRequired(current, options, {
|
|
182
|
-
code: 'routes_subsidy_limit_exceeded',
|
|
183
|
-
message: 'The required destination subsidy exceeds its approved commitment.',
|
|
184
|
-
})
|
|
185
|
-
}
|
|
186
|
-
const pendingNonce = await settler.pendingNonce({ chain: destinationChain })
|
|
187
|
-
const subsidyAmount = Value.tokenAmount({
|
|
188
|
-
baseUnits: deficit,
|
|
189
|
-
currency: transfer.snapshot.destinationToken.currency,
|
|
190
|
-
decimals: transfer.snapshot.destinationToken.decimals,
|
|
191
|
-
})
|
|
192
|
-
const reserved = await Transfer.reserveSubsidy(db, {
|
|
193
|
-
account: settler.account,
|
|
194
|
-
chainId: destinationChain.id,
|
|
195
|
-
id: current.id,
|
|
196
|
-
orgId: current.orgId,
|
|
197
|
-
pendingNonce,
|
|
198
|
-
prepare: ({ nonce, reservations }) =>
|
|
199
|
-
settler.prepare({
|
|
200
|
-
amount: deficit,
|
|
201
|
-
chain: destinationChain,
|
|
202
|
-
nonce,
|
|
203
|
-
recipient: getAddress(transfer.snapshot.recipient),
|
|
204
|
-
reservations,
|
|
205
|
-
token: getAddress(transfer.snapshot.destinationToken.address),
|
|
206
|
-
}),
|
|
207
|
-
subsidyAmount,
|
|
208
|
-
tokenAddress: transfer.snapshot.destinationToken.address,
|
|
209
|
-
}).catch((cause) => {
|
|
210
|
-
if (cause instanceof Transfer.SubsidyEvidenceError) {
|
|
211
|
-
recordSubsidy('evidence_conflict')
|
|
212
|
-
throw cause
|
|
213
|
-
}
|
|
214
|
-
if (cause instanceof TransferSubsidy.BalanceUnavailableError) return undefined
|
|
215
|
-
if (cause instanceof Transfer.SubsidySignerBlockedError) return 'blocked' as const
|
|
216
|
-
if (TransferSubsidy.isPermanentPreparationError(cause)) return 'rejected' as const
|
|
217
|
-
throw cause
|
|
218
|
-
})
|
|
219
|
-
if (reserved === 'blocked') {
|
|
220
|
-
recordSubsidy('signer_blocked')
|
|
221
|
-
return actionRequired(current, options, {
|
|
222
|
-
code: 'subsidy_failed',
|
|
223
|
-
message: 'Destination subsidy settlement requires operator recovery.',
|
|
224
|
-
})
|
|
225
|
-
}
|
|
226
|
-
if (reserved === 'rejected') {
|
|
227
|
-
recordSubsidy('prepare_rejected')
|
|
228
|
-
return actionRequired(current, options, {
|
|
229
|
-
code: 'subsidy_failed',
|
|
230
|
-
message: 'The destination subsidy transaction could not be prepared.',
|
|
231
|
-
})
|
|
232
|
-
}
|
|
233
|
-
if (!reserved) {
|
|
234
|
-
recordSubsidy('balance_unavailable')
|
|
235
|
-
return actionRequired(current, options, {
|
|
236
|
-
code: 'subsidy_balance_unavailable',
|
|
237
|
-
message: 'Tempo lacks enough destination token inventory or native gas.',
|
|
238
|
-
})
|
|
239
|
-
}
|
|
240
|
-
if (reserved.type === 'invalid' || reserved.type === 'not_found') {
|
|
241
|
-
recordOutcome('invalid_state')
|
|
242
|
-
return { type: 'ignored' }
|
|
243
|
-
}
|
|
244
|
-
transaction = reserved.transaction
|
|
245
|
-
current = reserved.record
|
|
246
|
-
if (
|
|
247
|
-
(reserved.type === 'reserved' || reserved.type === 'shared') &&
|
|
248
|
-
options.dispatchTransferUpdates &&
|
|
249
|
-
reserved.references.length > 0
|
|
250
|
-
)
|
|
251
|
-
await options.dispatchTransferUpdates(reserved.references)
|
|
252
|
-
if (reserved.type === 'reserved') recordSubsidy('prepared')
|
|
253
|
-
if (reserved.type === 'shared') recordSubsidy('shared')
|
|
254
|
-
}
|
|
255
|
-
const status = await settler.status({
|
|
256
|
-
chain: destinationChain,
|
|
257
|
-
recipient: getAddress(transfer.snapshot.recipient),
|
|
258
|
-
token: getAddress(transfer.snapshot.destinationToken.address),
|
|
259
|
-
transaction,
|
|
260
|
-
})
|
|
261
|
-
if (status.type === 'reverted') {
|
|
262
|
-
recordSubsidy('reverted')
|
|
263
|
-
return actionRequired(
|
|
264
|
-
current,
|
|
265
|
-
options,
|
|
266
|
-
{
|
|
267
|
-
code: 'subsidy_failed',
|
|
268
|
-
message: 'The destination subsidy transaction reverted.',
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
subsidyAmount: Value.tokenAmount({
|
|
272
|
-
baseUnits: 0n,
|
|
273
|
-
currency: transfer.snapshot.destinationToken.currency,
|
|
274
|
-
decimals: transfer.snapshot.destinationToken.decimals,
|
|
275
|
-
}),
|
|
276
|
-
},
|
|
277
|
-
)
|
|
195
|
+
const settlementOptions = {
|
|
196
|
+
current,
|
|
197
|
+
db,
|
|
198
|
+
deficit,
|
|
199
|
+
destinationChain,
|
|
200
|
+
dispatchTransferUpdates: options.dispatchTransferUpdates,
|
|
201
|
+
recordSubsidy,
|
|
278
202
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
.
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
cause instanceof TransferSubsidy.TransactionHashMismatchError ||
|
|
288
|
-
TransferSubsidy.isPermanentBroadcastError(cause)
|
|
289
|
-
)
|
|
290
|
-
return true
|
|
291
|
-
recordSubsidy('broadcast_failed')
|
|
292
|
-
throw cause
|
|
203
|
+
const settlement = await (async () => {
|
|
204
|
+
switch (destinationChain.kind) {
|
|
205
|
+
case 'evm':
|
|
206
|
+
return EvmTransferSettlement.settle({
|
|
207
|
+
...settlementOptions,
|
|
208
|
+
metrics: options.metrics,
|
|
209
|
+
recordOutcome,
|
|
210
|
+
settlers: options.subsidies,
|
|
293
211
|
})
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
statusReason: {
|
|
299
|
-
code: 'subsidy_failed',
|
|
300
|
-
message: 'The destination subsidy transaction was rejected.',
|
|
301
|
-
},
|
|
212
|
+
case 'solana':
|
|
213
|
+
return SolanaTransferSettlement.settle({
|
|
214
|
+
...settlementOptions,
|
|
215
|
+
settlers: options.solanaSubsidies,
|
|
302
216
|
})
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}
|
|
311
|
-
return { type: 'ignored' }
|
|
312
|
-
}
|
|
313
|
-
recordSubsidy('broadcast')
|
|
217
|
+
case 'tron':
|
|
218
|
+
return TronTransferSettlement.settle({
|
|
219
|
+
...settlementOptions,
|
|
220
|
+
settlers: options.tronSubsidies,
|
|
221
|
+
})
|
|
222
|
+
default:
|
|
223
|
+
throw new EvidenceError('Unsupported destination subsidy chain.')
|
|
314
224
|
}
|
|
315
|
-
|
|
316
|
-
|
|
225
|
+
})()
|
|
226
|
+
if (settlement.type === 'action-required')
|
|
227
|
+
return actionRequired(settlement.record, options, settlement.reason, settlement.state)
|
|
228
|
+
if (settlement.type === 'pending') return followUp(message, options, recordOutcome)
|
|
229
|
+
if (settlement.type === 'ignored') return { type: 'ignored' }
|
|
230
|
+
current = settlement.record
|
|
317
231
|
deliveredAmount = Value.tokenAmount({
|
|
318
|
-
baseUnits: BigInt(
|
|
319
|
-
currency:
|
|
320
|
-
decimals:
|
|
232
|
+
baseUnits: BigInt(verifiedAmount.baseUnits) + settlement.amount,
|
|
233
|
+
currency: verifiedAmount.currency,
|
|
234
|
+
decimals: verifiedAmount.decimals,
|
|
321
235
|
})
|
|
322
|
-
transactionHashes.push(
|
|
323
|
-
recordSubsidy('completed')
|
|
236
|
+
transactionHashes.push(settlement.hash)
|
|
324
237
|
}
|
|
325
238
|
}
|
|
326
239
|
|
|
@@ -449,6 +362,10 @@ export declare namespace createTracker {
|
|
|
449
362
|
providers: readonly Provider.Provider[]
|
|
450
363
|
/** Destination-chain subsidy settlers, active first with retained rotation keys after it. */
|
|
451
364
|
subsidies?: readonly TransferSubsidy.Settler[] | undefined
|
|
365
|
+
/** Solana destination subsidy wallets, active first with retained rotation wallets. */
|
|
366
|
+
solanaSubsidies?: readonly SolanaTransferSubsidy.Settler[] | undefined
|
|
367
|
+
/** Tron destination subsidy wallets, active first with retained rotation wallets. */
|
|
368
|
+
tronSubsidies?: readonly TronTransferSubsidy.Settler[] | undefined
|
|
452
369
|
}
|
|
453
370
|
|
|
454
371
|
/** Reconciles one registered route transfer. */
|
|
@@ -467,6 +384,21 @@ export declare namespace createTracker {
|
|
|
467
384
|
| { type: 'reopened' }
|
|
468
385
|
}
|
|
469
386
|
|
|
387
|
+
function isTronEventCursor(
|
|
388
|
+
value: unknown,
|
|
389
|
+
): value is NonNullable<RoutesTransfers.recordTronEventCursor.Options['cursor']> | null {
|
|
390
|
+
if (value === null) return true
|
|
391
|
+
if (typeof value !== 'object' || Array.isArray(value)) return false
|
|
392
|
+
const cursor = value as Record<string, unknown>
|
|
393
|
+
return (
|
|
394
|
+
typeof cursor['offset'] === 'number' &&
|
|
395
|
+
Number.isSafeInteger(cursor['offset']) &&
|
|
396
|
+
cursor['offset'] >= 0 &&
|
|
397
|
+
(cursor['fingerprint'] === undefined ||
|
|
398
|
+
(typeof cursor['fingerprint'] === 'string' && cursor['fingerprint'].length <= 2_048))
|
|
399
|
+
)
|
|
400
|
+
}
|
|
401
|
+
|
|
470
402
|
async function actionRequired(
|
|
471
403
|
transfer: RoutesTransfers.Record,
|
|
472
404
|
options: createTracker.Options,
|
|
@@ -515,13 +447,6 @@ class EvidenceError extends Error {
|
|
|
515
447
|
override name = 'Routes.TransferReconciliation.EvidenceError'
|
|
516
448
|
}
|
|
517
449
|
|
|
518
|
-
function alreadyKnown(cause: unknown): boolean {
|
|
519
|
-
if (!(cause instanceof Error)) return false
|
|
520
|
-
const message =
|
|
521
|
-
`${cause.message} ${'details' in cause ? String(cause.details) : ''}`.toLowerCase()
|
|
522
|
-
return message.includes('already known') || message.includes('known transaction')
|
|
523
|
-
}
|
|
524
|
-
|
|
525
450
|
class ExhaustedError extends Error {
|
|
526
451
|
override name = 'Routes.TransferReconciliation.ExhaustedError'
|
|
527
452
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type * as Db from '../../db/Db.js'
|
|
2
|
+
import type * as RoutesTransfers from '../../db/tables/routesTransfers.js'
|
|
3
|
+
import type * as Webhooks from '../Webhooks.js'
|
|
4
|
+
import type * as Chain from './Chain.js'
|
|
5
|
+
import type * as Transfer from './Transfer.js'
|
|
6
|
+
|
|
7
|
+
/** Dependencies shared by destination-chain settlement attempts. */
|
|
8
|
+
export type Options = {
|
|
9
|
+
/** Current persisted transfer. */
|
|
10
|
+
current: RoutesTransfers.Record
|
|
11
|
+
/** Authoritative database. */
|
|
12
|
+
db: Db.Db
|
|
13
|
+
/** Verified destination shortfall in token base units. */
|
|
14
|
+
deficit: bigint
|
|
15
|
+
/** Chain receiving the subsidy. */
|
|
16
|
+
destinationChain: Chain.Chain
|
|
17
|
+
/** Dispatches transfer updates staged with mutations. */
|
|
18
|
+
dispatchTransferUpdates?:
|
|
19
|
+
| ((references: readonly Webhooks.QueueReference[]) => Promise<number>)
|
|
20
|
+
| undefined
|
|
21
|
+
/** Records a bounded subsidy outcome. */
|
|
22
|
+
recordSubsidy: (outcome: string) => void
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Outcome of one destination-chain settlement attempt. */
|
|
26
|
+
export type Result =
|
|
27
|
+
| {
|
|
28
|
+
/** Operator-facing reason. */
|
|
29
|
+
reason: Transfer.StatusReason
|
|
30
|
+
/** Latest persisted transfer. */
|
|
31
|
+
record: RoutesTransfers.Record
|
|
32
|
+
/** Optional correction to the recorded subsidy amount. */
|
|
33
|
+
state?: Pick<Transfer.transition.Options, 'subsidyAmount'> | undefined
|
|
34
|
+
/** Settlement requires operator recovery. */
|
|
35
|
+
type: 'action-required'
|
|
36
|
+
}
|
|
37
|
+
| { /** No settlement work remains for this attempt. */ type: 'ignored' }
|
|
38
|
+
| { /** Settlement remains in progress. */ type: 'pending' }
|
|
39
|
+
| {
|
|
40
|
+
/** Settled subsidy quantity in base units. */
|
|
41
|
+
amount: bigint
|
|
42
|
+
/** Destination transaction hash. */
|
|
43
|
+
hash: string
|
|
44
|
+
/** Latest persisted transfer. */
|
|
45
|
+
record: RoutesTransfers.Record
|
|
46
|
+
/** Destination subsidy is finalized. */
|
|
47
|
+
type: 'success'
|
|
48
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/** @module-tag localnet */
|
|
2
|
+
|
|
3
|
+
import { mnemonicToAccount } from 'viem/accounts'
|
|
4
|
+
import { waitForTransactionReceipt } from 'viem/actions'
|
|
5
|
+
import { Actions, Addresses } from 'viem/tempo'
|
|
6
|
+
import { inject } from 'vite-plus/test'
|
|
7
|
+
|
|
8
|
+
import * as Runtime from '../../../test/runtime.js'
|
|
9
|
+
import * as TestTempo from '../../../test/Tempo.js'
|
|
10
|
+
import * as Fees from '../Fees.js'
|
|
11
|
+
import * as Chain from './Chain.js'
|
|
12
|
+
import * as TransferSubsidy from './TransferSubsidy.js'
|
|
13
|
+
|
|
14
|
+
const runtime = Runtime.get()
|
|
15
|
+
const account = mnemonicToAccount(inject('tempoTestMnemonic'), { addressIndex: 15 })
|
|
16
|
+
const recipient = TestTempo.accounts[7]!.address
|
|
17
|
+
const client = TestTempo.getClient({ account })
|
|
18
|
+
const chain = Chain.from({
|
|
19
|
+
id: `eip155:${runtime.chainId}`,
|
|
20
|
+
name: 'Tempo',
|
|
21
|
+
rpcUrls: [TestTempo.rpcUrl],
|
|
22
|
+
slug: 'tempo',
|
|
23
|
+
})
|
|
24
|
+
const inventory = TransferSubsidy.createInventory({
|
|
25
|
+
account: account.address,
|
|
26
|
+
fetch: globalThis.fetch,
|
|
27
|
+
policy: { maxAmount: '5' },
|
|
28
|
+
})
|
|
29
|
+
const settler = TransferSubsidy.create({
|
|
30
|
+
account,
|
|
31
|
+
fetch: globalThis.fetch,
|
|
32
|
+
policy: { maxAmount: '5' },
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
describe.skipIf(runtime.mode !== 'localnet')('create', () => {
|
|
36
|
+
beforeAll(async () => {
|
|
37
|
+
await Actions.faucet.fundSync(client, { account: account.address, timeout: 60_000 })
|
|
38
|
+
const preferred = await Actions.fee.getUserToken(client, { account: account.address })
|
|
39
|
+
if (preferred?.address.toLowerCase() !== Addresses.pathUsd.toLowerCase())
|
|
40
|
+
await Actions.fee.setUserTokenSync(client, { token: Addresses.pathUsd })
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test('reserves Tempo fees and settles a signed destination top-up', async () => {
|
|
44
|
+
const token = Addresses.pathUsd
|
|
45
|
+
const parameters = {
|
|
46
|
+
amount: 3_001n,
|
|
47
|
+
chain,
|
|
48
|
+
recipient,
|
|
49
|
+
reservations: { nativeAmount: 0n, tokenAmount: 0n, tokenAmounts: {} },
|
|
50
|
+
token,
|
|
51
|
+
} as const
|
|
52
|
+
const balance = await Actions.token.getBalance(client, { account: account.address, token })
|
|
53
|
+
const checked = await inventory.check(parameters)
|
|
54
|
+
expect(BigInt(checked.nativeAmount) > 0n).toBe(true)
|
|
55
|
+
expect(BigInt(checked.nativeAmount) % Fees.scalingFactor).toBe(0n)
|
|
56
|
+
// Delivery alone fits, but this commitment leaves no room for the current transaction's fee.
|
|
57
|
+
await expect(
|
|
58
|
+
inventory.check({
|
|
59
|
+
...parameters,
|
|
60
|
+
reservations: {
|
|
61
|
+
nativeAmount: (balance.amount - parameters.amount) * Fees.scalingFactor,
|
|
62
|
+
tokenAmount: 0n,
|
|
63
|
+
tokenAmounts: {},
|
|
64
|
+
},
|
|
65
|
+
}),
|
|
66
|
+
).rejects.toThrow(TransferSubsidy.BalanceUnavailableError)
|
|
67
|
+
|
|
68
|
+
const before = await Actions.token.getBalance(client, { account: recipient, token })
|
|
69
|
+
const transaction = await settler.prepare({
|
|
70
|
+
...parameters,
|
|
71
|
+
nonce: await settler.pendingNonce({ chain }),
|
|
72
|
+
})
|
|
73
|
+
await settler.broadcast({ chain, transaction })
|
|
74
|
+
await waitForTransactionReceipt(client, { hash: transaction.hash })
|
|
75
|
+
// The dev node's finalized head trails receipt inclusion beyond Vitest's default polling timeout.
|
|
76
|
+
await expect
|
|
77
|
+
.poll(() => settler.status({ chain, recipient, token, transaction }), { timeout: 60_000 })
|
|
78
|
+
.toEqual({
|
|
79
|
+
type: 'success',
|
|
80
|
+
})
|
|
81
|
+
const after = await Actions.token.getBalance(client, { account: recipient, token })
|
|
82
|
+
expect(after.amount - before.amount).toBe(parameters.amount)
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
test('counts delivery commitments in a separately configured fee token', async () => {
|
|
86
|
+
const token = '0x20c0000000000000000000000000000000000001'
|
|
87
|
+
const balance = await Actions.token.getBalance(client, {
|
|
88
|
+
account: account.address,
|
|
89
|
+
token: Addresses.pathUsd,
|
|
90
|
+
})
|
|
91
|
+
const parameters = {
|
|
92
|
+
amount: 1n,
|
|
93
|
+
chain,
|
|
94
|
+
recipient,
|
|
95
|
+
reservations: { nativeAmount: 0n, tokenAmount: 0n, tokenAmounts: {} },
|
|
96
|
+
token,
|
|
97
|
+
} as const
|
|
98
|
+
await inventory.check(parameters)
|
|
99
|
+
const deliveryBalance = await Actions.token.getBalance(client, {
|
|
100
|
+
account: account.address,
|
|
101
|
+
token,
|
|
102
|
+
})
|
|
103
|
+
await expect(
|
|
104
|
+
inventory.check({ ...parameters, amount: deliveryBalance.amount }),
|
|
105
|
+
).rejects.toThrow(TransferSubsidy.BalanceUnavailableError)
|
|
106
|
+
await expect(
|
|
107
|
+
inventory.check({
|
|
108
|
+
...parameters,
|
|
109
|
+
reservations: {
|
|
110
|
+
...parameters.reservations,
|
|
111
|
+
tokenAmounts: { [Addresses.pathUsd.toLowerCase()]: balance.amount },
|
|
112
|
+
},
|
|
113
|
+
}),
|
|
114
|
+
).rejects.toThrow(TransferSubsidy.BalanceUnavailableError)
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
test('reserves a new fee against other committed delivery tokens', async () => {
|
|
118
|
+
const otherToken = '0x20c0000000000000000000000000000000000001'
|
|
119
|
+
const balance = await Actions.token.getBalance(client, {
|
|
120
|
+
account: account.address,
|
|
121
|
+
token: otherToken,
|
|
122
|
+
})
|
|
123
|
+
const parameters = {
|
|
124
|
+
amount: 1n,
|
|
125
|
+
chain,
|
|
126
|
+
recipient,
|
|
127
|
+
reservations: { nativeAmount: 0n, tokenAmount: 0n, tokenAmounts: {} },
|
|
128
|
+
token: Addresses.pathUsd,
|
|
129
|
+
} as const
|
|
130
|
+
const feeAmount = BigInt((await inventory.check(parameters)).nativeAmount) / Fees.scalingFactor
|
|
131
|
+
expect(balance.amount > feeAmount).toBe(true)
|
|
132
|
+
await expect(
|
|
133
|
+
inventory.check({
|
|
134
|
+
...parameters,
|
|
135
|
+
reservations: {
|
|
136
|
+
nativeAmount: feeAmount * Fees.scalingFactor,
|
|
137
|
+
tokenAmount: 0n,
|
|
138
|
+
tokenAmounts: { [otherToken.toLowerCase()]: balance.amount - feeAmount },
|
|
139
|
+
},
|
|
140
|
+
}),
|
|
141
|
+
).rejects.toThrow(TransferSubsidy.BalanceUnavailableError)
|
|
142
|
+
})
|
|
143
|
+
})
|
|
@@ -13,6 +13,35 @@ import * as TestRoutes from '../../../test/Routes.js'
|
|
|
13
13
|
import * as Chain from './Chain.js'
|
|
14
14
|
import * as TransferSubsidy from './TransferSubsidy.js'
|
|
15
15
|
|
|
16
|
+
describe('supportsRoute', () => {
|
|
17
|
+
test.each([
|
|
18
|
+
['tron:0x2b6653dc', 'eip155:4217', true],
|
|
19
|
+
['eip155:8453', 'eip155:4217', true],
|
|
20
|
+
['eip155:1', 'eip155:4217', true],
|
|
21
|
+
['solana:mainnet', 'eip155:4217', true],
|
|
22
|
+
['eip155:4217', 'eip155:8453', true],
|
|
23
|
+
['eip155:4217', 'eip155:1', true],
|
|
24
|
+
['eip155:4217', 'tron:0x2b6653dc', true],
|
|
25
|
+
['eip155:4217', 'eip155:137', false],
|
|
26
|
+
['eip155:4217', 'eip155:4217', false],
|
|
27
|
+
['eip155:1', 'eip155:8453', false],
|
|
28
|
+
])('%s to %s: %s', (sourceChainId, destinationChainId, supported) => {
|
|
29
|
+
expect(
|
|
30
|
+
TransferSubsidy.supportsRoute({ destinationChainId, sourceChainId, tempoChainId: 4217 }),
|
|
31
|
+
).toBe(supported)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test('uses the configured Tempo chain', () => {
|
|
35
|
+
expect(
|
|
36
|
+
TransferSubsidy.supportsRoute({
|
|
37
|
+
destinationChainId: 'eip155:42431',
|
|
38
|
+
sourceChainId: 'eip155:8453',
|
|
39
|
+
tempoChainId: 42431,
|
|
40
|
+
}),
|
|
41
|
+
).toBe(true)
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
16
45
|
describe('requiredAmount', () => {
|
|
17
46
|
test('normalizes USD stablecoins across decimal precisions', () => {
|
|
18
47
|
const snapshot = TestRoutes.transferSnapshot()
|
|
@@ -101,7 +130,7 @@ describe.skipIf(!Anvil.available)('create', () => {
|
|
|
101
130
|
test('signs, broadcasts, and verifies a Base USDC subsidy', async () => {
|
|
102
131
|
const anvil = await Anvil.start({ chain: base, forkUrl: base.rpcUrls.default.http[0]! })
|
|
103
132
|
try {
|
|
104
|
-
const account = Anvil.
|
|
133
|
+
const account = Anvil.getSubsidyAccount(3)
|
|
105
134
|
const recipient = Anvil.getAccount(4).address
|
|
106
135
|
const token = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
|
|
107
136
|
await Anvil.setErc20Balance(anvil.client, {
|
|
@@ -128,7 +157,7 @@ describe.skipIf(!Anvil.available)('create', () => {
|
|
|
128
157
|
chain,
|
|
129
158
|
nonce,
|
|
130
159
|
recipient,
|
|
131
|
-
reservations: { nativeAmount: 0n, tokenAmount: 0n },
|
|
160
|
+
reservations: { nativeAmount: 0n, tokenAmount: 0n, tokenAmounts: {} },
|
|
132
161
|
token,
|
|
133
162
|
}),
|
|
134
163
|
).rejects.toThrow(TransferSubsidy.BalanceUnavailableError)
|
|
@@ -137,10 +166,11 @@ describe.skipIf(!Anvil.available)('create', () => {
|
|
|
137
166
|
chain,
|
|
138
167
|
nonce,
|
|
139
168
|
recipient,
|
|
140
|
-
reservations: { nativeAmount: 0n, tokenAmount: 0n },
|
|
169
|
+
reservations: { nativeAmount: 0n, tokenAmount: 0n, tokenAmounts: {} },
|
|
141
170
|
token,
|
|
142
171
|
})
|
|
143
172
|
await settler.broadcast({ chain, transaction })
|
|
173
|
+
await anvil.client.waitForTransactionReceipt({ hash: transaction.hash })
|
|
144
174
|
await expect(settler.status({ chain, recipient, token, transaction })).resolves.toEqual({
|
|
145
175
|
broadcast: false,
|
|
146
176
|
type: 'pending',
|
|
@@ -158,7 +188,7 @@ describe.skipIf(!Anvil.available)('create', () => {
|
|
|
158
188
|
}),
|
|
159
189
|
).resolves.toBe(3_001n)
|
|
160
190
|
const rotated = TransferSubsidy.create({
|
|
161
|
-
account: Anvil.
|
|
191
|
+
account: Anvil.getSubsidyAccount(5),
|
|
162
192
|
fetch: globalThis.fetch,
|
|
163
193
|
policy: { maxAmount: '5' },
|
|
164
194
|
})
|