@chainflip/sdk 1.3.0-beta.3 → 1.3.0-beta.4

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.
@@ -1,5 +1,5 @@
1
- import { ccmMetadataSchema } from './chunk-IFMXL6VR.mjs';
2
- import { z, __name, Chains, uncheckedAssetAndChain, numericString, hexString, btcAddress, hexStringFromNumber, dotAddress, unsignedInteger, u128 } from './chunk-KWYZ5QIZ.mjs';
1
+ import { ccmMetadataSchema } from './chunk-MDK4DBQN.mjs';
2
+ import { z, __name, Chains, uncheckedAssetAndChain, numericString, hexString, btcAddress, hexStringFromNumber, dotAddress, ethereumAddress, unsignedInteger, u128 } from './chunk-MCSQYBKE.mjs';
3
3
  import { u8aToHex } from '@polkadot/util';
4
4
  import { decodeAddress } from '@polkadot/util-crypto';
5
5
  import axios from 'axios';
@@ -68,7 +68,7 @@ var responseValidators = /* @__PURE__ */ __name((network) => ({
68
68
  requestSwapDepositAddress: z.object({
69
69
  address: z.union([
70
70
  dotAddress,
71
- hexString,
71
+ ethereumAddress,
72
72
  btcAddress(network)
73
73
  ]),
74
74
  issued_block: z.number(),
@@ -1,4 +1,4 @@
1
- import { hexToU8a, u8aToHex } from '@polkadot/util';
1
+ import { hexToU8a, u8aToHex, isHex } from '@polkadot/util';
2
2
  import { encodeAddress, decodeAddress, base58Decode } from '@polkadot/util-crypto';
3
3
  import * as ethers from 'ethers';
4
4
 
@@ -462,12 +462,15 @@ var InternalAssets = arrayToMap([
462
462
  "Dot",
463
463
  "Eth",
464
464
  "Btc",
465
- "Usdt"
465
+ "Usdt",
466
+ "ArbUsdc",
467
+ "ArbEth"
466
468
  ]);
467
469
  var Chains = arrayToMap([
468
470
  "Bitcoin",
469
471
  "Ethereum",
470
- "Polkadot"
472
+ "Polkadot",
473
+ "Arbitrum"
471
474
  ]);
472
475
  var Assets = arrayToMap([
473
476
  "FLIP",
@@ -526,6 +529,20 @@ var assetConstants = {
526
529
  name: "Bitcoin",
527
530
  decimals: 8,
528
531
  contractId: 5
532
+ },
533
+ [InternalAssets.ArbEth]: {
534
+ chain: Chains.Arbitrum,
535
+ asset: Assets.ETH,
536
+ name: "Arbitrum Ether",
537
+ decimals: 18,
538
+ contractId: 6
539
+ },
540
+ [InternalAssets.ArbUsdc]: {
541
+ chain: Chains.Arbitrum,
542
+ asset: Assets.USDC,
543
+ name: "Arbitrum USDC",
544
+ decimals: 6,
545
+ contractId: 7
529
546
  }
530
547
  };
531
548
  var chainConstants = {
@@ -555,6 +572,15 @@ var chainConstants = {
555
572
  gasAsset: Assets.BTC,
556
573
  contractId: 3,
557
574
  blockTimeSeconds: 10 * 60
575
+ },
576
+ [Chains.Arbitrum]: {
577
+ assets: [
578
+ Assets.ETH,
579
+ Assets.USDC
580
+ ],
581
+ gasAsset: Assets.ETH,
582
+ contractId: 4,
583
+ blockTimeSeconds: 0.26
558
584
  }
559
585
  };
560
586
  function isValidAssetAndChain(assetAndChain2) {
@@ -589,6 +615,10 @@ function getInternalAsset(asset2) {
589
615
  },
590
616
  [Chains.Polkadot]: {
591
617
  [Assets.DOT]: InternalAssets.Dot
618
+ },
619
+ [Chains.Arbitrum]: {
620
+ [Assets.USDC]: InternalAssets.ArbUsdc,
621
+ [Assets.ETH]: InternalAssets.ArbEth
592
622
  }
593
623
  };
594
624
  return readChainAssetValue(map, asset2);
@@ -4437,8 +4467,6 @@ function assert(condition, message) {
4437
4467
  throw error;
4438
4468
  }
4439
4469
  __name(assert, "assert");
4440
- var isTokenSwap = /* @__PURE__ */ __name((params) => params.srcAsset !== Assets.ETH, "isTokenSwap");
4441
- var isTokenCall = /* @__PURE__ */ __name((params) => params.srcAsset !== Assets.ETH, "isTokenCall");
4442
4470
 
4443
4471
  // ../shared/src/bitcoin.ts
4444
4472
  var import_bech32_buffer = __toESM(require_lib());
@@ -4450,6 +4478,21 @@ var isValidSegwitAddress = /* @__PURE__ */ __name((address) => {
4450
4478
  }, "isValidSegwitAddress");
4451
4479
 
4452
4480
  // ../shared/src/validation/addressValidation.ts
4481
+ var validatePolkadotAddress = /* @__PURE__ */ __name((address) => {
4482
+ try {
4483
+ const bytes = decodeAddress(address);
4484
+ if (isHex(address)) {
4485
+ const pubkey = u8aToHex(bytes);
4486
+ if (pubkey.length !== 66)
4487
+ return false;
4488
+ }
4489
+ encodeAddress(bytes);
4490
+ return true;
4491
+ } catch {
4492
+ return false;
4493
+ }
4494
+ }, "validatePolkadotAddress");
4495
+ var validateEvmAddress = /* @__PURE__ */ __name((address) => ethers.isAddress(address), "validateEvmAddress");
4453
4496
  var assertArraylikeEqual = /* @__PURE__ */ __name((a, b) => {
4454
4497
  assert(a.length === b.length, "arraylike lengths must be equal");
4455
4498
  for (let i = 0; i < a.length; i += 1) {
@@ -4491,6 +4534,39 @@ var validateBitcoinAddress = /* @__PURE__ */ __name((address, network) => valida
4491
4534
  var validateBitcoinMainnetAddress = /* @__PURE__ */ __name((address) => validateBitcoinAddress(address, "mainnet"), "validateBitcoinMainnetAddress");
4492
4535
  var validateBitcoinTestnetAddress = /* @__PURE__ */ __name((address) => validateBitcoinAddress(address, "testnet"), "validateBitcoinTestnetAddress");
4493
4536
  var validateBitcoinRegtestAddress = /* @__PURE__ */ __name((address) => validateBitcoinAddress(address, "regtest"), "validateBitcoinRegtestAddress");
4537
+ var validators = {
4538
+ mainnet: {
4539
+ Bitcoin: validateBitcoinMainnetAddress,
4540
+ Ethereum: validateEvmAddress,
4541
+ Polkadot: validatePolkadotAddress,
4542
+ Arbitrum: validateEvmAddress
4543
+ },
4544
+ perseverance: {
4545
+ Bitcoin: validateBitcoinTestnetAddress,
4546
+ Ethereum: validateEvmAddress,
4547
+ Polkadot: validatePolkadotAddress,
4548
+ Arbitrum: validateEvmAddress
4549
+ },
4550
+ sisyphos: {
4551
+ Bitcoin: validateBitcoinTestnetAddress,
4552
+ Ethereum: validateEvmAddress,
4553
+ Polkadot: validatePolkadotAddress,
4554
+ Arbitrum: validateEvmAddress
4555
+ },
4556
+ backspin: {
4557
+ Bitcoin: validateBitcoinRegtestAddress,
4558
+ Ethereum: validateEvmAddress,
4559
+ Polkadot: validatePolkadotAddress,
4560
+ Arbitrum: validateEvmAddress
4561
+ },
4562
+ localnet: {
4563
+ Bitcoin: validateBitcoinRegtestAddress,
4564
+ Ethereum: validateEvmAddress,
4565
+ Polkadot: validatePolkadotAddress,
4566
+ Arbitrum: validateEvmAddress
4567
+ }
4568
+ };
4569
+ var assertValidAddress = /* @__PURE__ */ __name((chain2, address, network) => assert(validators[network][chain2](address), `Address "${address}" is not a valid "${chain2}" address for "${network}"`), "assertValidAddress");
4494
4570
 
4495
4571
  // ../shared/src/parsers.ts
4496
4572
  var enumValues = Object.values;
@@ -4513,11 +4589,17 @@ var hexStringWithMaxByteSize = /* @__PURE__ */ __name((maxByteSize) => hexString
4513
4589
  var hexStringFromNumber = numericString.transform((arg) => `0x${BigInt(arg).toString(16)}`);
4514
4590
  var btcAddress = /* @__PURE__ */ __name((network) => {
4515
4591
  if (network === "mainnet") {
4516
- return string.regex(/^(1|3|bc1)/).refine(validateBitcoinMainnetAddress);
4592
+ return string.regex(/^(1|3|bc1)/).refine(validateBitcoinMainnetAddress, (address) => ({
4593
+ message: `"${address}" is not a valid Bitcoin mainnet address`
4594
+ }));
4517
4595
  }
4518
4596
  return z.union([
4519
- string.regex(/^(m|n|2|tb1)/).refine(validateBitcoinTestnetAddress),
4520
- string.regex(/^bcrt1/).refine(validateBitcoinRegtestAddress)
4597
+ string.regex(/^(m|n|2|tb1)/).refine(validateBitcoinTestnetAddress, (address) => ({
4598
+ message: `"${address}" is not a valid Bitcoin testnet address`
4599
+ })),
4600
+ string.regex(/^bcrt1/).refine(validateBitcoinRegtestAddress, (address) => ({
4601
+ message: `"${address}" is not a valid Bitcoin regtest address`
4602
+ }))
4521
4603
  ]);
4522
4604
  }, "btcAddress");
4523
4605
  var DOT_PREFIX = 0;
@@ -4534,8 +4616,12 @@ var dotAddress = z.union([
4534
4616
  } catch {
4535
4617
  return null;
4536
4618
  }
4537
- }).refine(isString);
4538
- var ethereumAddress = hexString.refine((address) => ethers.isAddress(address));
4619
+ }).refine(isString, {
4620
+ message: `address is not a valid polkadot address`
4621
+ });
4622
+ var ethereumAddress = hexString.refine((address) => ethers.isAddress(address), (address) => ({
4623
+ message: `${address} is not a valid ethereum address`
4624
+ }));
4539
4625
  numericString.transform((arg) => BigInt(arg));
4540
4626
  var u128 = z.union([
4541
4627
  number,
@@ -4581,4 +4667,4 @@ z.union([
4581
4667
  }))
4582
4668
  ]);
4583
4669
 
4584
- export { Assets, ChainflipNetworks, Chains, InternalAssets, __name, __publicField, assert, asset, assetConstants, btcAddress, chain, chainConstants, dotAddress, ethereumAddress, getInternalAsset, hexString, hexStringFromNumber, hexStringWithMaxByteSize, isNotNullish, isTestnet, isTokenCall, isTokenSwap, numericOrEmptyString, numericString, readChainAssetValue, u128, uncheckedAssetAndChain, unsignedInteger, z };
4670
+ export { Assets, ChainflipNetworks, Chains, InternalAssets, __name, __publicField, assert, assertValidAddress, asset, assetConstants, btcAddress, chain, chainConstants, dotAddress, ethereumAddress, getInternalAsset, hexString, hexStringFromNumber, hexStringWithMaxByteSize, isNotNullish, isTestnet, numericOrEmptyString, numericString, readChainAssetValue, u128, uncheckedAssetAndChain, unsignedInteger, z };
@@ -1,4 +1,4 @@
1
- import { z, chain, asset, numericString, numericOrEmptyString, hexStringWithMaxByteSize } from './chunk-KWYZ5QIZ.mjs';
1
+ import { z, chain, asset, numericString, numericOrEmptyString, hexStringWithMaxByteSize } from './chunk-MCSQYBKE.mjs';
2
2
 
3
3
  // ../shared/src/schemas.ts
4
4
  z.object({
@@ -1,4 +1,4 @@
1
- import { z, ChainflipNetworks, hexString, __name, __publicField, Chains, InternalAssets } from './chunk-KWYZ5QIZ.mjs';
1
+ import { z, ChainflipNetworks, hexString, __name, __publicField, Chains, InternalAssets } from './chunk-MCSQYBKE.mjs';
2
2
  import axios from 'axios';
3
3
  import { Interface, Contract } from 'ethers';
4
4
 
@@ -54,14 +54,22 @@ var chainAssetMapFactory = /* @__PURE__ */ __name((parser, defaultValue) => z.ob
54
54
  }),
55
55
  Polkadot: z.object({
56
56
  DOT: parser
57
+ }),
58
+ Arbitrum: z.object({
59
+ ETH: parser,
60
+ USDC: parser
61
+ }).default({
62
+ ETH: defaultValue,
63
+ USDC: defaultValue
57
64
  })
58
65
  }), "chainAssetMapFactory");
59
- var chainMap = /* @__PURE__ */ __name((parser) => z.object({
66
+ var chainMapFactory = /* @__PURE__ */ __name((parser, defaultValue) => z.object({
60
67
  Bitcoin: parser,
61
68
  Ethereum: parser,
62
- Polkadot: parser
63
- }), "chainMap");
64
- var chainNumberNullableMap = chainMap(numberOrHex.nullable());
69
+ Polkadot: parser,
70
+ Arbitrum: parser.default(defaultValue)
71
+ }), "chainMapFactory");
72
+ var chainNumberNullableMap = chainMapFactory(numberOrHex.nullable(), null);
65
73
  var swappingEnvironment = z.object({
66
74
  maximum_swap_amounts: chainAssetMapFactory(numberOrHex.nullable(), null)
67
75
  });
@@ -77,10 +85,11 @@ var ingressEgressEnvironment = z.object({
77
85
  witness_safety_margins: chainNumberNullableMap,
78
86
  egress_dust_limits: chainAssetMapFactory(numberOrHex, 1),
79
87
  // TODO(1.3): remove optional and default value
80
- channel_opening_fees: chainMap(numberOrHex).optional().default({
88
+ channel_opening_fees: chainMapFactory(numberOrHex, 0).optional().default({
81
89
  Bitcoin: 0,
82
90
  Ethereum: 0,
83
- Polkadot: 0
91
+ Polkadot: 0,
92
+ Arbitrum: 0
84
93
  })
85
94
  }).transform(rename({
86
95
  egress_dust_limits: "minimum_egress_amounts"
@@ -111,6 +120,18 @@ var rpcAsset = z.union([
111
120
  z.object({
112
121
  chain: z.literal("Ethereum"),
113
122
  asset: z.literal("USDC")
123
+ }),
124
+ z.object({
125
+ chain: z.literal("Ethereum"),
126
+ asset: z.literal("USDT")
127
+ }),
128
+ z.object({
129
+ chain: z.literal("Arbitrum"),
130
+ asset: z.literal("ETH")
131
+ }),
132
+ z.object({
133
+ chain: z.literal("Arbitrum"),
134
+ asset: z.literal("USDC")
114
135
  })
115
136
  ]);
116
137
  var poolInfo = z.intersection(z.object({
@@ -136,7 +157,11 @@ var feesInfo = z.object({
136
157
  }),
137
158
  Polkadot: z.object({
138
159
  DOT: poolInfo
139
- })
160
+ }),
161
+ Arbitrum: z.object({
162
+ ETH: poolInfo,
163
+ USDC: poolInfo
164
+ }).optional()
140
165
  });
141
166
  var poolsEnvironment = z.object({
142
167
  fees: feesInfo
@@ -2155,6 +2180,7 @@ var ADDRESSES = {
2155
2180
  FLIP_CONTRACT_ADDRESS: "0x10C6E9530F1C1AF873a391030a1D9E8ed0630D26",
2156
2181
  USDC_CONTRACT_ADDRESS: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
2157
2182
  USDT_CONTRACT_ADDRESS: "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
2183
+ ARBUSDC_CONTRACT_ADDRESS: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
2158
2184
  VAULT_CONTRACT_ADDRESS: "0xB7A5bd0345EF1Cc5E66bf61BdeC17D2461fBd968",
2159
2185
  STATE_CHAIN_GATEWAY_ADDRESS: "0xeEBe00Ac0756308ac4AaBfD76c05c4F3088B8883"
2160
2186
  },
@@ -2162,6 +2188,7 @@ var ADDRESSES = {
2162
2188
  FLIP_CONTRACT_ADDRESS: "0xcD079EAB6B5443b545788Fd210C8800FEADd87fa",
2163
2189
  USDC_CONTRACT_ADDRESS: SEPOLIA_USDC_CONTRACT_ADDRESS,
2164
2190
  USDT_CONTRACT_ADDRESS: SEPOLIA_USDT_CONTRACT_ADDRESS,
2191
+ ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
2165
2192
  VAULT_CONTRACT_ADDRESS: "0xa94d6b1853F3cb611Ed3cCb701b4fdA5a9DACe85",
2166
2193
  STATE_CHAIN_GATEWAY_ADDRESS: "0x1F7fE41C798cc7b1D34BdC8de2dDDA4a4bE744D9"
2167
2194
  },
@@ -2169,6 +2196,7 @@ var ADDRESSES = {
2169
2196
  FLIP_CONTRACT_ADDRESS: "0xdC27c60956cB065D19F08bb69a707E37b36d8086",
2170
2197
  USDC_CONTRACT_ADDRESS: SEPOLIA_USDC_CONTRACT_ADDRESS,
2171
2198
  USDT_CONTRACT_ADDRESS: SEPOLIA_USDT_CONTRACT_ADDRESS,
2199
+ ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
2172
2200
  VAULT_CONTRACT_ADDRESS: "0x36eaD71325604DC15d35FAE584D7b50646D81753",
2173
2201
  STATE_CHAIN_GATEWAY_ADDRESS: "0xA34a967197Ee90BB7fb28e928388a573c5CFd099"
2174
2202
  },
@@ -2176,6 +2204,7 @@ var ADDRESSES = {
2176
2204
  FLIP_CONTRACT_ADDRESS: "0x826180541412D574cf1336d22c0C0a287822678A",
2177
2205
  USDC_CONTRACT_ADDRESS: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
2178
2206
  USDT_CONTRACT_ADDRESS: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
2207
+ ARBUSDC_CONTRACT_ADDRESS: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
2179
2208
  VAULT_CONTRACT_ADDRESS: "0xF5e10380213880111522dd0efD3dbb45b9f62Bcc",
2180
2209
  STATE_CHAIN_GATEWAY_ADDRESS: "0x6995Ab7c4D7F4B03f467Cf4c8E920427d9621DBd"
2181
2210
  }
@@ -2193,6 +2222,8 @@ function getTokenContractAddress(asset, network) {
2193
2222
  return ADDRESSES[network].USDC_CONTRACT_ADDRESS;
2194
2223
  if (asset === InternalAssets.Usdt)
2195
2224
  return ADDRESSES[network].USDT_CONTRACT_ADDRESS;
2225
+ if (asset === InternalAssets.ArbUsdc)
2226
+ return ADDRESSES[network].ARBUSDC_CONTRACT_ADDRESS;
2196
2227
  throw new Error(`No contract address for ${asset} on ${network}`);
2197
2228
  }
2198
2229
  __name(getTokenContractAddress, "getTokenContractAddress");
@@ -2213,11 +2244,15 @@ var approve = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20, allow
2213
2244
  const transaction = await erc20.approve(spenderAddress, amount - allowance, extractOverrides(txOpts));
2214
2245
  return transaction.wait(txOpts.wait);
2215
2246
  }, "approve");
2216
- var getVaultManagerContractAddress = /* @__PURE__ */ __name((network) => ADDRESSES[network].VAULT_CONTRACT_ADDRESS, "getVaultManagerContractAddress");
2247
+ var getVaultContractAddress = /* @__PURE__ */ __name((chain, network) => {
2248
+ if (chain === Chains.Ethereum)
2249
+ return ADDRESSES[network].VAULT_CONTRACT_ADDRESS;
2250
+ throw new Error(`No vault contract address for ${chain} on ${network}`);
2251
+ }, "getVaultContractAddress");
2217
2252
  var getFlipBalance = /* @__PURE__ */ __name(async (network, signer) => {
2218
2253
  const flipAddress = getTokenContractAddress(InternalAssets.Flip, network);
2219
2254
  const flip = ERC20__factory.connect(flipAddress, signer);
2220
2255
  return flip.balanceOf(await signer.getAddress());
2221
2256
  }, "getFlipBalance");
2222
2257
 
2223
- export { StateChainGateway__factory, Vault__factory, approve, checkAllowance, extractOverrides, getEnvironment, getEvmChainId, getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, getTokenContractAddress, getVaultManagerContractAddress };
2258
+ export { StateChainGateway__factory, Vault__factory, approve, checkAllowance, extractOverrides, getEnvironment, getEvmChainId, getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, getTokenContractAddress, getVaultContractAddress };
@@ -1,9 +1,9 @@
1
1
  type ArrayToMap<T extends readonly string[]> = {
2
2
  [K in T[number]]: K;
3
3
  };
4
- declare const InternalAssets: ArrayToMap<readonly ["Flip", "Usdc", "Dot", "Eth", "Btc", "Usdt"]>;
4
+ declare const InternalAssets: ArrayToMap<readonly ["Flip", "Usdc", "Dot", "Eth", "Btc", "Usdt", "ArbUsdc", "ArbEth"]>;
5
5
  type InternalAsset = (typeof InternalAssets)[keyof typeof InternalAssets];
6
- declare const Chains: ArrayToMap<readonly ["Bitcoin", "Ethereum", "Polkadot"]>;
6
+ declare const Chains: ArrayToMap<readonly ["Bitcoin", "Ethereum", "Polkadot", "Arbitrum"]>;
7
7
  type Chain = (typeof Chains)[keyof typeof Chains];
8
8
  declare const Assets: ArrayToMap<readonly ["FLIP", "USDC", "DOT", "ETH", "BTC", "USDT"]>;
9
9
  type Asset = (typeof Assets)[keyof typeof Assets];
@@ -28,6 +28,12 @@ declare const chainConstants: {
28
28
  readonly contractId: 3;
29
29
  readonly blockTimeSeconds: number;
30
30
  };
31
+ readonly Arbitrum: {
32
+ readonly assets: ["ETH", "USDC"];
33
+ readonly gasAsset: "ETH";
34
+ readonly contractId: 4;
35
+ readonly blockTimeSeconds: 0.26;
36
+ };
31
37
  };
32
38
  type AssetOfChain<C extends Chain> = (typeof chainConstants)[C]['assets'][number];
33
39
  type UncheckedAssetAndChain = {
@@ -53,4 +59,4 @@ type TransactionOptions = {
53
59
  wait?: number;
54
60
  };
55
61
 
56
- export { type Asset as A, type ChainflipNetwork as C, type InternalAsset as I, type TransactionOptions as T, type Chain as a, type AssetOfChain as b, type ChainAssetMap as c, type ChainMap as d, Chains as e, Assets as f, InternalAssets as g, ChainflipNetworks as h, getInternalAsset as i };
62
+ export { type Asset as A, type Chain as C, type InternalAsset as I, type TransactionOptions as T, type AssetOfChain as a, type ChainflipNetwork as b, type ChainAssetMap as c, type ChainMap as d, Chains as e, Assets as f, InternalAssets as g, ChainflipNetworks as h, getInternalAsset as i };
@@ -1,9 +1,9 @@
1
1
  type ArrayToMap<T extends readonly string[]> = {
2
2
  [K in T[number]]: K;
3
3
  };
4
- declare const InternalAssets: ArrayToMap<readonly ["Flip", "Usdc", "Dot", "Eth", "Btc", "Usdt"]>;
4
+ declare const InternalAssets: ArrayToMap<readonly ["Flip", "Usdc", "Dot", "Eth", "Btc", "Usdt", "ArbUsdc", "ArbEth"]>;
5
5
  type InternalAsset = (typeof InternalAssets)[keyof typeof InternalAssets];
6
- declare const Chains: ArrayToMap<readonly ["Bitcoin", "Ethereum", "Polkadot"]>;
6
+ declare const Chains: ArrayToMap<readonly ["Bitcoin", "Ethereum", "Polkadot", "Arbitrum"]>;
7
7
  type Chain = (typeof Chains)[keyof typeof Chains];
8
8
  declare const Assets: ArrayToMap<readonly ["FLIP", "USDC", "DOT", "ETH", "BTC", "USDT"]>;
9
9
  type Asset = (typeof Assets)[keyof typeof Assets];
@@ -28,6 +28,12 @@ declare const chainConstants: {
28
28
  readonly contractId: 3;
29
29
  readonly blockTimeSeconds: number;
30
30
  };
31
+ readonly Arbitrum: {
32
+ readonly assets: ["ETH", "USDC"];
33
+ readonly gasAsset: "ETH";
34
+ readonly contractId: 4;
35
+ readonly blockTimeSeconds: 0.26;
36
+ };
31
37
  };
32
38
  type AssetOfChain<C extends Chain> = (typeof chainConstants)[C]['assets'][number];
33
39
  type UncheckedAssetAndChain = {
@@ -53,4 +59,4 @@ type TransactionOptions = {
53
59
  wait?: number;
54
60
  };
55
61
 
56
- export { type Asset as A, type ChainflipNetwork as C, type InternalAsset as I, type TransactionOptions as T, type Chain as a, type AssetOfChain as b, type ChainAssetMap as c, type ChainMap as d, Chains as e, Assets as f, InternalAssets as g, ChainflipNetworks as h, getInternalAsset as i };
62
+ export { type Asset as A, type Chain as C, type InternalAsset as I, type TransactionOptions as T, type AssetOfChain as a, type ChainflipNetwork as b, type ChainAssetMap as c, type ChainMap as d, Chains as e, Assets as f, InternalAssets as g, ChainflipNetworks as h, getInternalAsset as i };
@@ -1,5 +1,5 @@
1
1
  import { Signer } from 'ethers';
2
- import { C as ChainflipNetwork, T as TransactionOptions } from './contracts-lJ2ktbkk.mjs';
2
+ import { b as ChainflipNetwork, T as TransactionOptions } from './contracts-b0BB7B5m.mjs';
3
3
 
4
4
  type PendingRedemption = {
5
5
  amount: bigint;
package/dist/funding.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Signer } from 'ethers';
2
- import { C as ChainflipNetwork, T as TransactionOptions } from './contracts-lJ2ktbkk.js';
2
+ import { b as ChainflipNetwork, T as TransactionOptions } from './contracts-b0BB7B5m.js';
3
3
 
4
4
  type PendingRedemption = {
5
5
  amount: bigint;
package/dist/funding.js CHANGED
@@ -1239,12 +1239,15 @@ var InternalAssets = arrayToMap([
1239
1239
  "Dot",
1240
1240
  "Eth",
1241
1241
  "Btc",
1242
- "Usdt"
1242
+ "Usdt",
1243
+ "ArbUsdc",
1244
+ "ArbEth"
1243
1245
  ]);
1244
1246
  var Chains = arrayToMap([
1245
1247
  "Bitcoin",
1246
1248
  "Ethereum",
1247
- "Polkadot"
1249
+ "Polkadot",
1250
+ "Arbitrum"
1248
1251
  ]);
1249
1252
  var Assets = arrayToMap([
1250
1253
  "FLIP",
@@ -1302,6 +1305,20 @@ var ChainflipNetworks = arrayToMap([
1302
1305
  name: "Bitcoin",
1303
1306
  decimals: 8,
1304
1307
  contractId: 5
1308
+ },
1309
+ [InternalAssets.ArbEth]: {
1310
+ chain: Chains.Arbitrum,
1311
+ asset: Assets.ETH,
1312
+ name: "Arbitrum Ether",
1313
+ decimals: 18,
1314
+ contractId: 6
1315
+ },
1316
+ [InternalAssets.ArbUsdc]: {
1317
+ chain: Chains.Arbitrum,
1318
+ asset: Assets.USDC,
1319
+ name: "Arbitrum USDC",
1320
+ decimals: 6,
1321
+ contractId: 7
1305
1322
  }
1306
1323
  });
1307
1324
  var chainConstants = {
@@ -1331,6 +1348,15 @@ var chainConstants = {
1331
1348
  gasAsset: Assets.BTC,
1332
1349
  contractId: 3,
1333
1350
  blockTimeSeconds: 10 * 60
1351
+ },
1352
+ [Chains.Arbitrum]: {
1353
+ assets: [
1354
+ Assets.ETH,
1355
+ Assets.USDC
1356
+ ],
1357
+ gasAsset: Assets.ETH,
1358
+ contractId: 4,
1359
+ blockTimeSeconds: 0.26
1334
1360
  }
1335
1361
  };
1336
1362
  function isValidAssetAndChain(assetAndChain2) {
@@ -1362,6 +1388,7 @@ var ADDRESSES = {
1362
1388
  FLIP_CONTRACT_ADDRESS: "0x10C6E9530F1C1AF873a391030a1D9E8ed0630D26",
1363
1389
  USDC_CONTRACT_ADDRESS: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
1364
1390
  USDT_CONTRACT_ADDRESS: "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
1391
+ ARBUSDC_CONTRACT_ADDRESS: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
1365
1392
  VAULT_CONTRACT_ADDRESS: "0xB7A5bd0345EF1Cc5E66bf61BdeC17D2461fBd968",
1366
1393
  STATE_CHAIN_GATEWAY_ADDRESS: "0xeEBe00Ac0756308ac4AaBfD76c05c4F3088B8883"
1367
1394
  },
@@ -1369,6 +1396,7 @@ var ADDRESSES = {
1369
1396
  FLIP_CONTRACT_ADDRESS: "0xcD079EAB6B5443b545788Fd210C8800FEADd87fa",
1370
1397
  USDC_CONTRACT_ADDRESS: SEPOLIA_USDC_CONTRACT_ADDRESS,
1371
1398
  USDT_CONTRACT_ADDRESS: SEPOLIA_USDT_CONTRACT_ADDRESS,
1399
+ ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
1372
1400
  VAULT_CONTRACT_ADDRESS: "0xa94d6b1853F3cb611Ed3cCb701b4fdA5a9DACe85",
1373
1401
  STATE_CHAIN_GATEWAY_ADDRESS: "0x1F7fE41C798cc7b1D34BdC8de2dDDA4a4bE744D9"
1374
1402
  },
@@ -1376,6 +1404,7 @@ var ADDRESSES = {
1376
1404
  FLIP_CONTRACT_ADDRESS: "0xdC27c60956cB065D19F08bb69a707E37b36d8086",
1377
1405
  USDC_CONTRACT_ADDRESS: SEPOLIA_USDC_CONTRACT_ADDRESS,
1378
1406
  USDT_CONTRACT_ADDRESS: SEPOLIA_USDT_CONTRACT_ADDRESS,
1407
+ ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
1379
1408
  VAULT_CONTRACT_ADDRESS: "0x36eaD71325604DC15d35FAE584D7b50646D81753",
1380
1409
  STATE_CHAIN_GATEWAY_ADDRESS: "0xA34a967197Ee90BB7fb28e928388a573c5CFd099"
1381
1410
  },
@@ -1383,6 +1412,7 @@ var ADDRESSES = {
1383
1412
  FLIP_CONTRACT_ADDRESS: "0x826180541412D574cf1336d22c0C0a287822678A",
1384
1413
  USDC_CONTRACT_ADDRESS: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
1385
1414
  USDT_CONTRACT_ADDRESS: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
1415
+ ARBUSDC_CONTRACT_ADDRESS: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
1386
1416
  VAULT_CONTRACT_ADDRESS: "0xF5e10380213880111522dd0efD3dbb45b9f62Bcc",
1387
1417
  STATE_CHAIN_GATEWAY_ADDRESS: "0x6995Ab7c4D7F4B03f467Cf4c8E920427d9621DBd"
1388
1418
  }
@@ -1400,6 +1430,8 @@ function getTokenContractAddress(asset2, network) {
1400
1430
  return ADDRESSES[network].USDC_CONTRACT_ADDRESS;
1401
1431
  if (asset2 === InternalAssets.Usdt)
1402
1432
  return ADDRESSES[network].USDT_CONTRACT_ADDRESS;
1433
+ if (asset2 === InternalAssets.ArbUsdc)
1434
+ return ADDRESSES[network].ARBUSDC_CONTRACT_ADDRESS;
1403
1435
  throw new Error(`No contract address for ${asset2} on ${network}`);
1404
1436
  }
1405
1437
  __name(getTokenContractAddress, "getTokenContractAddress");
@@ -5301,8 +5333,12 @@ z.union([
5301
5333
  } catch {
5302
5334
  return null;
5303
5335
  }
5304
- }).refine(isString);
5305
- hexString.refine((address) => ethers2__namespace.isAddress(address));
5336
+ }).refine(isString, {
5337
+ message: `address is not a valid polkadot address`
5338
+ });
5339
+ hexString.refine((address) => ethers2__namespace.isAddress(address), (address) => ({
5340
+ message: `${address} is not a valid ethereum address`
5341
+ }));
5306
5342
  numericString.transform((arg) => BigInt(arg));
5307
5343
  var u128 = z.union([
5308
5344
  number,
@@ -5401,14 +5437,22 @@ var chainAssetMapFactory = /* @__PURE__ */ __name((parser, defaultValue) => z.ob
5401
5437
  }),
5402
5438
  Polkadot: z.object({
5403
5439
  DOT: parser
5440
+ }),
5441
+ Arbitrum: z.object({
5442
+ ETH: parser,
5443
+ USDC: parser
5444
+ }).default({
5445
+ ETH: defaultValue,
5446
+ USDC: defaultValue
5404
5447
  })
5405
5448
  }), "chainAssetMapFactory");
5406
- var chainMap = /* @__PURE__ */ __name((parser) => z.object({
5449
+ var chainMapFactory = /* @__PURE__ */ __name((parser, defaultValue) => z.object({
5407
5450
  Bitcoin: parser,
5408
5451
  Ethereum: parser,
5409
- Polkadot: parser
5410
- }), "chainMap");
5411
- var chainNumberNullableMap = chainMap(numberOrHex.nullable());
5452
+ Polkadot: parser,
5453
+ Arbitrum: parser.default(defaultValue)
5454
+ }), "chainMapFactory");
5455
+ var chainNumberNullableMap = chainMapFactory(numberOrHex.nullable(), null);
5412
5456
  var swappingEnvironment = z.object({
5413
5457
  maximum_swap_amounts: chainAssetMapFactory(numberOrHex.nullable(), null)
5414
5458
  });
@@ -5424,10 +5468,11 @@ var ingressEgressEnvironment = z.object({
5424
5468
  witness_safety_margins: chainNumberNullableMap,
5425
5469
  egress_dust_limits: chainAssetMapFactory(numberOrHex, 1),
5426
5470
  // TODO(1.3): remove optional and default value
5427
- channel_opening_fees: chainMap(numberOrHex).optional().default({
5471
+ channel_opening_fees: chainMapFactory(numberOrHex, 0).optional().default({
5428
5472
  Bitcoin: 0,
5429
5473
  Ethereum: 0,
5430
- Polkadot: 0
5474
+ Polkadot: 0,
5475
+ Arbitrum: 0
5431
5476
  })
5432
5477
  }).transform(rename({
5433
5478
  egress_dust_limits: "minimum_egress_amounts"
@@ -5458,6 +5503,18 @@ var rpcAsset = z.union([
5458
5503
  z.object({
5459
5504
  chain: z.literal("Ethereum"),
5460
5505
  asset: z.literal("USDC")
5506
+ }),
5507
+ z.object({
5508
+ chain: z.literal("Ethereum"),
5509
+ asset: z.literal("USDT")
5510
+ }),
5511
+ z.object({
5512
+ chain: z.literal("Arbitrum"),
5513
+ asset: z.literal("ETH")
5514
+ }),
5515
+ z.object({
5516
+ chain: z.literal("Arbitrum"),
5517
+ asset: z.literal("USDC")
5461
5518
  })
5462
5519
  ]);
5463
5520
  var poolInfo = z.intersection(z.object({
@@ -5483,7 +5540,11 @@ var feesInfo = z.object({
5483
5540
  }),
5484
5541
  Polkadot: z.object({
5485
5542
  DOT: poolInfo
5486
- })
5543
+ }),
5544
+ Arbitrum: z.object({
5545
+ ETH: poolInfo,
5546
+ USDC: poolInfo
5547
+ }).optional()
5487
5548
  });
5488
5549
  var poolsEnvironment = z.object({
5489
5550
  fees: feesInfo
package/dist/funding.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, checkAllowance, extractOverrides, StateChainGateway__factory } from './chunk-FDK3LRGL.mjs';
2
- import { __name, __publicField, ChainflipNetworks, InternalAssets, assert } from './chunk-KWYZ5QIZ.mjs';
1
+ import { getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, checkAllowance, extractOverrides, StateChainGateway__factory } from './chunk-UYSYBID6.mjs';
2
+ import { __name, __publicField, ChainflipNetworks, InternalAssets, assert } from './chunk-MCSQYBKE.mjs';
3
3
 
4
4
  // ../shared/src/stateChainGateway/utils.ts
5
5
  var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {