@upshiftfinance/sdk 0.3.0 → 0.5.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.
Files changed (61) hide show
  1. package/README.md +6 -2
  2. package/esm/index.d.mts +15 -0
  3. package/esm/index.mjs +18 -0
  4. package/lib/abis/KycRegistry.d.ts +109 -0
  5. package/lib/abis/KycRegistry.js +73 -0
  6. package/lib/abis/index.d.ts +1 -0
  7. package/lib/abis/index.js +1 -0
  8. package/lib/adapters/sui/actions.d.ts +420 -0
  9. package/lib/adapters/sui/actions.js +701 -0
  10. package/lib/adapters/sui/client.d.ts +3 -3
  11. package/lib/adapters/sui/client.js +27 -9
  12. package/lib/adapters/sui/getters.d.ts +268 -0
  13. package/lib/adapters/sui/getters.js +669 -0
  14. package/lib/adapters/sui/index.d.ts +243 -3
  15. package/lib/adapters/sui/index.js +250 -3
  16. package/lib/adapters/sui/targets.d.ts +42 -1
  17. package/lib/adapters/sui/targets.js +42 -1
  18. package/lib/core/analytics/method-taxonomy.d.ts +1 -1
  19. package/lib/core/analytics/method-taxonomy.js +9 -0
  20. package/lib/core/analytics/version.d.ts +1 -1
  21. package/lib/core/analytics/version.js +1 -1
  22. package/lib/core/constants/core.d.ts +5 -0
  23. package/lib/core/constants/core.js +5 -0
  24. package/lib/core/constants/kyc.d.ts +9 -0
  25. package/lib/core/constants/kyc.js +12 -0
  26. package/lib/core/constants/web3.d.ts +2 -2
  27. package/lib/core/constants/web3.js +9 -2
  28. package/lib/core/errors/index.d.ts +90 -1
  29. package/lib/core/errors/index.js +94 -1
  30. package/lib/core/fetcher.d.ts +5 -0
  31. package/lib/core/fetcher.js +1 -1
  32. package/lib/core/helpers/chain-support.d.ts +2 -2
  33. package/lib/core/helpers/chain-support.js +3 -3
  34. package/lib/core/helpers/kyc.d.ts +47 -0
  35. package/lib/core/helpers/kyc.js +111 -0
  36. package/lib/core/helpers/revert-decode.js +3 -2
  37. package/lib/core/index.d.ts +2 -0
  38. package/lib/core/index.js +2 -0
  39. package/lib/evm/methods/crossChainVault.js +25 -43
  40. package/lib/index.d.ts +4 -0
  41. package/lib/index.js +4 -0
  42. package/lib/main.d.ts +33 -3
  43. package/lib/main.js +32 -0
  44. package/lib/modules/api/kyc.d.ts +4 -0
  45. package/lib/modules/api/kyc.js +148 -0
  46. package/lib/modules/api/main.d.ts +63 -1
  47. package/lib/modules/api/main.js +64 -0
  48. package/lib/modules/vaults/getters.d.ts +3 -1
  49. package/lib/modules/vaults/getters.js +82 -10
  50. package/lib/modules/vaults/main.d.ts +41 -3
  51. package/lib/modules/vaults/main.js +82 -6
  52. package/lib/modules/vaults/types.d.ts +7 -1
  53. package/lib/modules/vaults/utils.js +4 -1
  54. package/lib/sdk.d.ts +16363 -14615
  55. package/lib/types/index.d.ts +1 -0
  56. package/lib/types/index.js +1 -0
  57. package/lib/types/kyc.d.ts +61 -0
  58. package/lib/types/kyc.js +3 -0
  59. package/lib/types/vaults.d.ts +2 -0
  60. package/lib/types/webserver.d.ts +5 -0
  61. package/package.json +21 -2
package/README.md CHANGED
@@ -154,7 +154,7 @@ src.ts/
154
154
  │ ├── evm/ # EVM adapter (approve, deposit, redeem, read helpers)
155
155
  │ ├── solana/ # Solana program adapters
156
156
  │ ├── stellar/ # Stellar vault adapters
157
- │ └── sui/ # Sui config and chain-identity helpers
157
+ │ └── sui/ # Sui client, contract targets, vault reads and actions
158
158
  ├── evm/ # EVM cross-chain (LayerZero OVault)
159
159
  ├── modules/ # Feature modules
160
160
  │ ├── vaults/ # Vault read operations
@@ -174,7 +174,7 @@ src.ts/
174
174
  - **EVM Chains**: Ethereum, Arbitrum, Base, BSC, Avalanche, and more — `wagmi/viem` and `ethers` signers supported
175
175
  - **Solana**: Native Solana program support with full vault functionality
176
176
  - **Stellar**: Stellar vault deposit, redeem, and position queries
177
- - **Sui**: chain ID `-2`, address and version (`sui-0`) recognition; vault reads are not supported yet
177
+ - **Sui**: chain ID `-2`; vault reads (`getVault`, `getVaults`), share positions (`getVaultPositions({ suiWallet })`), deposit and instant redeem (`sdk.sui.vaultDeposit`, `sdk.sui.vaultRedeem`). Pass `sui.packageId`, `sui.originalPackageId` and `sui.registryId` until the SDK ships the contract IDs
178
178
  - Unified interface across all chains
179
179
 
180
180
  ### Vault Versions
@@ -183,6 +183,7 @@ src.ts/
183
183
  - `evm-2`: Current EVM vault architecture (separate receipt tokens)
184
184
  - `sol-0`: Solana program-based vaults
185
185
  - `stellar-0`: Stellar-based vaults
186
+ - `sui-0`: Sui Move vaults
186
187
 
187
188
  ### Data Enrichment
188
189
 
@@ -337,6 +338,9 @@ if (walletClient) sdk.evm.setSigner(walletClient);
337
338
 
338
339
  | Method | Description |
339
340
  | --- | --- |
341
+ | `vaultDeposit(options)` | Build an unsigned deposit (dry-run first) |
342
+ | `vaultRedeem(options)` | Build an unsigned instant redemption (dry-run first) |
343
+ | `executeTransaction({ bytes, signature })` | Execute a wallet-signed transaction and wait for it |
340
344
  | `isSuiAddress(address)` | Whether a string is a Sui address / object ID (`0x` + 64 hex) |
341
345
  | `isSuiVault(chainId)` | Whether a chain ID is Sui's (`-2`) |
