@naviprotocol/wallet-client 1.4.11 → 2.0.0-beta.1

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 (34) hide show
  1. package/README.md +62 -9
  2. package/dist/client.d.ts +18 -6
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/index.esm.js +612 -512
  5. package/dist/index.esm.js.map +1 -1
  6. package/dist/modules/balanceModule/index.d.ts +6 -5
  7. package/dist/modules/balanceModule/index.d.ts.map +1 -1
  8. package/dist/modules/balanceModule/portfolio.d.ts +1 -1
  9. package/dist/modules/balanceModule/portfolio.d.ts.map +1 -1
  10. package/dist/modules/haedalModule/index.d.ts +14 -12
  11. package/dist/modules/haedalModule/index.d.ts.map +1 -1
  12. package/dist/modules/lendingModule/index.d.ts +24 -10
  13. package/dist/modules/lendingModule/index.d.ts.map +1 -1
  14. package/dist/modules/lendingModule/migrate.d.ts.map +1 -1
  15. package/dist/modules/lendingModule/protocols/navi.d.ts.map +1 -1
  16. package/dist/modules/lendingModule/protocols/suilend.d.ts +7 -2
  17. package/dist/modules/lendingModule/protocols/suilend.d.ts.map +1 -1
  18. package/dist/modules/swapModule/index.d.ts +7 -3
  19. package/dist/modules/swapModule/index.d.ts.map +1 -1
  20. package/dist/modules/voloModule/index.d.ts +14 -13
  21. package/dist/modules/voloModule/index.d.ts.map +1 -1
  22. package/dist/signer.d.ts +2 -4
  23. package/dist/signer.d.ts.map +1 -1
  24. package/dist/suilend-CWugUjwd.js +85 -0
  25. package/dist/suilend-CWugUjwd.js.map +1 -0
  26. package/dist/transaction-result.d.ts +7 -0
  27. package/dist/transaction-result.d.ts.map +1 -0
  28. package/dist/transport.d.ts +3 -3
  29. package/dist/transport.d.ts.map +1 -1
  30. package/dist/types.d.ts +57 -0
  31. package/dist/types.d.ts.map +1 -1
  32. package/package.json +36 -12
  33. package/dist/index.cjs.js +0 -2
  34. package/dist/index.cjs.js.map +0 -1
package/README.md CHANGED
@@ -9,7 +9,6 @@ NAVI Wallet Client is a comprehensive wallet client SDK designed for the Sui blo
9
9
 
10
10
  For SDK documentation visit http://sdk.naviprotocol.io/wallet-client
11
11
 
12
-
13
12
  ## Core Features
14
13
 
15
14
  - 🔐 **Transaction Signing**: Complete transaction signing and execution functionality
@@ -23,27 +22,33 @@ For SDK documentation visit http://sdk.naviprotocol.io/wallet-client
23
22
  ## Supported Modules
24
23
 
25
24
  ### [Balance Module](./wallet-client/balance)
25
+
26
26
  Provides comprehensive wallet balance management functionality, including token tracking, portfolio management, token transfers, and automatic balance updates.
27
27
 
28
28
  **Key Features:**
29
+
29
30
  - Real-time balance tracking
30
31
  - Token transfers
31
32
  - Object transfers
32
33
  - Automatic balance updates
33
34
 
34
35
  ### [Swap Module](./wallet-client/swap)
36
+
35
37
  Provides DEX token swapping functionality, integrated with Astros aggregator to find optimal swap paths and execute trades across multiple decentralized exchanges.
36
38
 
37
39
  **Key Features:**
40
+
38
41
  - Token swapping
39
42
  - Aggregator integration
40
43
  - Slippage protection
41
44
  - Multi-DEX support
42
45
 
43
46
  ### [Lending Module](./wallet-client/lending)
47
+
44
48
  Provides comprehensive lending protocol functionality, including deposits, withdrawals, borrowing, repayments, liquidations, reward claiming, and oracle price updates.
45
49
 
46
50
  **Key Features:**
51
+
47
52
  - Deposits and withdrawals
48
53
  - Borrowing and repayments
49
54
  - Liquidation functionality
@@ -51,17 +56,21 @@ Provides comprehensive lending protocol functionality, including deposits, withd
51
56
  - Oracle updates
52
57
 
53
58
  ### [Haedal Module](./wallet-client/haedal)
