@sodax/types 2.2.0-rc.1 → 2.2.0-rc.2

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 CHANGED
@@ -96,3 +96,29 @@ function isEvmProvider(provider: IWalletProvider): provider is IEvmWalletProvide
96
96
  return provider.chainType === 'EVM';
97
97
  }
98
98
  ```
99
+
100
+ ## Address Types
101
+
102
+ `GetAddressType<C>` is the type the SDK's address parameters (`srcAddress`, `owner`, …) declare for a `SpokeChainKey` or `ChainType`. Each chain family carries its own address encoding — a Solana address is a base58 public key, not a hex string.
103
+
104
+ | Chain family | Declared type | Encoding to pass |
105
+ | --- | --- | --- |
106
+ | EVM | `Address` | `0x…` |
107
+ | ICON | `IconAddress` | `hx…` (or `cx…` for a contract) |
108
+ | Solana | `SolanaBase58PublicKey` | base58 public key |
109
+ | Sui | `Hex` | `0x…` (32-byte) |
110
+ | Stellar | `Hex` [^addr] | `G…` ed25519 strkey |
111
+ | NEAR | `Address` [^addr] | account id (`alice.near`, or a 64-char implicit account) |
112
+ | Injective, Stacks | `string` | `inj1…` / `SP…`, `ST…` |
113
+
114
+ [^addr]: Stellar and NEAR declare a hex type their chain does not use. The Stellar spoke service passes the address to `Address.fromString` and `loadAccount`, which need a `G…` strkey; the NEAR spoke service passes it as a NEAR account id (`signerId`, `accountId`). Pass the chain's own encoding — the declared type is wrong here, not the chain.
115
+
116
+ `Address`, `Hex` and `IconAddress` are template-literal types, so the compiler does check the prefix. `SolanaBase58PublicKey` and the `string` entries are plain aliases with no branding — nothing there catches a wrong-encoding address until the chain's own SDK rejects it at runtime.
117
+
118
+ ```typescript
119
+ import type { GetAddressType, SpokeChainKey } from '@sodax/types';
120
+
121
+ type AddressForChain<C extends SpokeChainKey> = GetAddressType<C>;
122
+ ```
123
+
124
+ `GetTokenAddressType<C>` is the token-address counterpart: `Address` for EVM chains, `string` everywhere else.
@@ -2571,7 +2571,7 @@ export declare const spokeChainConfig: {
2571
2571
  };
2572
2572
  };
2573
2573
  readonly bnUSD: "no";
2574
- readonly nativeToken: "BTC";
2574
+ readonly nativeToken: "0:0";
2575
2575
  readonly supportedTokens: {
2576
2576
  readonly BTC: {
2577
2577
  readonly symbol: "BTC";
@@ -572,7 +572,9 @@ export const spokeChainConfig = {
572
572
  },
573
573
  chain: baseChainInfo[ChainKeys.BITCOIN_MAINNET],
574
574
  bnUSD: 'no',
575
- nativeToken: 'BTC',
575
+ // Must equal bitcoinSupportedTokens.BTC.address: isNativeToken compares a token's `address`
576
+ // against this value, so a symbol here classifies native BTC as a contract token.
577
+ nativeToken: '0:0',
576
578
  supportedTokens: bitcoinSupportedTokens,
577
579
  radfi: {
578
580
  walletMode: 'TRADING',
@@ -7,7 +7,7 @@ import type { BitcoinRawTransaction, BitcoinReturnType } from '../bitcoin/bitcoi
7
7
  import type { IconRawTransaction, IconReturnType } from '../icon/icon.js';
8
8
  import type { InjectiveRawTransaction, InjectiveReturnType } from '../injective/injective.js';
9
9
  import type { NearRawTransaction, NearReturnType } from '../near/near.js';
10
- import type { SolanaRawTransaction, SolanaReturnType } from '../solana/solana.js';
10
+ import type { SolanaBase58PublicKey, SolanaRawTransaction, SolanaReturnType } from '../solana/solana.js';
11
11
  import type { StacksRawTransaction, StacksReturnType } from '../stacks/stacks.js';
12
12
  import type { StellarRawTransaction, StellarReturnType } from '../stellar/stellar.js';
13
13
  import type { SuiRawTransaction, SuiReturnType } from '../sui/sui.js';
@@ -74,7 +74,7 @@ export type Result<T, E = Error | unknown> = {
74
74
  error: E;
75
75
  };
76
76
  export type GetTokenAddressType<C extends SpokeChainKey | ChainType> = GetChainType<C> extends 'EVM' ? Address : string;
77
- export type GetAddressType<C extends SpokeChainKey | ChainType> = GetChainType<C> extends 'EVM' ? Address : GetChainType<C> extends 'INJECTIVE' ? string : GetChainType<C> extends 'STELLAR' ? Hex : GetChainType<C> extends 'ICON' ? IconAddress : GetChainType<C> extends 'SUI' ? Hex : GetChainType<C> extends 'SOLANA' ? Hex : GetChainType<C> extends 'STACKS' ? string : GetChainType<C> extends 'NEAR' ? Address : string;
77
+ export type GetAddressType<C extends SpokeChainKey | ChainType> = GetChainType<C> extends 'EVM' ? Address : GetChainType<C> extends 'INJECTIVE' ? string : GetChainType<C> extends 'STELLAR' ? Hex : GetChainType<C> extends 'ICON' ? IconAddress : GetChainType<C> extends 'SUI' ? Hex : GetChainType<C> extends 'SOLANA' ? SolanaBase58PublicKey : GetChainType<C> extends 'STACKS' ? string : GetChainType<C> extends 'NEAR' ? Address : string;
78
78
  export type QuoteType = 'exact_input';
79
79
  export type SolverIntentQuoteRequest = {
80
80
  token_src: string;
package/dist/index.d.ts CHANGED
@@ -19,4 +19,4 @@ export * from './sui/index.js';
19
19
  export * from './swap/index.js';
20
20
  export * from './utils/index.js';
21
21
  export * from './wallet/index.js';
22
- export declare const CONFIG_VERSION = 231;
22
+ export declare const CONFIG_VERSION = 232;
package/dist/index.js CHANGED
@@ -19,4 +19,4 @@ export * from './sui/index.js';
19
19
  export * from './swap/index.js';
20
20
  export * from './utils/index.js';
21
21
  export * from './wallet/index.js';
22
- export const CONFIG_VERSION = 231; // this value should be incremented (inside release/sdk branch) each time @sodax/types package is updated
22
+ export const CONFIG_VERSION = 232; // bumped once per release by scripts/bump-versions.sh, on the release branch
@@ -1584,7 +1584,39 @@ export declare const moneyMarketSupportedTokens: {
1584
1584
  readonly hubAsset: "0xce6260224897fe05aad4b00df6cf9d318fe4ae23";
1585
1585
  readonly vault: "0x6BC8C37cba91F76E68C9e6d689A9C21E4d32079B";
1586
1586
  }];
1587
- readonly robinhood: [];
1587
+ readonly robinhood: [{
1588
+ readonly symbol: "ETH";
1589
+ readonly name: "ETH";
1590
+ readonly decimals: 18;
1591
+ readonly address: "0x0000000000000000000000000000000000000000";
1592
+ readonly chainKey: "robinhood";
1593
+ readonly hubAsset: "0x389f1c463438b548f430a9934e99cdedbf124c1f";
1594
+ readonly vault: "0x4effB5813271699683C25c734F4daBc45B363709";
1595
+ }, {
1596
+ readonly symbol: "bnUSD";
1597
+ readonly name: "bnUSD";
1598
+ readonly decimals: 18;
1599
+ readonly address: "0x3cd95C469be0EDFD12Bd4F3a4436B132B7908DF4";
1600
+ readonly chainKey: "robinhood";
1601
+ readonly hubAsset: "0x95f8d76299ac77325b0bd154a1eeb8650367ce4d";
1602
+ readonly vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131";
1603
+ }, {
1604
+ readonly symbol: "SODA";
1605
+ readonly name: "SODAX";
1606
+ readonly decimals: 18;
1607
+ readonly address: "0xA256dd181C3f6E5eC68C6869f5D50a712d47212e";
1608
+ readonly chainKey: "robinhood";
1609
+ readonly hubAsset: "0x06dd369f24623e331053baf31a5138f76eb44f11";
1610
+ readonly vault: "0x21685E341DE7844135329914Be6Bd8D16982d834";
1611
+ }, {
1612
+ readonly symbol: "USDG";
1613
+ readonly name: "Global Dollar";
1614
+ readonly decimals: 6;
1615
+ readonly address: "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168";
1616
+ readonly chainKey: "robinhood";
1617
+ readonly hubAsset: "0xb2e81dddffcc9e49e9c9ded644091dfecf4ff4e7";
1618
+ readonly vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833";
1619
+ }];
1588
1620
  };
1589
1621
  export declare const moneyMarketReserveAssets: [...("0x21685E341DE7844135329914Be6Bd8D16982d834" | "0x7A1A5555842Ad2D0eD274d09b5c4406a95799D5d" | "0x4effB5813271699683C25c734F4daBc45B363709" | "0x40Cd41b35DB9e5109ae7E54b44De8625dB320E6b" | "0x14238D267557E9d799016ad635B53CD15935d290" | "0x811C3fCc13f9c2a23AE2Ae2DCadacFAC6eb5f0eB" | "0xdEa692287E2cE8Cb08FA52917Be0F16b1DACDC87" | "0x6BC8C37cba91F76E68C9e6d689A9C21E4d32079B" | "0x1f22279C89B213944b7Ea41daCB0a868DdCDFd13" | "0xdc5B4b00F98347E95b9F94911213DAB4C687e1e3" | "0xE801CA34E19aBCbFeA12025378D19c4FBE250131" | "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833" | "0xbDf1F453FCB61424011BBDDCB96cFDB30f3Fe876" | "0x9D4b663Eb075d2a1C7B8eaEFB9eCCC0510388B51" | "0x62ecc3Eeb80a162c57624B3fF80313FE69f5203e" | "0x208ED38f4783328aA9eBFeC360D32e7520A9B779" | "0x6E81124fC5d2Bf666B16a0A5d90066eBf35c7411" | "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac" | "0x14C5eB2D25dFb834852dFc85744875d1eCb09748" | "0xCb6B152D3a943f25157381aFcA7fEFCD2ef5a357" | "0x58b0538D7EEaeE69EF32f9F1dE5cbF32A10a977B" | "0xf4ba497c9b805e4bd88a8a9e6a7b8f74984c3e39" | "0xD7d41b5f803b6A40F8A6eAa34E459A4564e39891" | "0x1Fbe5229e9d189F26bEE77E5bFa24309FdA90483" | "0x243b0c26c8b38793908d7C64e8510f21B19B4613" | "0x3BB956cc8922E1Ba4148dc10eD1b4Fa19aa599c4" | "0xe1bad4400d947Bc4fa66f9c0A143D800002083a0" | "0xA3AeFa2BAfEAB479c4Aca6024A16906bbC75566e" | "0xb780e09576C2667ba9F5B80FbAb2e6b8A0a21e37")[], "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"];
1590
1622
  export declare const moneyMarketConfig: {
@@ -3181,7 +3213,39 @@ export declare const moneyMarketConfig: {
3181
3213
  readonly hubAsset: "0xce6260224897fe05aad4b00df6cf9d318fe4ae23";
3182
3214
  readonly vault: "0x6BC8C37cba91F76E68C9e6d689A9C21E4d32079B";
3183
3215
  }];
3184
- readonly robinhood: [];
3216
+ readonly robinhood: [{
3217
+ readonly symbol: "ETH";
3218
+ readonly name: "ETH";
3219
+ readonly decimals: 18;
3220
+ readonly address: "0x0000000000000000000000000000000000000000";
3221
+ readonly chainKey: "robinhood";
3222
+ readonly hubAsset: "0x389f1c463438b548f430a9934e99cdedbf124c1f";
3223
+ readonly vault: "0x4effB5813271699683C25c734F4daBc45B363709";
3224
+ }, {
3225
+ readonly symbol: "bnUSD";
3226
+ readonly name: "bnUSD";
3227
+ readonly decimals: 18;
3228
+ readonly address: "0x3cd95C469be0EDFD12Bd4F3a4436B132B7908DF4";
3229
+ readonly chainKey: "robinhood";
3230
+ readonly hubAsset: "0x95f8d76299ac77325b0bd154a1eeb8650367ce4d";
3231
+ readonly vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131";
3232
+ }, {
3233
+ readonly symbol: "SODA";
3234
+ readonly name: "SODAX";
3235
+ readonly decimals: 18;
3236
+ readonly address: "0xA256dd181C3f6E5eC68C6869f5D50a712d47212e";
3237
+ readonly chainKey: "robinhood";
3238
+ readonly hubAsset: "0x06dd369f24623e331053baf31a5138f76eb44f11";
3239
+ readonly vault: "0x21685E341DE7844135329914Be6Bd8D16982d834";
3240
+ }, {
3241
+ readonly symbol: "USDG";
3242
+ readonly name: "Global Dollar";
3243
+ readonly decimals: 6;
3244
+ readonly address: "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168";
3245
+ readonly chainKey: "robinhood";
3246
+ readonly hubAsset: "0xb2e81dddffcc9e49e9c9ded644091dfecf4ff4e7";
3247
+ readonly vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833";
3248
+ }];
3185
3249
  };
3186
3250
  readonly supportedReserveAssets: [...("0x21685E341DE7844135329914Be6Bd8D16982d834" | "0x7A1A5555842Ad2D0eD274d09b5c4406a95799D5d" | "0x4effB5813271699683C25c734F4daBc45B363709" | "0x40Cd41b35DB9e5109ae7E54b44De8625dB320E6b" | "0x14238D267557E9d799016ad635B53CD15935d290" | "0x811C3fCc13f9c2a23AE2Ae2DCadacFAC6eb5f0eB" | "0xdEa692287E2cE8Cb08FA52917Be0F16b1DACDC87" | "0x6BC8C37cba91F76E68C9e6d689A9C21E4d32079B" | "0x1f22279C89B213944b7Ea41daCB0a868DdCDFd13" | "0xdc5B4b00F98347E95b9F94911213DAB4C687e1e3" | "0xE801CA34E19aBCbFeA12025378D19c4FBE250131" | "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833" | "0xbDf1F453FCB61424011BBDDCB96cFDB30f3Fe876" | "0x9D4b663Eb075d2a1C7B8eaEFB9eCCC0510388B51" | "0x62ecc3Eeb80a162c57624B3fF80313FE69f5203e" | "0x208ED38f4783328aA9eBFeC360D32e7520A9B779" | "0x6E81124fC5d2Bf666B16a0A5d90066eBf35c7411" | "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac" | "0x14C5eB2D25dFb834852dFc85744875d1eCb09748" | "0xCb6B152D3a943f25157381aFcA7fEFCD2ef5a357" | "0x58b0538D7EEaeE69EF32f9F1dE5cbF32A10a977B" | "0xf4ba497c9b805e4bd88a8a9e6a7b8f74984c3e39" | "0xD7d41b5f803b6A40F8A6eAa34E459A4564e39891" | "0x1Fbe5229e9d189F26bEE77E5bFa24309FdA90483" | "0x243b0c26c8b38793908d7C64e8510f21B19B4613" | "0x3BB956cc8922E1Ba4148dc10eD1b4Fa19aa599c4" | "0xe1bad4400d947Bc4fa66f9c0A143D800002083a0" | "0xA3AeFa2BAfEAB479c4Aca6024A16906bbC75566e" | "0xb780e09576C2667ba9F5B80FbAb2e6b8A0a21e37")[], "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"];
3187
3251
  };
@@ -215,8 +215,12 @@ export const moneyMarketSupportedTokens = {
215
215
  spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.USDS,
216
216
  spokeChainConfig[ChainKeys.HEDERA_MAINNET].supportedTokens.XLM,
217
217
  ],
218
- // Robinhood Chain: lending/borrowing deferred at launch (swaps + bridging only)
219
- [ChainKeys.ROBINHOOD_MAINNET]: [],
218
+ [ChainKeys.ROBINHOOD_MAINNET]: [
219
+ spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.ETH,
220
+ spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.bnUSD,
221
+ spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.SODA,
222
+ spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.USDG,
223
+ ],
220
224
  };
221
225
  export const moneyMarketReserveAssets = [
222
226
  ...Object.values(SodaTokens).map(vault => vault.address),
@@ -2124,7 +2124,7 @@ export declare const sodaxConfig: {
2124
2124
  };
2125
2125
  };
2126
2126
  readonly bnUSD: "no";
2127
- readonly nativeToken: "BTC";
2127
+ readonly nativeToken: "0:0";
2128
2128
  readonly supportedTokens: {
2129
2129
  readonly BTC: {
2130
2130
  readonly symbol: "BTC";
@@ -7079,7 +7079,39 @@ export declare const sodaxConfig: {
7079
7079
  readonly hubAsset: "0xce6260224897fe05aad4b00df6cf9d318fe4ae23";
7080
7080
  readonly vault: "0x6BC8C37cba91F76E68C9e6d689A9C21E4d32079B";
7081
7081
  }];
7082
- readonly robinhood: [];
7082
+ readonly robinhood: [{
7083
+ readonly symbol: "ETH";
7084
+ readonly name: "ETH";
7085
+ readonly decimals: 18;
7086
+ readonly address: "0x0000000000000000000000000000000000000000";
7087
+ readonly chainKey: "robinhood";
7088
+ readonly hubAsset: "0x389f1c463438b548f430a9934e99cdedbf124c1f";
7089
+ readonly vault: "0x4effB5813271699683C25c734F4daBc45B363709";
7090
+ }, {
7091
+ readonly symbol: "bnUSD";
7092
+ readonly name: "bnUSD";
7093
+ readonly decimals: 18;
7094
+ readonly address: "0x3cd95C469be0EDFD12Bd4F3a4436B132B7908DF4";
7095
+ readonly chainKey: "robinhood";
7096
+ readonly hubAsset: "0x95f8d76299ac77325b0bd154a1eeb8650367ce4d";
7097
+ readonly vault: "0xE801CA34E19aBCbFeA12025378D19c4FBE250131";
7098
+ }, {
7099
+ readonly symbol: "SODA";
7100
+ readonly name: "SODAX";
7101
+ readonly decimals: 18;
7102
+ readonly address: "0xA256dd181C3f6E5eC68C6869f5D50a712d47212e";
7103
+ readonly chainKey: "robinhood";
7104
+ readonly hubAsset: "0x06dd369f24623e331053baf31a5138f76eb44f11";
7105
+ readonly vault: "0x21685E341DE7844135329914Be6Bd8D16982d834";
7106
+ }, {
7107
+ readonly symbol: "USDG";
7108
+ readonly name: "Global Dollar";
7109
+ readonly decimals: 6;
7110
+ readonly address: "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168";
7111
+ readonly chainKey: "robinhood";
7112
+ readonly hubAsset: "0xb2e81dddffcc9e49e9c9ded644091dfecf4ff4e7";
7113
+ readonly vault: "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833";
7114
+ }];
7083
7115
  };
7084
7116
  readonly supportedReserveAssets: [...("0x21685E341DE7844135329914Be6Bd8D16982d834" | "0x7A1A5555842Ad2D0eD274d09b5c4406a95799D5d" | "0x4effB5813271699683C25c734F4daBc45B363709" | "0x40Cd41b35DB9e5109ae7E54b44De8625dB320E6b" | "0x14238D267557E9d799016ad635B53CD15935d290" | "0x811C3fCc13f9c2a23AE2Ae2DCadacFAC6eb5f0eB" | "0xdEa692287E2cE8Cb08FA52917Be0F16b1DACDC87" | "0x6BC8C37cba91F76E68C9e6d689A9C21E4d32079B" | "0x1f22279C89B213944b7Ea41daCB0a868DdCDFd13" | "0xdc5B4b00F98347E95b9F94911213DAB4C687e1e3" | "0xE801CA34E19aBCbFeA12025378D19c4FBE250131" | "0xAbbb91c0617090F0028BDC27597Cd0D038F3A833" | "0xbDf1F453FCB61424011BBDDCB96cFDB30f3Fe876" | "0x9D4b663Eb075d2a1C7B8eaEFB9eCCC0510388B51" | "0x62ecc3Eeb80a162c57624B3fF80313FE69f5203e" | "0x208ED38f4783328aA9eBFeC360D32e7520A9B779" | "0x6E81124fC5d2Bf666B16a0A5d90066eBf35c7411" | "0x4B207114F9118dEAC56436e1aE3c45648783c7Ac" | "0x14C5eB2D25dFb834852dFc85744875d1eCb09748" | "0xCb6B152D3a943f25157381aFcA7fEFCD2ef5a357" | "0x58b0538D7EEaeE69EF32f9F1dE5cbF32A10a977B" | "0xf4ba497c9b805e4bd88a8a9e6a7b8f74984c3e39" | "0xD7d41b5f803b6A40F8A6eAa34E459A4564e39891" | "0x1Fbe5229e9d189F26bEE77E5bFa24309FdA90483" | "0x243b0c26c8b38793908d7C64e8510f21B19B4613" | "0x3BB956cc8922E1Ba4148dc10eD1b4Fa19aa599c4" | "0xe1bad4400d947Bc4fa66f9c0A143D800002083a0" | "0xA3AeFa2BAfEAB479c4Aca6024A16906bbC75566e" | "0xb780e09576C2667ba9F5B80FbAb2e6b8A0a21e37")[], "0xE801CA34E19aBCbFeA12025378D19c4FBE250131"];
7085
7117
  };
@@ -13,7 +13,7 @@ export type SuiWaitForTransactionParams = {
13
13
  */
14
14
  export interface SuiTransport {
15
15
  readonly endpoint: string;
16
- getCoins(owner: string, coinType: string, limit?: number): Promise<SuiPaginatedCoins>;
16
+ getCoins(owner: string, coinType: string, limit?: number, cursor?: string | null): Promise<SuiPaginatedCoins>;
17
17
  /**
18
18
  * The sender is applied to the transaction the node simulates, which may be a rebuilt copy of the
19
19
  * one passed in — do not rely on your instance coming back mutated.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "2.2.0-rc.1",
7
+ "version": "2.2.0-rc.2",
8
8
  "description": "Sodax Common Types",
9
9
  "main": "dist/index.js",
10
10
  "homepage": "https://github.com/icon-project/sodax-sdks/tree/main/packages/types",
@@ -65,7 +65,7 @@
65
65
  "build": "rm -rf dist && tsc && node ../../scripts/verify-dist-exports.mjs",
66
66
  "dev": "tsc --watch",
67
67
  "ci": "pnpm run pretty && pnpm run build && pnpm run test",
68
- "checkTs": "tsc",
68
+ "checkTs": "tsc && tsc -p tsconfig.check.json && node ../../scripts/check-tests-typechecked.mjs --project tsconfig.check.json",
69
69
  "test": "vitest run",
70
70
  "coverage": "vitest run --coverage",
71
71
  "pretty": "biome format . --write",