@circle-fin/app-kit 1.13.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/bridge.cjs +910 -47
- package/bridge.d.cts +55 -0
- package/bridge.d.mts +55 -0
- package/bridge.d.ts +55 -0
- package/bridge.mjs +911 -48
- package/chains.cjs +129 -10
- package/chains.d.cts +9 -0
- package/chains.d.mts +9 -0
- package/chains.d.ts +9 -0
- package/chains.mjs +129 -10
- package/context.d.cts +55 -0
- package/context.d.mts +55 -0
- package/context.d.ts +55 -0
- package/earn.cjs +432 -27
- package/earn.d.cts +55 -0
- package/earn.d.mts +55 -0
- package/earn.d.ts +55 -0
- package/earn.mjs +428 -27
- package/estimateBridge.cjs +910 -47
- package/estimateBridge.d.cts +61 -0
- package/estimateBridge.d.mts +61 -0
- package/estimateBridge.d.ts +61 -0
- package/estimateBridge.mjs +911 -48
- package/estimateSwap.cjs +428 -26
- package/estimateSwap.d.cts +55 -0
- package/estimateSwap.d.mts +55 -0
- package/estimateSwap.d.ts +55 -0
- package/estimateSwap.mjs +427 -26
- package/index.cjs +4613 -346
- package/index.d.cts +777 -216
- package/index.d.mts +777 -216
- package/index.d.ts +777 -216
- package/index.mjs +4614 -347
- package/package.json +6 -6
- package/swap.cjs +428 -26
- package/swap.d.cts +55 -0
- package/swap.d.mts +55 -0
- package/swap.d.ts +55 -0
- package/swap.mjs +427 -26
- package/unifiedBalance.cjs +20602 -8389
- package/unifiedBalance.d.cts +544 -160
- package/unifiedBalance.d.mts +544 -160
- package/unifiedBalance.d.ts +544 -160
- package/unifiedBalance.mjs +20603 -8391
package/swap.cjs
CHANGED
|
@@ -30,7 +30,7 @@ if (typeof window !== 'undefined' && typeof window.Buffer === 'undefined') {
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
var zod = require('zod');
|
|
33
|
-
require('pino');
|
|
33
|
+
var pino = require('pino');
|
|
34
34
|
var bytes = require('@ethersproject/bytes');
|
|
35
35
|
require('@ethersproject/abi');
|
|
36
36
|
var address = require('@ethersproject/address');
|
|
@@ -45,6 +45,7 @@ var keccak256 = require('@ethersproject/keccak256');
|
|
|
45
45
|
|
|
46
46
|
function _interopDefault (e) { return e && e.__esModule ? e.default : e; }
|
|
47
47
|
|
|
48
|
+
var pino__default = /*#__PURE__*/_interopDefault(pino);
|
|
48
49
|
var bs58__default = /*#__PURE__*/_interopDefault(bs58);
|
|
49
50
|
|
|
50
51
|
// Import global type declarations
|
|
@@ -3543,8 +3544,45 @@ var EarnChain;
|
|
|
3543
3544
|
* This program handles minting operations for Gateway transactions
|
|
3544
3545
|
* on Solana devnet.
|
|
3545
3546
|
*/ const GATEWAY_MINTER_SOLANA_DEVNET = 'GATEmKK2ECL1brEngQZWCgMWPbvrEYqsV6u29dAaHavr';
|
|
3546
|
-
/**
|
|
3547
|
-
|
|
3547
|
+
/**
|
|
3548
|
+
* The `TokenMessengerWithFees` proxy contract address for EVM mainnet networks
|
|
3549
|
+
* (all chains except Edge).
|
|
3550
|
+
*
|
|
3551
|
+
* Deployed at a CREATE3-derived address; identical across all mainnet EVM
|
|
3552
|
+
* source chains. Present on any chain that supports the prepaid FORWARD path
|
|
3553
|
+
* via `depositForBurnWithHookAndFees`.
|
|
3554
|
+
*/ const TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET = '0x71f54F818671cD0D7ea140Da213e5C8b5C92a408';
|
|
3555
|
+
/**
|
|
3556
|
+
* The `TokenMessengerWithFees` proxy contract address for EVM testnet networks.
|
|
3557
|
+
*
|
|
3558
|
+
* Identical across all testnet EVM source chains. Present on any testnet chain
|
|
3559
|
+
* that supports the prepaid FORWARD path via `depositForBurnWithHookAndFees`.
|
|
3560
|
+
*/ const TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET = '0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A';
|
|
3561
|
+
/**
|
|
3562
|
+
* The `DepositForHandler` proxy contract address for EVM mainnet networks.
|
|
3563
|
+
*
|
|
3564
|
+
* The handler the GenericExecutor calls on a fast-deposit destination chain to
|
|
3565
|
+
* run a cross-chain deposit into the GatewayWallet. Deployed at the same
|
|
3566
|
+
* address across all mainnet EVM destination chains.
|
|
3567
|
+
*/ const DEPOSIT_FOR_HANDLER_EVM_MAINNET = '0x16529813203f77E036576666336554a1210dce4D';
|
|
3568
|
+
/**
|
|
3569
|
+
* The `DepositForHandler` proxy contract address for EVM testnet networks.
|
|
3570
|
+
*
|
|
3571
|
+
* Identical across all testnet EVM destination chains.
|
|
3572
|
+
*/ const DEPOSIT_FOR_HANDLER_EVM_TESTNET = '0xD05E7D2E7d30b92c5F17d7d0fC575fce231F1A48';
|
|
3573
|
+
/**
|
|
3574
|
+
* The `GenericExecutor` proxy contract address for EVM mainnet networks.
|
|
3575
|
+
*
|
|
3576
|
+
* The GenericExecutor is the `mintRecipient` and `destinationCaller` on the
|
|
3577
|
+
* destination chain for the CCTP v2 prepaid FORWARD path. It receives the CCTP
|
|
3578
|
+
* mint and calls the `DepositForHandler` to complete the fast deposit.
|
|
3579
|
+
* Deployed at the same address across all mainnet EVM destination chains.
|
|
3580
|
+
*/ const GENERIC_EXECUTOR_EVM_MAINNET = '0xFa7be2f04F3Ad4ca969260729c6d45B5625984A7';
|
|
3581
|
+
/**
|
|
3582
|
+
* The `GenericExecutor` proxy contract address for EVM testnet networks.
|
|
3583
|
+
*
|
|
3584
|
+
* Identical across all testnet EVM destination chains.
|
|
3585
|
+
*/ const GENERIC_EXECUTOR_EVM_TESTNET = '0xEdC81040756AcCfF070c21D37b265b9D0b5Ba45e';
|
|
3548
3586
|
|
|
3549
3587
|
/**
|
|
3550
3588
|
* Arc Testnet chain definition
|
|
@@ -3603,9 +3641,8 @@ var EarnChain;
|
|
|
3603
3641
|
v1: {
|
|
3604
3642
|
wallet: GATEWAY_WALLET_EVM_TESTNET,
|
|
3605
3643
|
minter: GATEWAY_MINTER_EVM_TESTNET,
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
depositForHandler: '0xD05E7D2E7d30b92c5F17d7d0fC575fce231F1A48'
|
|
3644
|
+
depositForHandler: DEPOSIT_FOR_HANDLER_EVM_TESTNET,
|
|
3645
|
+
genericExecutor: GENERIC_EXECUTOR_EVM_TESTNET
|
|
3609
3646
|
}
|
|
3610
3647
|
},
|
|
3611
3648
|
forwarderSupported: {
|
|
@@ -3800,7 +3837,9 @@ var EarnChain;
|
|
|
3800
3837
|
contracts: {
|
|
3801
3838
|
v1: {
|
|
3802
3839
|
wallet: GATEWAY_WALLET_EVM_MAINNET,
|
|
3803
|
-
minter: GATEWAY_MINTER_EVM_MAINNET
|
|
3840
|
+
minter: GATEWAY_MINTER_EVM_MAINNET,
|
|
3841
|
+
depositForHandler: DEPOSIT_FOR_HANDLER_EVM_MAINNET,
|
|
3842
|
+
genericExecutor: GENERIC_EXECUTOR_EVM_MAINNET
|
|
3804
3843
|
}
|
|
3805
3844
|
},
|
|
3806
3845
|
forwarderSupported: {
|
|
@@ -3864,7 +3903,9 @@ var EarnChain;
|
|
|
3864
3903
|
contracts: {
|
|
3865
3904
|
v1: {
|
|
3866
3905
|
wallet: GATEWAY_WALLET_EVM_TESTNET,
|
|
3867
|
-
minter: GATEWAY_MINTER_EVM_TESTNET
|
|
3906
|
+
minter: GATEWAY_MINTER_EVM_TESTNET,
|
|
3907
|
+
depositForHandler: DEPOSIT_FOR_HANDLER_EVM_TESTNET,
|
|
3908
|
+
genericExecutor: GENERIC_EXECUTOR_EVM_TESTNET
|
|
3868
3909
|
}
|
|
3869
3910
|
},
|
|
3870
3911
|
forwarderSupported: {
|
|
@@ -4177,6 +4218,7 @@ var EarnChain;
|
|
|
4177
4218
|
v2: {
|
|
4178
4219
|
type: 'split',
|
|
4179
4220
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4221
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4180
4222
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4181
4223
|
confirmations: 1,
|
|
4182
4224
|
fastConfirmations: 1
|
|
@@ -4222,6 +4264,7 @@ var EarnChain;
|
|
|
4222
4264
|
v2: {
|
|
4223
4265
|
type: 'split',
|
|
4224
4266
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4267
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4225
4268
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4226
4269
|
confirmations: 1,
|
|
4227
4270
|
fastConfirmations: 1
|
|
@@ -4267,6 +4310,7 @@ var EarnChain;
|
|
|
4267
4310
|
v2: {
|
|
4268
4311
|
type: 'split',
|
|
4269
4312
|
tokenMessenger: '0x98706A006bc632Df31CAdFCBD43F38887ce2ca5c',
|
|
4313
|
+
tokenMessengerWithFees: '0x3Ac96675F9a3E6922713e041645D82f3561d3686',
|
|
4270
4314
|
messageTransmitter: '0x5b61381Fc9e58E70EfC13a4A97516997019198ee',
|
|
4271
4315
|
confirmations: 65,
|
|
4272
4316
|
fastConfirmations: 1
|
|
@@ -4312,6 +4356,7 @@ var EarnChain;
|
|
|
4312
4356
|
v2: {
|
|
4313
4357
|
type: 'split',
|
|
4314
4358
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4359
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4315
4360
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4316
4361
|
confirmations: 65,
|
|
4317
4362
|
fastConfirmations: 1
|
|
@@ -4660,6 +4705,7 @@ var EarnChain;
|
|
|
4660
4705
|
v2: {
|
|
4661
4706
|
type: 'split',
|
|
4662
4707
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4708
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4663
4709
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4664
4710
|
confirmations: 1,
|
|
4665
4711
|
fastConfirmations: 1
|
|
@@ -4707,6 +4753,7 @@ var EarnChain;
|
|
|
4707
4753
|
v2: {
|
|
4708
4754
|
type: 'split',
|
|
4709
4755
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4756
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4710
4757
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4711
4758
|
confirmations: 1,
|
|
4712
4759
|
fastConfirmations: 1
|
|
@@ -4988,6 +5035,7 @@ var EarnChain;
|
|
|
4988
5035
|
v2: {
|
|
4989
5036
|
type: 'split',
|
|
4990
5037
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5038
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4991
5039
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4992
5040
|
confirmations: 1,
|
|
4993
5041
|
fastConfirmations: 1
|
|
@@ -5033,6 +5081,7 @@ var EarnChain;
|
|
|
5033
5081
|
v2: {
|
|
5034
5082
|
type: 'split',
|
|
5035
5083
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5084
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5036
5085
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5037
5086
|
confirmations: 64,
|
|
5038
5087
|
fastConfirmations: 1
|
|
@@ -5078,6 +5127,7 @@ var EarnChain;
|
|
|
5078
5127
|
v2: {
|
|
5079
5128
|
type: 'split',
|
|
5080
5129
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5130
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5081
5131
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5082
5132
|
confirmations: 64,
|
|
5083
5133
|
fastConfirmations: 1
|
|
@@ -5379,6 +5429,7 @@ var EarnChain;
|
|
|
5379
5429
|
v2: {
|
|
5380
5430
|
type: 'split',
|
|
5381
5431
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5432
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5382
5433
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5383
5434
|
confirmations: 1,
|
|
5384
5435
|
fastConfirmations: 1
|
|
@@ -5425,6 +5476,7 @@ var EarnChain;
|
|
|
5425
5476
|
v2: {
|
|
5426
5477
|
type: 'split',
|
|
5427
5478
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5479
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5428
5480
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5429
5481
|
confirmations: 1,
|
|
5430
5482
|
fastConfirmations: 1
|
|
@@ -5732,7 +5784,9 @@ var EarnChain;
|
|
|
5732
5784
|
contracts: {
|
|
5733
5785
|
v1: {
|
|
5734
5786
|
wallet: GATEWAY_WALLET_EVM_MAINNET,
|
|
5735
|
-
minter: GATEWAY_MINTER_EVM_MAINNET
|
|
5787
|
+
minter: GATEWAY_MINTER_EVM_MAINNET,
|
|
5788
|
+
depositForHandler: DEPOSIT_FOR_HANDLER_EVM_MAINNET,
|
|
5789
|
+
genericExecutor: GENERIC_EXECUTOR_EVM_MAINNET
|
|
5736
5790
|
}
|
|
5737
5791
|
},
|
|
5738
5792
|
forwarderSupported: {
|
|
@@ -5797,7 +5851,9 @@ var EarnChain;
|
|
|
5797
5851
|
contracts: {
|
|
5798
5852
|
v1: {
|
|
5799
5853
|
wallet: GATEWAY_WALLET_EVM_TESTNET,
|
|
5800
|
-
minter: GATEWAY_MINTER_EVM_TESTNET
|
|
5854
|
+
minter: GATEWAY_MINTER_EVM_TESTNET,
|
|
5855
|
+
depositForHandler: DEPOSIT_FOR_HANDLER_EVM_TESTNET,
|
|
5856
|
+
genericExecutor: GENERIC_EXECUTOR_EVM_TESTNET
|
|
5801
5857
|
}
|
|
5802
5858
|
},
|
|
5803
5859
|
forwarderSupported: {
|
|
@@ -6883,6 +6939,67 @@ var Chains = {
|
|
|
6883
6939
|
return chain.cctp?.contracts.v2 !== undefined;
|
|
6884
6940
|
}
|
|
6885
6941
|
|
|
6942
|
+
/**
|
|
6943
|
+
* Chains the Fee Service accepts as a SOURCE for source-paid ("receive-exact")
|
|
6944
|
+
* CCTP v2 fees. An explicit allowlist is required because the
|
|
6945
|
+
* `TokenMessengerWithFees` wrapper address is now shared with the fast-deposit
|
|
6946
|
+
* forwarder path, so wrapper presence no longer implies source-fee support.
|
|
6947
|
+
* Keep in sync with backend coverage.
|
|
6948
|
+
*/ new Set([
|
|
6949
|
+
// Mainnet
|
|
6950
|
+
Blockchain.Ethereum,
|
|
6951
|
+
Blockchain.Base,
|
|
6952
|
+
Blockchain.Arbitrum,
|
|
6953
|
+
Blockchain.Unichain,
|
|
6954
|
+
Blockchain.Optimism,
|
|
6955
|
+
Blockchain.Codex,
|
|
6956
|
+
Blockchain.Ink,
|
|
6957
|
+
Blockchain.Plume,
|
|
6958
|
+
Blockchain.Linea,
|
|
6959
|
+
Blockchain.World_Chain,
|
|
6960
|
+
// Testnet counterparts
|
|
6961
|
+
Blockchain.Ethereum_Sepolia,
|
|
6962
|
+
Blockchain.Base_Sepolia,
|
|
6963
|
+
Blockchain.Arbitrum_Sepolia,
|
|
6964
|
+
Blockchain.Unichain_Sepolia,
|
|
6965
|
+
Blockchain.Optimism_Sepolia,
|
|
6966
|
+
Blockchain.Codex_Testnet,
|
|
6967
|
+
Blockchain.Ink_Testnet,
|
|
6968
|
+
Blockchain.Plume_Testnet,
|
|
6969
|
+
Blockchain.Linea_Sepolia,
|
|
6970
|
+
Blockchain.World_Chain_Sepolia
|
|
6971
|
+
]);
|
|
6972
|
+
|
|
6973
|
+
/**
|
|
6974
|
+
* Temporary allowlist of chains permitted to initiate Gateway fast deposits.
|
|
6975
|
+
* Only chains keyed here are eligible; all others are rejected. Using the
|
|
6976
|
+
* {@link Blockchain} enum keeps entries type-safe and catches typos at compile
|
|
6977
|
+
* time. Remove this allowlist once roll-out is complete.
|
|
6978
|
+
*/ new Set([
|
|
6979
|
+
// Mainnet
|
|
6980
|
+
Blockchain.Ethereum,
|
|
6981
|
+
Blockchain.Base,
|
|
6982
|
+
Blockchain.Arbitrum,
|
|
6983
|
+
Blockchain.Unichain,
|
|
6984
|
+
Blockchain.Optimism,
|
|
6985
|
+
Blockchain.Codex,
|
|
6986
|
+
Blockchain.Ink,
|
|
6987
|
+
Blockchain.Plume,
|
|
6988
|
+
Blockchain.Linea,
|
|
6989
|
+
Blockchain.World_Chain,
|
|
6990
|
+
// Testnet counterparts
|
|
6991
|
+
Blockchain.Ethereum_Sepolia,
|
|
6992
|
+
Blockchain.Base_Sepolia,
|
|
6993
|
+
Blockchain.Arbitrum_Sepolia,
|
|
6994
|
+
Blockchain.Unichain_Sepolia,
|
|
6995
|
+
Blockchain.Optimism_Sepolia,
|
|
6996
|
+
Blockchain.Codex_Testnet,
|
|
6997
|
+
Blockchain.Ink_Testnet,
|
|
6998
|
+
Blockchain.Plume_Testnet,
|
|
6999
|
+
Blockchain.Linea_Sepolia,
|
|
7000
|
+
Blockchain.World_Chain_Sepolia
|
|
7001
|
+
]);
|
|
7002
|
+
|
|
6886
7003
|
/**
|
|
6887
7004
|
* Zod schema for validating Gateway v1 contract addresses.
|
|
6888
7005
|
*
|
|
@@ -6904,7 +7021,10 @@ var Chains = {
|
|
|
6904
7021
|
}).min(1, 'Gateway minter address cannot be empty.'),
|
|
6905
7022
|
depositForHandler: zod.z.string({
|
|
6906
7023
|
invalid_type_error: 'Gateway depositForHandler address must be a string.'
|
|
6907
|
-
}).min(1, 'Gateway depositForHandler address cannot be empty.').optional()
|
|
7024
|
+
}).min(1, 'Gateway depositForHandler address cannot be empty.').optional(),
|
|
7025
|
+
genericExecutor: zod.z.string({
|
|
7026
|
+
invalid_type_error: 'Gateway genericExecutor address must be a string.'
|
|
7027
|
+
}).min(1, 'Gateway genericExecutor address cannot be empty.').optional()
|
|
6908
7028
|
}).strict() // Reject any additional properties not defined in the schema
|
|
6909
7029
|
;
|
|
6910
7030
|
/**
|
|
@@ -9812,7 +9932,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
9812
9932
|
* allowlisted {@link ClientLogPayload} fields (and the allowlisted
|
|
9813
9933
|
* sub-fields of `errorDetails` / `clientContext`) are copied across.
|
|
9814
9934
|
* A regressing upstream mapper — or a plain-JS caller that bypasses the
|
|
9815
|
-
* type — therefore cannot exfiltrate stray properties (secrets,
|
|
9935
|
+
* type — therefore cannot exfiltrate stray properties (secrets,
|
|
9816
9936
|
* raw error stacks) through the analytics channel. Optional fields are
|
|
9817
9937
|
* only included when present so the serialised shape matches the
|
|
9818
9938
|
* server's strict schema.
|
|
@@ -9835,6 +9955,9 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
9835
9955
|
if (payload.destinationChain !== undefined) safe['destinationChain'] = payload.destinationChain;
|
|
9836
9956
|
if (payload.tokenIn !== undefined) safe['tokenIn'] = payload.tokenIn;
|
|
9837
9957
|
if (payload.tokenOut !== undefined) safe['tokenOut'] = payload.tokenOut;
|
|
9958
|
+
if (payload.amountIn !== undefined) safe['amountIn'] = payload.amountIn;
|
|
9959
|
+
if (payload.durationMs !== undefined) safe['durationMs'] = payload.durationMs;
|
|
9960
|
+
if (payload.sourceAddress !== undefined) safe['sourceAddress'] = payload.sourceAddress;
|
|
9838
9961
|
if (payload.txHash !== undefined) safe['txHash'] = payload.txHash;
|
|
9839
9962
|
if (payload.correlationId !== undefined) safe['correlationId'] = payload.correlationId;
|
|
9840
9963
|
if (payload.errorDetails !== undefined) {
|
|
@@ -10068,14 +10191,28 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
10068
10191
|
}
|
|
10069
10192
|
|
|
10070
10193
|
/**
|
|
10071
|
-
*
|
|
10072
|
-
*
|
|
10194
|
+
* Emit a stable console warning when building or emitting a telemetry payload
|
|
10195
|
+
* throws — for example, a buggy `TelemetryContextResolver`, a regression in
|
|
10073
10196
|
* `extractErrorDetails`, or a synchronous failure inside `emitAnalyticsLog`
|
|
10074
|
-
* before it could swallow the error itself.
|
|
10075
|
-
*
|
|
10076
|
-
*
|
|
10197
|
+
* before it could swallow the error itself. Uses a stable prefix so the
|
|
10198
|
+
* drop is discoverable via grep. Never re-throws: the caller's original
|
|
10199
|
+
* operation error must always win.
|
|
10077
10200
|
*
|
|
10078
10201
|
* @internal
|
|
10202
|
+
*
|
|
10203
|
+
* @param eventType - The telemetry event type that was being emitted.
|
|
10204
|
+
* @param cause - The error or value that caused the drop.
|
|
10205
|
+
*
|
|
10206
|
+
* @example
|
|
10207
|
+
* ```typescript
|
|
10208
|
+
* import { warnTelemetryDrop } from '@core/utils'
|
|
10209
|
+
*
|
|
10210
|
+
* try {
|
|
10211
|
+
* void emitAnalyticsLog(payload)
|
|
10212
|
+
* } catch (err) {
|
|
10213
|
+
* warnTelemetryDrop('my_event', err)
|
|
10214
|
+
* }
|
|
10215
|
+
* ```
|
|
10079
10216
|
*/ function warnTelemetryDrop(eventType, cause) {
|
|
10080
10217
|
try {
|
|
10081
10218
|
// Pass `cause` as the second console.warn argument rather than
|
|
@@ -10115,6 +10252,9 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
10115
10252
|
...context?.tokenOut != null && {
|
|
10116
10253
|
tokenOut: context.tokenOut
|
|
10117
10254
|
},
|
|
10255
|
+
...context?.amountIn != null && {
|
|
10256
|
+
amountIn: context.amountIn
|
|
10257
|
+
},
|
|
10118
10258
|
...context?.txHash != null && {
|
|
10119
10259
|
txHash: context.txHash
|
|
10120
10260
|
},
|
|
@@ -10214,7 +10354,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
10214
10354
|
}
|
|
10215
10355
|
|
|
10216
10356
|
var name$2 = "@circle-fin/bridge-kit";
|
|
10217
|
-
var version$2 = "1.14.
|
|
10357
|
+
var version$2 = "1.14.1";
|
|
10218
10358
|
var pkg$2 = {
|
|
10219
10359
|
name: name$2,
|
|
10220
10360
|
version: version$2};
|
|
@@ -11179,6 +11319,241 @@ var TransferSpeed;
|
|
|
11179
11319
|
message: 'Invalid metrics'
|
|
11180
11320
|
});
|
|
11181
11321
|
|
|
11322
|
+
/**
|
|
11323
|
+
* Omit undefined values from an object.
|
|
11324
|
+
*
|
|
11325
|
+
* @param obj - The object to process.
|
|
11326
|
+
* @returns A new object with undefined values removed.
|
|
11327
|
+
*
|
|
11328
|
+
* @internal
|
|
11329
|
+
* @remarks
|
|
11330
|
+
* Used by both production and mock loggers to ensure consistent behavior.
|
|
11331
|
+
* This prevents undefined values from being serialized in log output,
|
|
11332
|
+
* which can cause issues with some log transports.
|
|
11333
|
+
*/ function omitUndefined(obj) {
|
|
11334
|
+
const result = {};
|
|
11335
|
+
for (const [key, value] of Object.entries(obj)){
|
|
11336
|
+
if (value !== undefined) {
|
|
11337
|
+
result[key] = value;
|
|
11338
|
+
}
|
|
11339
|
+
}
|
|
11340
|
+
return result;
|
|
11341
|
+
}
|
|
11342
|
+
|
|
11343
|
+
/**
|
|
11344
|
+
* Default redaction paths for web3/blockchain SDKs.
|
|
11345
|
+
*
|
|
11346
|
+
* @remarks
|
|
11347
|
+
* These paths target common sensitive fields in blockchain applications.
|
|
11348
|
+
* All user fields are nested under `context`, so paths start with `context.`.
|
|
11349
|
+
* Wildcard `*` matches any key at that level.
|
|
11350
|
+
*/ const DEFAULT_REDACT_PATHS = [
|
|
11351
|
+
// Generic Credentials
|
|
11352
|
+
'context.password',
|
|
11353
|
+
'context.passphrase',
|
|
11354
|
+
'context.secret',
|
|
11355
|
+
'context.token',
|
|
11356
|
+
'context.*.password',
|
|
11357
|
+
'context.*.passphrase',
|
|
11358
|
+
'context.*.secret',
|
|
11359
|
+
'context.*.token',
|
|
11360
|
+
// API Keys & Auth Tokens
|
|
11361
|
+
'context.apiKey',
|
|
11362
|
+
'context.apiSecret',
|
|
11363
|
+
'context.accessToken',
|
|
11364
|
+
'context.refreshToken',
|
|
11365
|
+
'context.jwt',
|
|
11366
|
+
'context.bearerToken',
|
|
11367
|
+
'context.sessionId',
|
|
11368
|
+
'context.authorization',
|
|
11369
|
+
'context.cookie',
|
|
11370
|
+
'context.*.apiKey',
|
|
11371
|
+
'context.*.apiSecret',
|
|
11372
|
+
'context.*.accessToken',
|
|
11373
|
+
'context.*.refreshToken',
|
|
11374
|
+
'context.*.jwt',
|
|
11375
|
+
'context.*.bearerToken',
|
|
11376
|
+
'context.*.sessionId',
|
|
11377
|
+
'context.*.authorization',
|
|
11378
|
+
'context.*.cookie',
|
|
11379
|
+
// Web3 / Crypto Keys
|
|
11380
|
+
'context.privateKey',
|
|
11381
|
+
'context.secretKey',
|
|
11382
|
+
'context.signingKey',
|
|
11383
|
+
'context.encryptionKey',
|
|
11384
|
+
'context.*.privateKey',
|
|
11385
|
+
'context.*.secretKey',
|
|
11386
|
+
'context.*.signingKey',
|
|
11387
|
+
'context.*.encryptionKey',
|
|
11388
|
+
// Web3 / Crypto Mnemonics and Seeds
|
|
11389
|
+
'context.mnemonic',
|
|
11390
|
+
'context.seed',
|
|
11391
|
+
'context.seedPhrase',
|
|
11392
|
+
'context.*.mnemonic',
|
|
11393
|
+
'context.*.seed',
|
|
11394
|
+
'context.*.seedPhrase',
|
|
11395
|
+
// OTP / Verification Codes
|
|
11396
|
+
'context.otp',
|
|
11397
|
+
'context.verificationCode',
|
|
11398
|
+
'context.*.otp',
|
|
11399
|
+
'context.*.verificationCode',
|
|
11400
|
+
// Payment Information
|
|
11401
|
+
'context.cardNumber',
|
|
11402
|
+
'context.cvv',
|
|
11403
|
+
'context.accountNumber',
|
|
11404
|
+
'context.*.cardNumber',
|
|
11405
|
+
'context.*.cvv',
|
|
11406
|
+
'context.*.accountNumber'
|
|
11407
|
+
];
|
|
11408
|
+
/**
|
|
11409
|
+
* Wrap user fields under `context` to prevent collision with pino internals.
|
|
11410
|
+
*
|
|
11411
|
+
* @param fields - User-provided log fields.
|
|
11412
|
+
* @returns Object with fields nested under `context`, or undefined if empty.
|
|
11413
|
+
*
|
|
11414
|
+
* @remarks
|
|
11415
|
+
* This function handles edge cases by returning undefined for null, undefined,
|
|
11416
|
+
* or empty objects to avoid unnecessary wrapping in log output.
|
|
11417
|
+
* Undefined values are cleaned before wrapping.
|
|
11418
|
+
*/ function wrapInContext(fields) {
|
|
11419
|
+
if (!fields) return undefined;
|
|
11420
|
+
// Clean undefined values for consistency and transport compatibility
|
|
11421
|
+
const cleaned = omitUndefined(fields);
|
|
11422
|
+
// Handle edge case: all values were undefined, resulting in empty object
|
|
11423
|
+
const keys = Object.keys(cleaned);
|
|
11424
|
+
if (keys.length === 0) return undefined;
|
|
11425
|
+
return {
|
|
11426
|
+
context: cleaned
|
|
11427
|
+
};
|
|
11428
|
+
}
|
|
11429
|
+
/**
|
|
11430
|
+
* Wrap a pino instance to conform to our Logger interface.
|
|
11431
|
+
*
|
|
11432
|
+
* @param pinoInstance - The pino logger instance to wrap.
|
|
11433
|
+
* @returns A Logger instance conforming to our stable interface.
|
|
11434
|
+
*/ function wrapPino(pinoInstance) {
|
|
11435
|
+
return {
|
|
11436
|
+
debug (message, fields) {
|
|
11437
|
+
const wrapped = wrapInContext(fields);
|
|
11438
|
+
if (wrapped) {
|
|
11439
|
+
pinoInstance.debug(wrapped, message);
|
|
11440
|
+
} else {
|
|
11441
|
+
pinoInstance.debug(message);
|
|
11442
|
+
}
|
|
11443
|
+
},
|
|
11444
|
+
info (message, fields) {
|
|
11445
|
+
const wrapped = wrapInContext(fields);
|
|
11446
|
+
if (wrapped) {
|
|
11447
|
+
pinoInstance.info(wrapped, message);
|
|
11448
|
+
} else {
|
|
11449
|
+
pinoInstance.info(message);
|
|
11450
|
+
}
|
|
11451
|
+
},
|
|
11452
|
+
warn (message, fields) {
|
|
11453
|
+
const wrapped = wrapInContext(fields);
|
|
11454
|
+
if (wrapped) {
|
|
11455
|
+
pinoInstance.warn(wrapped, message);
|
|
11456
|
+
} else {
|
|
11457
|
+
pinoInstance.warn(message);
|
|
11458
|
+
}
|
|
11459
|
+
},
|
|
11460
|
+
error (message, fields) {
|
|
11461
|
+
const wrapped = wrapInContext(fields);
|
|
11462
|
+
if (wrapped) {
|
|
11463
|
+
pinoInstance.error(wrapped, message);
|
|
11464
|
+
} else {
|
|
11465
|
+
pinoInstance.error(message);
|
|
11466
|
+
}
|
|
11467
|
+
},
|
|
11468
|
+
child (tags) {
|
|
11469
|
+
// Child bindings stay flat (not wrapped) - they're part of logger's base context
|
|
11470
|
+
const cleaned = omitUndefined(tags);
|
|
11471
|
+
return wrapPino(pinoInstance.child(cleaned));
|
|
11472
|
+
}
|
|
11473
|
+
};
|
|
11474
|
+
}
|
|
11475
|
+
/**
|
|
11476
|
+
* Build pino redact configuration from our simplified options.
|
|
11477
|
+
*
|
|
11478
|
+
* @param redact - The redact configuration option.
|
|
11479
|
+
* @returns Pino-compatible redact configuration or undefined.
|
|
11480
|
+
*/ function buildRedactConfig(redact) {
|
|
11481
|
+
// Explicitly disabled
|
|
11482
|
+
if (redact === false) {
|
|
11483
|
+
return undefined;
|
|
11484
|
+
}
|
|
11485
|
+
// Custom paths provided
|
|
11486
|
+
if (Array.isArray(redact)) {
|
|
11487
|
+
return redact.length > 0 ? {
|
|
11488
|
+
paths: redact,
|
|
11489
|
+
censor: '[REDACTED]'
|
|
11490
|
+
} : undefined;
|
|
11491
|
+
}
|
|
11492
|
+
// Default: use web3 sensible defaults
|
|
11493
|
+
return {
|
|
11494
|
+
paths: [
|
|
11495
|
+
...DEFAULT_REDACT_PATHS
|
|
11496
|
+
],
|
|
11497
|
+
censor: '[REDACTED]'
|
|
11498
|
+
};
|
|
11499
|
+
}
|
|
11500
|
+
/**
|
|
11501
|
+
* Create a logger backed by pino.
|
|
11502
|
+
*
|
|
11503
|
+
* @param options - Logger options (optional).
|
|
11504
|
+
* @param stream - Destination stream (optional).
|
|
11505
|
+
* @returns A Logger instance.
|
|
11506
|
+
* @throws Error if invalid pino options are provided.
|
|
11507
|
+
*
|
|
11508
|
+
* @remarks
|
|
11509
|
+
* This is a thin wrapper around pino that exposes our stable Logger interface.
|
|
11510
|
+
* Pino handles all transport concerns: JSON, pretty printing, file, remote, browser, etc.
|
|
11511
|
+
*
|
|
11512
|
+
* **Security**: By default, sensitive web3 fields (privateKey, mnemonic, apiKey, etc.)
|
|
11513
|
+
* are automatically redacted from log output. Use `redact: false` to disable.
|
|
11514
|
+
*
|
|
11515
|
+
* @example
|
|
11516
|
+
* ```typescript
|
|
11517
|
+
* import { createLogger } from '@core/runtime'
|
|
11518
|
+
*
|
|
11519
|
+
* // Default: web3 sensitive fields are redacted
|
|
11520
|
+
* const logger = createLogger({ level: 'info' })
|
|
11521
|
+
* logger.info('Signing', { privateKey: '0x123...' })
|
|
11522
|
+
* // Output: { context: { privateKey: '[REDACTED]' }, msg: 'Signing' }
|
|
11523
|
+
*
|
|
11524
|
+
* // Disable redaction (use with caution)
|
|
11525
|
+
* const unsafeLogger = createLogger({ level: 'debug', redact: false })
|
|
11526
|
+
*
|
|
11527
|
+
* // Custom redaction paths
|
|
11528
|
+
* const customLogger = createLogger({
|
|
11529
|
+
* level: 'info',
|
|
11530
|
+
* redact: ['context.mySecret', 'context.*.credentials']
|
|
11531
|
+
* })
|
|
11532
|
+
*
|
|
11533
|
+
* // Pretty output for development
|
|
11534
|
+
* const devLogger = createLogger({
|
|
11535
|
+
* level: 'debug',
|
|
11536
|
+
* transport: { target: 'pino-pretty' }
|
|
11537
|
+
* })
|
|
11538
|
+
*
|
|
11539
|
+
* // Browser logger
|
|
11540
|
+
* const browserLogger = createLogger({
|
|
11541
|
+
* browser: { asObject: true }
|
|
11542
|
+
* })
|
|
11543
|
+
* ```
|
|
11544
|
+
*/ function createLogger(options, stream) {
|
|
11545
|
+
const { redact, ...pinoOptions } = options ?? {};
|
|
11546
|
+
// Build redaction config
|
|
11547
|
+
const redactConfig = buildRedactConfig(redact);
|
|
11548
|
+
// Build final pino options, only include redact if defined
|
|
11549
|
+
const finalOptions = redactConfig ? {
|
|
11550
|
+
...pinoOptions,
|
|
11551
|
+
redact: redactConfig
|
|
11552
|
+
} : pinoOptions;
|
|
11553
|
+
const pinoInstance = pino__default(finalOptions);
|
|
11554
|
+
return wrapPino(pinoInstance);
|
|
11555
|
+
}
|
|
11556
|
+
|
|
11182
11557
|
// ============================================================================
|
|
11183
11558
|
// Validation Schema
|
|
11184
11559
|
// ============================================================================
|
|
@@ -11286,6 +11661,9 @@ var TransferSpeed;
|
|
|
11286
11661
|
[TransferSpeed.SLOW]: 2000
|
|
11287
11662
|
});
|
|
11288
11663
|
|
|
11664
|
+
createLogger({
|
|
11665
|
+
name: 'provider-cctp-v2'
|
|
11666
|
+
});
|
|
11289
11667
|
/**
|
|
11290
11668
|
* All chains that are supported by the CCTP v2 provider.
|
|
11291
11669
|
*
|
|
@@ -11295,7 +11673,11 @@ var TransferSpeed;
|
|
|
11295
11673
|
* @internal
|
|
11296
11674
|
*/ Object.values(Chains).filter((chain)=>isCCTPV2Supported(chain));
|
|
11297
11675
|
|
|
11298
|
-
/**
|
|
11676
|
+
/**
|
|
11677
|
+
* Decimal string in token minor units, constrained to be strictly positive.
|
|
11678
|
+
*
|
|
11679
|
+
* @internal
|
|
11680
|
+
*/ const positiveAmountSchema = zod.z.string().regex(/^\d+$/, 'must be a non-negative integer string')// Re-check the digit shape here: zod still runs this refinement when the
|
|
11299
11681
|
// regex check above fails ("dirty"), so guard BigInt() against throwing on a
|
|
11300
11682
|
// non-numeric value before comparing.
|
|
11301
11683
|
.refine((value)=>/^\d+$/.test(value) && BigInt(value) > 0n, 'must be greater than zero');
|
|
@@ -11330,11 +11712,19 @@ const forwardRequestSchema = zod.z.object({
|
|
|
11330
11712
|
const preFinalityRequestSchema = zod.z.object({
|
|
11331
11713
|
type: zod.z.literal('PRE_FINALITY')
|
|
11332
11714
|
}).strict();
|
|
11333
|
-
/**
|
|
11715
|
+
/**
|
|
11716
|
+
* A single quote request item (`FORWARD` or `PRE_FINALITY`).
|
|
11717
|
+
*
|
|
11718
|
+
* @internal
|
|
11719
|
+
*/ const feeQuoteRequestSchema = zod.z.discriminatedUnion('type', [
|
|
11334
11720
|
forwardRequestSchema,
|
|
11335
11721
|
preFinalityRequestSchema
|
|
11336
11722
|
]);
|
|
11337
|
-
/**
|
|
11723
|
+
/**
|
|
11724
|
+
* A non-empty list of quote request items with unique types.
|
|
11725
|
+
*
|
|
11726
|
+
* @internal
|
|
11727
|
+
*/ const feeQuoteRequestsSchema = zod.z.array(feeQuoteRequestSchema).min(1, 'at least one request item is required').refine((items)=>new Set(items.map((item)=>item.type)).size === items.length, 'request item types must be unique');
|
|
11338
11728
|
/**
|
|
11339
11729
|
* A structured `Partial<ApiPollingConfig>` polling override.
|
|
11340
11730
|
*
|
|
@@ -11362,6 +11752,8 @@ const preFinalityRequestSchema = zod.z.object({
|
|
|
11362
11752
|
* it `undefined`, which is falsy and silently selects the production base URL.
|
|
11363
11753
|
* (`buildFeeQuoteUrl` independently re-validates the domains for standalone
|
|
11364
11754
|
* callers.)
|
|
11755
|
+
*
|
|
11756
|
+
* @internal
|
|
11365
11757
|
*/ zod.z.object({
|
|
11366
11758
|
sourceDomain: zod.z.number().int().nonnegative(),
|
|
11367
11759
|
destinationDomain: zod.z.number().int().nonnegative(),
|
|
@@ -11397,7 +11789,11 @@ const metadataSchema = zod.z.object({
|
|
|
11397
11789
|
blockEstimatedAt: zod.z.number().int().nonnegative().optional()
|
|
11398
11790
|
}).passthrough()
|
|
11399
11791
|
]);
|
|
11400
|
-
/**
|
|
11792
|
+
/**
|
|
11793
|
+
* Schema for a signed fee quote returned by the Quote API.
|
|
11794
|
+
*
|
|
11795
|
+
* @internal
|
|
11796
|
+
*/ zod.z.object({
|
|
11401
11797
|
// The runtime YAML spec maps signedQuote to a looser `hex` (which allows
|
|
11402
11798
|
// an empty `0x`); we keep the stricter non-empty form. Do not relax
|
|
11403
11799
|
// without a reason.
|
|
@@ -11411,7 +11807,11 @@ const metadataSchema = zod.z.object({
|
|
|
11411
11807
|
items: zod.z.array(feeQuoteItemSchema),
|
|
11412
11808
|
metadata: metadataSchema.optional()
|
|
11413
11809
|
}).passthrough();
|
|
11414
|
-
/**
|
|
11810
|
+
/**
|
|
11811
|
+
* Validates input to {@link validateQuote}.
|
|
11812
|
+
*
|
|
11813
|
+
* @internal
|
|
11814
|
+
*/ zod.z.object({
|
|
11415
11815
|
sourceDomain: zod.z.number().int().nonnegative(),
|
|
11416
11816
|
abiSignature: zod.z.string().min(1),
|
|
11417
11817
|
args: zod.z.array(zod.z.union([
|
|
@@ -11446,11 +11846,13 @@ const validateQuoteItemSchema = zod.z.object({
|
|
|
11446
11846
|
computedArgsHash: bytes32Schema.optional()
|
|
11447
11847
|
}).passthrough();
|
|
11448
11848
|
/**
|
|
11449
|
-
* Schema for a
|
|
11849
|
+
* Schema for a validate-quote result returned by the Iris `/validate/usdc/:sourceDomain` endpoint.
|
|
11450
11850
|
*
|
|
11451
11851
|
* The endpoint takes the source domain as a URL path parameter and does not
|
|
11452
11852
|
* return it in the response body, so `sourceDomain` is intentionally not part
|
|
11453
11853
|
* of this schema.
|
|
11854
|
+
*
|
|
11855
|
+
* @internal
|
|
11454
11856
|
*/ zod.z.object({
|
|
11455
11857
|
signedQuote: nonEmptyHexSchema,
|
|
11456
11858
|
expiry: quoteExpiryStatusSchema,
|
|
@@ -11470,7 +11872,7 @@ const validateQuoteItemSchema = zod.z.object({
|
|
|
11470
11872
|
registerKit(`${pkg$2.name}/${pkg$2.version}`);
|
|
11471
11873
|
|
|
11472
11874
|
var name$1 = "@circle-fin/swap-kit";
|
|
11473
|
-
var version$1 = "1.6.
|
|
11875
|
+
var version$1 = "1.6.1";
|
|
11474
11876
|
var pkg$1 = {
|
|
11475
11877
|
name: name$1,
|
|
11476
11878
|
version: version$1};
|
|
@@ -21842,7 +22244,7 @@ registerKit(`${pkg$1.name}/${pkg$1.version}`);
|
|
|
21842
22244
|
};
|
|
21843
22245
|
|
|
21844
22246
|
var name = "@circle-fin/earn-kit";
|
|
21845
|
-
var version = "1.6.
|
|
22247
|
+
var version = "1.6.1";
|
|
21846
22248
|
var pkg = {
|
|
21847
22249
|
name: name,
|
|
21848
22250
|
version: version};
|