@upshiftfinance/sdk 0.1.0 → 0.3.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.
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Move-call targets for the Upshift Sui vault package.
3
+ *
4
+ * One table names every package function the SDK calls, together with the Move
5
+ * parameter list it expects. The target helpers read the module and function
6
+ * from it, and the contracts drift check
7
+ * (`packages/sdk/scripts/check-sui-contracts-drift.mjs`) compares the parameter
8
+ * lists with the Move sources at the commit pinned in
9
+ * `packages/sdk/.sui-vaults-contracts-pin`, so a contract change that would
10
+ * break a call fails CI instead of a user's transaction.
11
+ *
12
+ * @module SuiTargets
13
+ */
14
+ import type { ISuiConfig } from '../../types';
15
+ import { type ISuiVaultContracts } from './constants';
16
+ /** A package function the SDK calls, with the Move signature it relies on. */
17
+ export interface ISuiVaultTargetSpec {
18
+ /** Move module inside the `upshift_vault` package. */
19
+ module: 'coin_entry' | 'vault' | 'withdrawal';
20
+ /** Function name inside `module`. */
21
+ function: string;
22
+ /**
23
+ * Parameter types as written in the Move source, without names (for example
24
+ * `&mut Vault<Asset, Share>`). Checked against the pinned contracts.
25
+ */
26
+ params: readonly string[];
27
+ }
28
+ /**
29
+ * Every `upshift_vault` function the SDK calls, keyed by a stable name.
30
+ *
31
+ * Vault functions take the `<Asset, Share>` type arguments built by
32
+ * {@link suiVaultTypeArguments}; `withdrawal::share` takes `<Share>` only.
33
+ */
34
+ export declare const SUI_VAULT_TARGETS: {
35
+ readonly deposit: {
36
+ readonly module: "coin_entry";
37
+ readonly function: "deposit";
38
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "Coin<Asset>", "&mut TxContext"];
39
+ };
40
+ readonly depositChecked: {
41
+ readonly module: "coin_entry";
42
+ readonly function: "deposit_checked";
43
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "Coin<Asset>", "u64", "&mut TxContext"];
44
+ };
45
+ readonly redeem: {
46
+ readonly module: "coin_entry";
47
+ readonly function: "redeem";
48
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "Coin<Share>", "&mut TxContext"];
49
+ };
50
+ readonly redeemChecked: {
51
+ readonly module: "coin_entry";
52
+ readonly function: "redeem_checked";
53
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "Coin<Share>", "u64", "&mut TxContext"];
54
+ };
55
+ readonly requestWithdrawal: {
56
+ readonly module: "coin_entry";
57
+ readonly function: "request_withdrawal";
58
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "Coin<Share>", "u64", "address", "Option<address>", "&Clock", "&TxContext"];
59
+ };
60
+ readonly cancelWithdrawal: {
61
+ readonly module: "coin_entry";
62
+ readonly function: "cancel_withdrawal";
63
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "WithdrawalRequest<Share>", "&mut TxContext"];
64
+ };
65
+ readonly shareWithdrawalRequest: {
66
+ readonly module: "withdrawal";
67
+ readonly function: "share";
68
+ readonly params: readonly ["WithdrawalRequest<Share>"];
69
+ };
70
+ readonly finalizeWithdrawal: {
71
+ readonly module: "vault";
72
+ readonly function: "finalize_withdrawal";
73
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "WithdrawalRequest<Share>", "&Clock", "&TxContext"];
74
+ };
75
+ readonly finalizeWithdrawalChecked: {
76
+ readonly module: "vault";
77
+ readonly function: "finalize_withdrawal_checked";
78
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "WithdrawalRequest<Share>", "u64", "&Clock", "&TxContext"];
79
+ };
80
+ readonly chargeManagementFee: {
81
+ readonly module: "vault";
82
+ readonly function: "charge_management_fee";
83
+ readonly params: readonly ["&mut Vault<Asset, Share>", "&Registry", "&Clock"];
84
+ };
85
+ readonly totalAssets: {
86
+ readonly module: "vault";
87
+ readonly function: "total_assets";
88
+ readonly params: readonly ["&Vault<Asset, Share>", "&Registry"];
89
+ };
90
+ readonly totalSupply: {
91
+ readonly module: "vault";
92
+ readonly function: "total_supply";
93
+ readonly params: readonly ["&Vault<Asset, Share>"];
94
+ };
95
+ readonly sharePrice: {
96
+ readonly module: "vault";
97
+ readonly function: "share_price";
98
+ readonly params: readonly ["&Vault<Asset, Share>", "&Registry"];
99
+ };
100
+ readonly previewDeposit: {
101
+ readonly module: "vault";
102
+ readonly function: "preview_deposit";
103
+ readonly params: readonly ["&Vault<Asset, Share>", "&Registry", "u64"];
104
+ };
105
+ readonly previewRedemption: {
106
+ readonly module: "vault";
107
+ readonly function: "preview_redemption";
108
+ readonly params: readonly ["&Vault<Asset, Share>", "&Registry", "u64", "bool"];
109
+ };
110
+ };
111
+ /** Name of a package function the SDK calls; a key of {@link SUI_VAULT_TARGETS}. */
112
+ export type ISuiVaultTarget = keyof typeof SUI_VAULT_TARGETS;
113
+ /** A fully qualified move-call target: `<package>::<module>::<function>`. */
114
+ export type ISuiMoveCallTarget = `${string}::${string}::${string}`;
115
+ /**
116
+ * Resolve the Upshift vault contract IDs for a Sui config: each `sui` override
117
+ * wins over the SDK's built-in ID for the network.
118
+ *
119
+ * @param config - The `sui` config passed to `new UpshiftSDK({ sui })`.
120
+ * @returns The package, original package and Registry IDs for the network.
121
+ * @throws {@link UpshiftValidationError} (`INVALID_INPUT`) when an ID is
122
+ * missing for the network — the SDK ships none until the contracts are
123
+ * published there — or is not a long-form Sui ID (`0x` + 64 hex chars).
124
+ * @example
125
+ * ```ts
126
+ * const contracts = resolveSuiVaultContracts({
127
+ * network: 'testnet',
128
+ * packageId: '0x…',
129
+ * originalPackageId: '0x…',
130
+ * registryId: '0x…',
131
+ * });
132
+ * ```
133
+ */
134
+ export declare function resolveSuiVaultContracts(config?: ISuiConfig): ISuiVaultContracts;
135
+ /**
136
+ * Build the move-call target for a package function, on the latest package.
137
+ *
138
+ * @param contracts - Contract IDs from {@link resolveSuiVaultContracts}.
139
+ * @param target - Which package function to call.
140
+ * @returns `<packageId>::<module>::<function>`, ready for `tx.moveCall`.
141
+ * @example
142
+ * ```ts
143
+ * tx.moveCall({
144
+ * target: suiMoveCallTarget(contracts, 'deposit'),
145
+ * typeArguments: suiVaultTypeArguments(assetType, shareType),
146
+ * arguments: [tx.object(vaultId), tx.object(contracts.registryId), coin],
147
+ * });
148
+ * ```
149
+ */
150
+ export declare function suiMoveCallTarget(contracts: Pick<ISuiVaultContracts, 'packageId'>, target: ISuiVaultTarget): ISuiMoveCallTarget;
151
+ /**
152
+ * Type arguments for a vault function: `[Asset, Share]`, in that order.
153
+ *
154
+ * @param assetCoinType - Move type of the deposit coin, e.g. `0x…::usdc::USDC`.
155
+ * @param shareCoinType - Move type of the vault's share coin.
156
+ * @returns `[assetCoinType, shareCoinType]`.
157
+ */
158
+ export declare function suiVaultTypeArguments(assetCoinType: string, shareCoinType: string): [string, string];
159
+ /**
160
+ * The on-chain Move type of a vault object, which names the original package.
161
+ *
162
+ * Matches the `type` a fullnode reports for the object: type arguments joined
163
+ * by a bare comma, as the node prints them. Pass coin types in the node's
164
+ * long form (`0x` + 64 hex chars) for an exact string match.
165
+ *
166
+ * @param contracts - Contract IDs from {@link resolveSuiVaultContracts}.
167
+ * @param assetCoinType - Move type of the deposit coin.
168
+ * @param shareCoinType - Move type of the vault's share coin.
169
+ * @returns `<originalPackageId>::vault::Vault<Asset,Share>`.
170
+ */
171
+ export declare function suiVaultObjectType(contracts: Pick<ISuiVaultContracts, 'originalPackageId'>, assetCoinType: string, shareCoinType: string): string;
@@ -0,0 +1,225 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SUI_VAULT_TARGETS = void 0;
4
+ exports.resolveSuiVaultContracts = resolveSuiVaultContracts;
5
+ exports.suiMoveCallTarget = suiMoveCallTarget;
6
+ exports.suiVaultTypeArguments = suiVaultTypeArguments;
7
+ exports.suiVaultObjectType = suiVaultObjectType;
8
+ const errors_1 = require("../../core/errors");
9
+ const chain_address_1 = require("../../core/helpers/chain-address");
10
+ const constants_1 = require("./constants");
11
+ /**
12
+ * Every `upshift_vault` function the SDK calls, keyed by a stable name.
13
+ *
14
+ * Vault functions take the `<Asset, Share>` type arguments built by
15
+ * {@link suiVaultTypeArguments}; `withdrawal::share` takes `<Share>` only.
16
+ */
17
+ exports.SUI_VAULT_TARGETS = {
18
+ deposit: {
19
+ module: 'coin_entry',
20
+ function: 'deposit',
21
+ params: [
22
+ '&mut Vault<Asset, Share>',
23
+ '&Registry',
24
+ 'Coin<Asset>',
25
+ '&mut TxContext',
26
+ ],
27
+ },
28
+ depositChecked: {
29
+ module: 'coin_entry',
30
+ function: 'deposit_checked',
31
+ params: [
32
+ '&mut Vault<Asset, Share>',
33
+ '&Registry',
34
+ 'Coin<Asset>',
35
+ 'u64',
36
+ '&mut TxContext',
37
+ ],
38
+ },
39
+ redeem: {
40
+ module: 'coin_entry',
41
+ function: 'redeem',
42
+ params: [
43
+ '&mut Vault<Asset, Share>',
44
+ '&Registry',
45
+ 'Coin<Share>',
46
+ '&mut TxContext',
47
+ ],
48
+ },
49
+ redeemChecked: {
50
+ module: 'coin_entry',
51
+ function: 'redeem_checked',
52
+ params: [
53
+ '&mut Vault<Asset, Share>',
54
+ '&Registry',
55
+ 'Coin<Share>',
56
+ 'u64',
57
+ '&mut TxContext',
58
+ ],
59
+ },
60
+ requestWithdrawal: {
61
+ module: 'coin_entry',
62
+ function: 'request_withdrawal',
63
+ params: [
64
+ '&mut Vault<Asset, Share>',
65
+ '&Registry',
66
+ 'Coin<Share>',
67
+ 'u64',
68
+ 'address',
69
+ 'Option<address>',
70
+ '&Clock',
71
+ '&TxContext',
72
+ ],
73
+ },
74
+ cancelWithdrawal: {
75
+ module: 'coin_entry',
76
+ function: 'cancel_withdrawal',
77
+ params: [
78
+ '&mut Vault<Asset, Share>',
79
+ '&Registry',
80
+ 'WithdrawalRequest<Share>',
81
+ '&mut TxContext',
82
+ ],
83
+ },
84
+ shareWithdrawalRequest: {
85
+ module: 'withdrawal',
86
+ function: 'share',
87
+ params: ['WithdrawalRequest<Share>'],
88
+ },
89
+ finalizeWithdrawal: {
90
+ module: 'vault',
91
+ function: 'finalize_withdrawal',
92
+ params: [
93
+ '&mut Vault<Asset, Share>',
94
+ '&Registry',
95
+ 'WithdrawalRequest<Share>',
96
+ '&Clock',
97
+ '&TxContext',
98
+ ],
99
+ },
100
+ finalizeWithdrawalChecked: {
101
+ module: 'vault',
102
+ function: 'finalize_withdrawal_checked',
103
+ params: [
104
+ '&mut Vault<Asset, Share>',
105
+ '&Registry',
106
+ 'WithdrawalRequest<Share>',
107
+ 'u64',
108
+ '&Clock',
109
+ '&TxContext',
110
+ ],
111
+ },
112
+ chargeManagementFee: {
113
+ module: 'vault',
114
+ function: 'charge_management_fee',
115
+ params: ['&mut Vault<Asset, Share>', '&Registry', '&Clock'],
116
+ },
117
+ totalAssets: {
118
+ module: 'vault',
119
+ function: 'total_assets',
120
+ params: ['&Vault<Asset, Share>', '&Registry'],
121
+ },
122
+ totalSupply: {
123
+ module: 'vault',
124
+ function: 'total_supply',
125
+ params: ['&Vault<Asset, Share>'],
126
+ },
127
+ sharePrice: {
128
+ module: 'vault',
129
+ function: 'share_price',
130
+ params: ['&Vault<Asset, Share>', '&Registry'],
131
+ },
132
+ previewDeposit: {
133
+ module: 'vault',
134
+ function: 'preview_deposit',
135
+ params: ['&Vault<Asset, Share>', '&Registry', 'u64'],
136
+ },
137
+ previewRedemption: {
138
+ module: 'vault',
139
+ function: 'preview_redemption',
140
+ params: ['&Vault<Asset, Share>', '&Registry', 'u64', 'bool'],
141
+ },
142
+ };
143
+ /**
144
+ * Resolve the Upshift vault contract IDs for a Sui config: each `sui` override
145
+ * wins over the SDK's built-in ID for the network.
146
+ *
147
+ * @param config - The `sui` config passed to `new UpshiftSDK({ sui })`.
148
+ * @returns The package, original package and Registry IDs for the network.
149
+ * @throws {@link UpshiftValidationError} (`INVALID_INPUT`) when an ID is
150
+ * missing for the network — the SDK ships none until the contracts are
151
+ * published there — or is not a long-form Sui ID (`0x` + 64 hex chars).
152
+ * @example
153
+ * ```ts
154
+ * const contracts = resolveSuiVaultContracts({
155
+ * network: 'testnet',
156
+ * packageId: '0x…',
157
+ * originalPackageId: '0x…',
158
+ * registryId: '0x…',
159
+ * });
160
+ * ```
161
+ */
162
+ function resolveSuiVaultContracts(config = {}) {
163
+ const network = config.network ?? 'mainnet';
164
+ const defaults = constants_1.SUI_VAULT_CONTRACTS[network];
165
+ const resolved = {
166
+ packageId: config.packageId ?? defaults.packageId,
167
+ originalPackageId: config.originalPackageId ?? defaults.originalPackageId,
168
+ registryId: config.registryId ?? defaults.registryId,
169
+ };
170
+ for (const [field, value] of Object.entries(resolved)) {
171
+ if (!value) {
172
+ throw new errors_1.UpshiftValidationError('INVALID_INPUT', `Sui ${network}: no ${field} for the Upshift vault contracts. ` +
173
+ `Pass it as \`sui.${field}\` in new UpshiftSDK({ sui }).`, { context: { network, field } });
174
+ }
175
+ if (!(0, chain_address_1.isSuiAddress)(value)) {
176
+ throw new errors_1.UpshiftValidationError('INVALID_INPUT', `Sui ${network}: ${field} must be a long-form Sui ID (0x + 64 hex chars).`, { context: { network, field } });
177
+ }
178
+ }
179
+ return resolved;
180
+ }
181
+ /**
182
+ * Build the move-call target for a package function, on the latest package.
183
+ *
184
+ * @param contracts - Contract IDs from {@link resolveSuiVaultContracts}.
185
+ * @param target - Which package function to call.
186
+ * @returns `<packageId>::<module>::<function>`, ready for `tx.moveCall`.
187
+ * @example
188
+ * ```ts
189
+ * tx.moveCall({
190
+ * target: suiMoveCallTarget(contracts, 'deposit'),
191
+ * typeArguments: suiVaultTypeArguments(assetType, shareType),
192
+ * arguments: [tx.object(vaultId), tx.object(contracts.registryId), coin],
193
+ * });
194
+ * ```
195
+ */
196
+ function suiMoveCallTarget(contracts, target) {
197
+ const spec = exports.SUI_VAULT_TARGETS[target];
198
+ return `${contracts.packageId}::${spec.module}::${spec.function}`;
199
+ }
200
+ /**
201
+ * Type arguments for a vault function: `[Asset, Share]`, in that order.
202
+ *
203
+ * @param assetCoinType - Move type of the deposit coin, e.g. `0x…::usdc::USDC`.
204
+ * @param shareCoinType - Move type of the vault's share coin.
205
+ * @returns `[assetCoinType, shareCoinType]`.
206
+ */
207
+ function suiVaultTypeArguments(assetCoinType, shareCoinType) {
208
+ return [assetCoinType, shareCoinType];
209
+ }
210
+ /**
211
+ * The on-chain Move type of a vault object, which names the original package.
212
+ *
213
+ * Matches the `type` a fullnode reports for the object: type arguments joined
214
+ * by a bare comma, as the node prints them. Pass coin types in the node's
215
+ * long form (`0x` + 64 hex chars) for an exact string match.
216
+ *
217
+ * @param contracts - Contract IDs from {@link resolveSuiVaultContracts}.
218
+ * @param assetCoinType - Move type of the deposit coin.
219
+ * @param shareCoinType - Move type of the vault's share coin.
220
+ * @returns `<originalPackageId>::vault::Vault<Asset,Share>`.
221
+ */
222
+ function suiVaultObjectType(contracts, assetCoinType, shareCoinType) {
223
+ return `${contracts.originalPackageId}::vault::Vault<${assetCoinType},${shareCoinType}>`;
224
+ }
225
+ //# sourceMappingURL=targets.js.map
@@ -3,4 +3,4 @@
3
3
  * Generated at build time from package.json version