59
+
54
60
  Provides Haedal protocol staking and unstaking functionality, allowing users to stake SUI to receive haSUI and obtain APY statistics.
55
61
 
56
62
  **Key Features:**
63
+
57
64
  - SUI staking
58
65
  - haSUI unstaking
59
66
  - APY queries
60
67
 
61
68
  ### [Volo Module](./wallet-client/volo)
69
+
62
70
  Provides Volo staking protocol functionality, allowing users to stake SUI tokens and receive vSUI (volo SUI) tokens for liquid staking.
63
71
 
64
72
  **Key Features:**
73
+
65
74
  - SUI staking
66
75
  - vSUI unstaking
67
76
  - Statistics queries
@@ -73,13 +82,57 @@ Provides Volo staking protocol functionality, allowing users to stake SUI tokens
73
82
  npm install @naviprotocol/wallet-client
74
83
  ```
75
84
 
76
- ## Quick Start
85
+ ## Sui SDK v2 Notes
86
+
87
+ `@naviprotocol/wallet-client@2` defaults to the Sui SDK v2 main path. The
88
+ Suilend adapter is an optional peer dependency and is loaded lazily when the
89
+ lending protocol registry is initialized. This preserves the previous
90
+ cross-protocol migration behavior without adding the Suilend stack to the root
91
+ SDK import path. Install the optional peers only when you use Suilend migration
92
+ paths:
93
+
94
+ ```bash
95
+ npm install @suilend/sdk@^3.0.4 @suilend/sui-fe@^3.0.7 @mysten/bcs@2.0.1 @pythnetwork/pyth-sui-js@2.2.0
96
+ ```
77
97
 
78
98
  ```ts
79
- import { WalletClient } from '@naviprotocol/wallet-client'
99
+ const walletClient = new WalletClient({
100
+ signer,
101
+ client: { url: getJsonRpcFullnodeUrl('mainnet') }
102
+ })
103
+ ```
104
+
105
+ If an app does not use Suilend, it can explicitly opt out:
106
+
107
+ ```ts
108
+ const walletClient = new WalletClient({
109
+ signer,
110
+ client: { url: getJsonRpcFullnodeUrl('mainnet') },
111
+ configs: {
112
+ lending: {
113
+ enableSuilend: false
114
+ }
115
+ }
116
+ })
117
+ ```
118
+
119
+ For custom Sui environments, pass `configs.lending.suilendGrpcUrl` or
120
+ `configs.lending.suilendGrpcClient` when Suilend needs a dedicated gRPC
121
+ endpoint.
80
122
 
81
- // Create wallet client
82
- const walletClient = new WalletClient()
123
+ ## Quick Start
124
+
125
+ ```ts
126
+ import { getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc'
127
+ import { WalletClient, WatchSigner } from '@naviprotocol/wallet-client'
128
+
129
+ const address = '0x0000000000000000000000000000000000000000000000000000000000000001'
130
+ const walletClient = new WalletClient({
131
+ signer: new WatchSigner(address),
132
+ client: {
133
+ url: getJsonRpcFullnodeUrl('mainnet')
134
+ }
135
+ })
83
136
 
84
137
  // Use balance module
85
138
  const portfolio = walletClient.balance.portfolio
@@ -90,7 +143,8 @@ const result = await walletClient.swap.swap(
90
143
  '0x2::sui::SUI',
91
144
  '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN',
92
145
  1000000000,
93
- 0.01
146
+ 0.01,
147
+ { dryRun: true }
94
148
  )
95
149
 
96
150
  // Use lending module
@@ -99,11 +153,11 @@ const pools = await walletClient.lending.getPools()
99
153
 
100
154
  // Use Haedal module
101
155
  const apy = await walletClient.haedal.getApy()
102
- const stakeResult = await walletClient.haedal.stake(1000000000)
156
+ const stakeResult = await walletClient.haedal.stake(1000000000, { dryRun: true })
103
157
 
104
158
  // Use Volo module
105
159
  const stats = await walletClient.volo.getStats()
106
- const voloStakeResult = await walletClient.volo.stake(1000000000)
160
+ const voloStakeResult = await walletClient.volo.stake(1000000000, { dryRun: true })
107
161
  ```
108
162
 
109
163
  ## Event Listening
@@ -137,4 +191,3 @@ walletClient.events.on('volo:stake-success', (data) => {
137
191
  ## Support
138
192
 
139
193
  - Issue reporting: [GitHub Issues](https://github.com/naviprotocol/naviprotocol-monorepo/issues)
140
-
package/dist/client.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { SuiClient, SuiClientOptions, ExecuteTransactionBlockParams } from '@mysten/sui/client';
2
1
  import { Signer } from '@mysten/sui/cryptography';
3
2
  import { Emitter } from 'mitt';
4
3
  import { Module, ModuleConfig } from './modules/module';
5
4
  import { modules, ModuleName, ModuleEvents } from './modules';
6
5
  import { Transaction } from '@mysten/sui/transactions';
7
- import { DryRunOptions } from './types';
6
+ import { DryRunOptions, NaviTransactionExecutionOptions, NaviWalletTransactionResult } from './types';
7
+ import { NaviCoreClient, NaviJsonRpcCompatClient, NaviSdkServiceOptions, NaviSuiClientBundle, NaviSuiClientOptions, NaviSuiLegacyJsonRpcOptions, NaviSuiNetwork } from '@naviprotocol/lending';
8
8
 
9
9
  /**
10
10
  * Extracts the configuration type from a module
@@ -24,8 +24,16 @@ export type WalletClientOptions = {
24
24
  signer: Signer;
25
25
  /** Optional module-specific configurations */
26
26
  configs?: Partial<UserConfigs>;
27
- /** Optional Sui client configuration */
28
- client?: SuiClientOptions;
27
+ /** Sui v2 client configuration. Release paths must provide `network + grpc`. */
28
+ client: NaviSuiClientOptions | WalletLegacyJsonRpcClientOptions;
29
+ };
30
+ export type WalletLegacyJsonRpcClientOptions = {
31
+ network?: NaviSuiNetwork;
32
+ /**
33
+ * @deprecated JSON-RPC is a short-lived compatibility transport. New paths must use `grpc`.
34
+ */
35
+ legacyJsonRpc: NaviSuiLegacyJsonRpcOptions;
36
+ services?: NaviSdkServiceOptions;
29
37
  };
30
38
  /**
31
39
  * Main wallet client class that provides unified access to blockchain operations
@@ -44,7 +52,11 @@ export declare class WalletClient {
44
52
  /** Event emitter for module events */
45
53
  readonly events: Emitter<ModuleEvents>;
46
54
  /** The Sui client instance */
47
- readonly client: SuiClient;
55
+ readonly client: NaviCoreClient & Partial<NaviJsonRpcCompatClient>;
56
+ /** Normalized transport bundle for modules that need transport-specific clients. */
57
+ readonly clientBundle: NaviSuiClientBundle;
58
+ /** URL used by the default JSON-RPC client, when available. */
59
+ readonly clientUrl?: string;
48
60
  get lending(): import('./modules/lendingModule').LendingModule;
49
61
  get balance(): import('./modules/balanceModule').BalanceModule;
50
62
  get volo(): import('./modules/voloModule').VoloModule;
@@ -62,7 +74,7 @@ export declare class WalletClient {
62
74
  */
63
75
  signExecuteTransaction(options: {
64
76
  transaction: Uint8Array | Transaction;
65
- } & Omit<ExecuteTransactionBlockParams, 'transactionBlock' | 'signature'> & Partial<DryRunOptions>): Promise<import('@mysten/sui/dist/cjs/client').DryRunTransactionBlockResponse | import('@mysten/sui/dist/cjs/client').SuiTransactionBlockResponse>;
77
+ } & NaviTransactionExecutionOptions & Partial<DryRunOptions>): Promise<NaviWalletTransactionResult<boolean>>;
66
78
  /**
67
79
  * Gets the wallet address from the signer's public key
68
80
  * @returns The wallet address as a string
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,6BAA6B,EAAE,MAAM,oBAAoB,CAAA;AACpG,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAa,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEpC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAGvC;;GAEG;AACH,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,OAAO,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,KAAK,CAAA;AAEpF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;KACvB,CAAC,IAAI,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACrE,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,8CAA8C;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IAC9B,wCAAwC;IACxC,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAC1B,CAAA;AASD;;;;;;GAMG;AACH,qBAAa,YAAY;IACvB,kDAAkD;IAClD,SAAgB,MAAM,EAAE,MAAM,CAAA;IAE9B,sDAAsD;IACtD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAElC,0CAA0C;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