342
346
  | `network`, `rpcUrl` | The `sui` config passed to `new UpshiftSDK({ sui })` |
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Type entry for ESM consumers of `@upshiftfinance/sdk` (paired with
3
+ * `esm/index.mjs`).
4
+ *
5
+ * The declaration rollup `lib/sdk.d.ts` describes a CommonJS module. Under
6
+ * ESM-mode TypeScript (`module: node16 | nodenext`), a default import of a CJS
7
+ * declaration resolves to the whole `module.exports`, so
8
+ * `new UpshiftSDK()` failed to typecheck ("This expression is not
9
+ * constructable"). `import = require` reads the CJS module as-is, letting us
10
+ * re-export its `default` (the `UpshiftSDK` class) as the ESM default.
11
+ */
12
+ import sdk = require('../lib/sdk.js');
13
+
14
+ export * from '../lib/sdk.js';
15
+ export default sdk.default;
package/esm/index.mjs ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * ESM entry point for `@upshiftfinance/sdk`.
3
+ *
4
+ * The SDK is compiled to CommonJS (`lib/index.js`), where the default export
5
+ * lives on `exports.default`. Node's ESM loader (and tools that follow it:
6
+ * Vite SSR, vitest, tsx, plain `node` with `"type": "module"`) maps a default
7
+ * import of a CJS module to the whole `module.exports` object, so
8
+ * `import UpshiftSDK from '@upshiftfinance/sdk'` returned a namespace object
9
+ * and `new UpshiftSDK()` threw "UpshiftSDK is not a constructor".
10
+ *
11
+ * This wrapper re-exports the same CJS module instance (no dual-package
12
+ * hazard: one copy of every class, cache, and `instanceof` check) and binds
13
+ * its `default` to the `UpshiftSDK` class.
14
+ */
15
+ import cjs from '../lib/index.js';
16
+
17
+ export * from '../lib/index.js';
18
+ export default cjs.default;
@@ -0,0 +1,109 @@
1
+ /** ABI for the Upshift `KycRegistry` (one per chain): wallet status and record reads, the vault entry/exit checks, and the check-side errors. */
2
+ export declare const ABI_KYC_REGISTRY: readonly [{
3
+ readonly type: "function";
4
+ readonly name: "statusOf";
5
+ readonly inputs: readonly [{
6
+ readonly name: "wallet";
7
+ readonly type: "address";
8
+ readonly internalType: "address";
9
+ }];
10
+ readonly outputs: readonly [{
11
+ readonly name: "";
12
+ readonly type: "uint8";
13
+ readonly internalType: "enum IKycRegistry.Status";
14
+ }];
15
+ readonly stateMutability: "view";
16
+ }, {
17
+ readonly type: "function";
18
+ readonly name: "getRecord";
19
+ readonly inputs: readonly [{
20
+ readonly name: "wallet";
21
+ readonly type: "address";
22
+ readonly internalType: "address";
23
+ }];
24
+ readonly outputs: readonly [{
25
+ readonly name: "";
26
+ readonly type: "tuple";
27
+ readonly internalType: "struct IKycRegistry.Record";
28
+ readonly components: readonly [{
29
+ readonly name: "blocked";
30
+ readonly type: "bool";
31
+ readonly internalType: "bool";
32
+ }, {
33
+ readonly name: "verifiedAt";
34
+ readonly type: "uint256";
35
+ readonly internalType: "uint256";
36
+ }, {
37
+ readonly name: "expiresAt";
38
+ readonly type: "uint256";
39
+ readonly internalType: "uint256";
40
+ }, {
41
+ readonly name: "revokedAt";
42
+ readonly type: "uint256";
43
+ readonly internalType: "uint256";
44
+ }];
45
+ }];
46
+ readonly stateMutability: "view";
47
+ }, {
48
+ readonly type: "function";
49
+ readonly name: "canEnter";
50
+ readonly inputs: readonly [{
51
+ readonly name: "addr";
52
+ readonly type: "address";
53
+ readonly internalType: "address";
54
+ }];
55
+ readonly outputs: readonly [{
56
+ readonly name: "ok";
57
+ readonly type: "bool";
58
+ readonly internalType: "bool";
59
+ }];
60
+ readonly stateMutability: "view";
61
+ }, {
62
+ readonly type: "function";
63
+ readonly name: "canExit";
64
+ readonly inputs: readonly [{
65
+ readonly name: "addr";
66
+ readonly type: "address";
67
+ readonly internalType: "address";
68
+ }];
69
+ readonly outputs: readonly [{
70
+ readonly name: "ok";
71
+ readonly type: "bool";
72
+ readonly internalType: "bool";
73
+ }];
74
+ readonly stateMutability: "view";
75
+ }, {
76
+ readonly type: "function";
77
+ readonly name: "isExempt";
78
+ readonly inputs: readonly [{
79
+ readonly name: "addr";
80
+ readonly type: "address";
81
+ readonly internalType: "address";
82
+ }];
83
+ readonly outputs: readonly [{
84
+ readonly name: "";
85
+ readonly type: "bool";
86
+ readonly internalType: "bool";
87
+ }];
88
+ readonly stateMutability: "view";
89
+ }, {
90
+ readonly type: "error";
91
+ readonly name: "KycIneligible";
92
+ readonly inputs: readonly [{
93
+ readonly name: "addr";
94
+ readonly type: "address";
95
+ readonly internalType: "address";
96
+ }, {
97
+ readonly name: "status";
98
+ readonly type: "uint8";
99
+ readonly internalType: "enum IKycRegistry.Status";
100
+ }];
101
+ }, {
102
+ readonly type: "error";
103
+ readonly name: "WalletBlocked";
104
+ readonly inputs: readonly [{
105
+ readonly name: "wallet";
106
+ readonly type: "address";
107
+ readonly internalType: "address";
108
+ }];
109
+ }];
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ABI_KYC_REGISTRY = void 0;
4
+ /** ABI for the Upshift `KycRegistry` (one per chain): wallet status and record reads, the vault entry/exit checks, and the check-side errors. */
5
+ exports.ABI_KYC_REGISTRY = [
6
+ {
7
+ type: 'function',
8
+ name: 'statusOf',
9
+ inputs: [{ name: 'wallet', type: 'address', internalType: 'address' }],
10
+ outputs: [
11
+ { name: '', type: 'uint8', internalType: 'enum IKycRegistry.Status' },
12
+ ],
13
+ stateMutability: 'view',
14
+ },
15
+ {
16
+ type: 'function',
17
+ name: 'getRecord',
18
+ inputs: [{ name: 'wallet', type: 'address', internalType: 'address' }],
19
+ outputs: [
20
+ {
21
+ name: '',
22
+ type: 'tuple',
23
+ internalType: 'struct IKycRegistry.Record',
24
+ components: [
25
+ { name: 'blocked', type: 'bool', internalType: 'bool' },
26
+ { name: 'verifiedAt', type: 'uint256', internalType: 'uint256' },
27
+ { name: 'expiresAt', type: 'uint256', internalType: 'uint256' },
28
+ { name: 'revokedAt', type: 'uint256', internalType: 'uint256' },
29
+ ],
30
+ },
31
+ ],
32
+ stateMutability: 'view',
33
+ },
34
+ {
35
+ type: 'function',
36
+ name: 'canEnter',
37
+ inputs: [{ name: 'addr', type: 'address', internalType: 'address' }],
38
+ outputs: [{ name: 'ok', type: 'bool', internalType: 'bool' }],
39
+ stateMutability: 'view',
40
+ },
41
+ {
42
+ type: 'function',
43
+ name: 'canExit',
44
+ inputs: [{ name: 'addr', type: 'address', internalType: 'address' }],
45
+ outputs: [{ name: 'ok', type: 'bool', internalType: 'bool' }],
46
+ stateMutability: 'view',
47
+ },
48
+ {
49
+ type: 'function',
50
+ name: 'isExempt',
51
+ inputs: [{ name: 'addr', type: 'address', internalType: 'address' }],
52
+ outputs: [{ name: '', type: 'bool', internalType: 'bool' }],
53
+ stateMutability: 'view',
54
+ },
55
+ {
56
+ type: 'error',
57
+ name: 'KycIneligible',
58
+ inputs: [
59
+ { name: 'addr', type: 'address', internalType: 'address' },
60
+ {
61
+ name: 'status',
62
+ type: 'uint8',
63
+ internalType: 'enum IKycRegistry.Status',
64
+ },
65
+ ],
66
+ },
67
+ {
68
+ type: 'error',
69
+ name: 'WalletBlocked',
70
+ inputs: [{ name: 'wallet', type: 'address', internalType: 'address' }],
71
+ },
72
+ ];
73
+ //# sourceMappingURL=KycRegistry.js.map
@@ -32,3 +32,4 @@ export * from './TokenizedVaultV2SenderAllocationWhitelist';
32
32
  export * from './RwaRedeemSubaccount';
33
33
  export * from './OFT';
34
34
  export * from './SwapRouter';
35
+ export * from './KycRegistry';
package/lib/abis/index.js CHANGED
@@ -48,4 +48,5 @@ __exportStar(require("./TokenizedVaultV2SenderAllocationWhitelist"), exports);
48
48
  __exportStar(require("./RwaRedeemSubaccount"), exports);
49
49
  __exportStar(require("./OFT"), exports);
50
50
  __exportStar(require("./SwapRouter"), exports);
51
+ __exportStar(require("./KycRegistry"), exports);
51
52
  //# sourceMappingURL=index.js.map