4
4
  * This file is gitignored and regenerated by every build
5
5
  */
6
- export declare const SDK_VERSION = "0.1.0-beta";
6
+ export declare const SDK_VERSION = "0.3.0";
@@ -6,5 +6,5 @@ exports.SDK_VERSION = void 0;
6
6
  * Generated at build time from package.json version
7
7
  * This file is gitignored and regenerated by every build
8
8
  */
9
- exports.SDK_VERSION = '0.1.0-beta';
9
+ exports.SDK_VERSION = '0.3.0';
10
10
  //# sourceMappingURL=version.js.map
@@ -11,7 +11,13 @@ exports.SWAP_ROUTER_DEX_AGGREGATOR = exports.SWAP_ROUTER_WRAPPED_NATIVE = export
11
11
  */
12
12
  exports.SWAP_ROUTER_ADDRESSES = {
13
13
  1: '0xC11c6d8fD8FfFB2045d57b149125C44414d8160B',
14
+ 14: '0xe4c219e5966e97A2bF92464F1BAdB9EbAb3164bb',
15
+ 143: '0xF47ce4B8df30bc3B3b6cc21Fe1552A2198A4A4F7',
14
16
  999: '0x1766f1F4C80756c0985ae93E3cf5cA5024bdAE6F',
17
+ 4114: '0x5B02d6B43fED3EE010741712553F2423A256E9cf',
18
+ 8453: '0x261c97E80C105F85BBbe1416E6eC67C76B9910E2',
19
+ 25363: '0xAC771209FF2b71EECfF6E85a9AD01db8Ff2618B0',
20
+ 43114: '0x3ECc92b2244210BF09485a398f680255E80CC393',
15
21
  };
16
22
  /**
17
23
  * Human-readable display name of the `SwapRouter` periphery contract on each
@@ -28,7 +34,13 @@ exports.SWAP_ROUTER_ADDRESSES = {
28
34
  */
29
35
  exports.SWAP_ROUTER_NAMES = {
30
36
  1: 'Upshift Swap Router',
37
+ 14: 'Upshift Swap Router',
38
+ 143: 'Upshift Swap Router',
31
39
  999: 'Upshift Swap Router',
40
+ 4114: 'Upshift Swap Router',
41
+ 8453: 'Upshift Swap Router',
42
+ 25363: 'Upshift Swap Router',
43
+ 43114: 'Upshift Swap Router',
32
44
  };
33
45
  /**
34
46
  * Vaults whose UI **may offer the any-token SwapRouter deposit surface**
@@ -92,7 +104,13 @@ exports.VAULTS_USING_SWAP_ROUTER = exports.SWAP_ROUTER_ELIGIBLE_VAULTS;
92
104
  */
93
105
  exports.SWAP_ROUTER_DEPLOY_BLOCKS = {
94
106
  1: 26248966,
107
+ 14: 73318820,
108
+ 143: 117851166,
95
109
  999: 49232457,
110
+ 4114: 14623509,
111
+ 8453: 53279941,
112
+ 25363: 19579805,
113
+ 43114: 98940280,
96
114
  };
97
115
  /**
98
116
  * 32-byte origin codes registered on the `SwapRouter` via `addOrigin`.
@@ -157,7 +175,13 @@ exports.SWAP_ROUTER_MAX_SWAPS = 9;
157
175
  */
158
176
  exports.SWAP_ROUTER_WRAPPED_NATIVE = {
159
177
  1: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
178
+ 14: '0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d',
179
+ 143: '0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A',
160
180
  999: '0x5555555555555555555555555555555555555555',
181
+ 4114: '0x3100000000000000000000000000000000000006',
182
+ 8453: '0x4200000000000000000000000000000000000006',
183
+ 25363: '0x927C469E58Daab257Ea60B2D8c37bEDD2a203A54',
184
+ 43114: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7',
161
185
  };
162
186
  /**
163
187
  * The DEX aggregator whitelisted on each chain's `SwapRouter` via
package/lib/sdk.d.ts CHANGED
@@ -21013,12 +21013,31 @@ declare type AsArray<T> = T extends readonly unknown[] ? T : never;
21013
21013
  */
21014
21014
  export declare interface ISuiConfig {
21015
21015
  /**
21016
- * Override Sui RPC endpoint (e.g. a consumer's keyed provider URL).
21017
- * Optional — omit to use the SDK's default endpoint for `network`.
21016
+ * Override Sui gRPC endpoint (e.g. a consumer's keyed provider URL). It must
21017
+ * serve gRPC-web, which the SDK uses so the same code runs in browsers. When
21018
+ * set it becomes the primary, with the SDK's built-in public fullnode kept
21019
+ * behind it as failover. Optional — omit to use the public fullnode.
21018
21020
  */
21019
21021
  rpcUrl?: string;
21020
21022
  /** Sui network; defaults to `'mainnet'` when omitted. */
21021
21023
  network?: ISuiNetwork;
21024
+ /**
21025
+ * Latest published ID of the `upshift_vault` Move package — the ID move calls
21026
+ * target. Overrides the SDK's default for `network`; required until the SDK
21027
+ * ships one. Long form: `0x` + 64 hex chars.
21028
+ */
21029
+ packageId?: string;
21030
+ /**
21031
+ * Original (first-published) ID of the `upshift_vault` package. Move types
21032
+ * keep it across upgrades, so it names the vault's on-chain type. Overrides
21033
+ * the SDK's default for `network`; required until the SDK ships one.
21034
+ */
21035
+ originalPackageId?: string;
21036
+ /**
21037
+ * Object ID of the shared `upshift_vault::registry::Registry`. Overrides the
21038
+ * SDK's default for `network`; required until the SDK ships one.
21039
+ */
21040
+ registryId?: string;
21022
21041
  }
21023
21042
 
21024
21043
  /** Sui network a vault lives on; matches the backend's `sui_vault_metadata.network_name`. */
@@ -72,10 +72,29 @@ export interface IStellarConfig {
72
72
  */
73
73
  export interface ISuiConfig {
74
74
  /**
75
- * Override Sui RPC endpoint (e.g. a consumer's keyed provider URL).
76
- * Optional — omit to use the SDK's default endpoint for `network`.
75
+ * Override Sui gRPC endpoint (e.g. a consumer's keyed provider URL). It must
76
+ * serve gRPC-web, which the SDK uses so the same code runs in browsers. When
77
+ * set it becomes the primary, with the SDK's built-in public fullnode kept
78
+ * behind it as failover. Optional — omit to use the public fullnode.
77
79
  */
78
80
  rpcUrl?: string;
79
81
  /** Sui network; defaults to `'mainnet'` when omitted. */
80
82
  network?: ISuiNetwork;
83
+ /**
84
+ * Latest published ID of the `upshift_vault` Move package — the ID move calls
85
+ * target. Overrides the SDK's default for `network`; required until the SDK
86
+ * ships one. Long form: `0x` + 64 hex chars.
87
+ */
88
+ packageId?: string;
89
+ /**
90
+ * Original (first-published) ID of the `upshift_vault` package. Move types
91
+ * keep it across upgrades, so it names the vault's on-chain type. Overrides
92
+ * the SDK's default for `network`; required until the SDK ships one.
93
+ */
94
+ originalPackageId?: string;
95
+ /**
96
+ * Object ID of the shared `upshift_vault::registry::Registry`. Overrides the
97
+ * SDK's default for `network`; required until the SDK ships one.
98
+ */
99
+ registryId?: string;
81
100
  }
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@upshiftfinance/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/sdk.d.ts",
6
6
  "keywords": [
7
- "augustdigital",
7
+ "upshift",
8
8
  "sdk",
9
9
  "js",
10
10
  "institutional",
11
11
  "defi"
12
12
  ],
13
- "author": "August Digital",
13
+ "author": "Upshift",
14
14
  "license": "MIT",
15
- "description": "JS SDK powering the August Digital ecosystem.",
15
+ "description": "JS SDK powering the Upshift ecosystem.",
16
16
  "lint-staged": {
17
17
  "*": [
18
18
  "biome check --write --no-errors-on-unmatched --files-ignore-unknown=true"
@@ -31,6 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@coral-xyz/anchor": "^0.32.1",
34
+ "@mysten/sui": "^2.38.0",
34
35
  "@sentry/browser": "^8.0.0",
35
36
  "@sentry/node": "^8.0.0",
36
37
  "@solana/spl-token": "^0.4.14",
@@ -46,7 +47,7 @@
46
47
  },
47
48
  "devDependencies": {
48
49
  "@types/jest": "^30.0.0",
49
- "jest": "^30.4.2",
50
+ "jest": "^30.5.2",
50
51
  "ts-jest": "^29.1.0"
51
52
  },
52
53
  "peerDependencies": {
@@ -1,24 +0,0 @@
1
- import type { IEmberVault, IFetchEmberVaultsOptions } from './types';
2
- /**
3
- * Fetch Ember vaults from API.
4
- *
5
- * Results are cached for {@link EMBER_CACHE_TTL_MS} (keyed by the full request
6
- * URL, so different query options cache independently) and the request is
7
- * aborted after {@link EMBER_FETCH_TIMEOUT_MS}. Failures — including timeouts —
8
- * are never cached and resolve to `[]`, preserving the long-standing
9
- * fail-tolerant contract of this getter.
10
- */
11
- export declare function getEmberVaults(options?: IFetchEmberVaultsOptions): Promise<IEmberVault[]>;
12
- /**
13
- * Fetch the latest Ember TVL (in whole units, i.e. `tvlE9 / 1e9`).
14
- *
15
- * Shares the timeout and cache of {@link getEmberVaults} via
16
- * {@link fetchEmberArray}: the TVL history payload is cached for
17
- * {@link EMBER_CACHE_TTL_MS} per `limit`, and a hung request is aborted after
18
- * {@link EMBER_FETCH_TIMEOUT_MS}. Failures — including timeouts — are never
19
- * cached and resolve to `0`.
20
- *
21
- * @param limit - Number of history rows to request; only the newest is read.
22
- * @returns The latest TVL, or `0` when unavailable.
23
- */
24
- export declare function getEmberTVL(limit?: number): Promise<number>;