@naviprotocol/wallet-client 1.4.9 → 2.0.0-beta.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.
- package/README.md +62 -9
- package/dist/client.d.ts +9 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/index.esm.js +295 -298
- package/dist/index.esm.js.map +1 -1
- package/dist/modules/balanceModule/index.d.ts +6 -5
- package/dist/modules/balanceModule/index.d.ts.map +1 -1
- package/dist/modules/balanceModule/portfolio.d.ts +1 -1
- package/dist/modules/balanceModule/portfolio.d.ts.map +1 -1
- package/dist/modules/haedalModule/index.d.ts +5 -5
- package/dist/modules/haedalModule/index.d.ts.map +1 -1
- package/dist/modules/lendingModule/index.d.ts +18 -9
- package/dist/modules/lendingModule/index.d.ts.map +1 -1
- package/dist/modules/lendingModule/protocols/suilend.d.ts +7 -2
- package/dist/modules/lendingModule/protocols/suilend.d.ts.map +1 -1
- package/dist/modules/swapModule/index.d.ts +3 -3
- package/dist/modules/swapModule/index.d.ts.map +1 -1
- package/dist/modules/voloModule/index.d.ts +5 -5
- package/dist/modules/voloModule/index.d.ts.map +1 -1
- package/dist/signer.d.ts +2 -4
- package/dist/signer.d.ts.map +1 -1
- package/dist/suilend-Df4FukWs.js +80 -0
- package/dist/suilend-Df4FukWs.js.map +1 -0
- package/dist/transaction-result.d.ts +7 -0
- package/dist/transaction-result.d.ts.map +1 -0
- package/dist/transport.d.ts +3 -3
- package/dist/transport.d.ts.map +1 -1
- package/dist/types.d.ts +54 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +35 -11
- package/dist/index.cjs.js +0 -2
- 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
|
-
##
|
|
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
|
-
|
|
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
|
-
|
|
82
|
-
|
|
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 {
|
|
1
|
+
import { SuiJsonRpcClient, SuiJsonRpcClientOptions } from '@mysten/sui/jsonRpc';
|
|
2
2
|
import { Signer } from '@mysten/sui/cryptography';
|
|
3
3
|
import { Emitter } from 'mitt';
|
|
4
4
|
import { Module, ModuleConfig } from './modules/module';
|
|
5
5
|
import { modules, ModuleName, ModuleEvents } from './modules';
|
|
6
6
|
import { Transaction } from '@mysten/sui/transactions';
|
|
7
|
-
import { DryRunOptions } from './types';
|
|
7
|
+
import { DryRunOptions, NaviTransactionExecutionOptions, NaviWalletTransactionResult } from './types';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Extracts the configuration type from a module
|
|
@@ -25,7 +25,9 @@ export type WalletClientOptions = {
|
|
|
25
25
|
/** Optional module-specific configurations */
|
|
26
26
|
configs?: Partial<UserConfigs>;
|
|
27
27
|
/** Optional Sui client configuration */
|
|
28
|
-
client?:
|
|
28
|
+
client?: Partial<SuiJsonRpcClientOptions> & {
|
|
29
|
+
url?: string;
|
|
30
|
+
};
|
|
29
31
|
};
|
|
30
32
|
/**
|
|
31
33
|
* Main wallet client class that provides unified access to blockchain operations
|
|
@@ -44,7 +46,9 @@ export declare class WalletClient {
|
|
|
44
46
|
/** Event emitter for module events */
|
|
45
47
|
readonly events: Emitter<ModuleEvents>;
|
|
46
48
|
/** The Sui client instance */
|
|
47
|
-
readonly client:
|
|
49
|
+
readonly client: SuiJsonRpcClient;
|
|
50
|
+
/** URL used by the default JSON-RPC client, when available. */
|
|
51
|
+
readonly clientUrl?: string;
|
|
48
52
|
get lending(): import('./modules/lendingModule').LendingModule;
|
|
49
53
|
get balance(): import('./modules/balanceModule').BalanceModule;
|
|
50
54
|
get volo(): import('./modules/voloModule').VoloModule;
|
|
@@ -62,7 +66,7 @@ export declare class WalletClient {
|
|
|
62
66
|
*/
|
|
63
67
|
signExecuteTransaction(options: {
|
|
64
68
|
transaction: Uint8Array | Transaction;
|
|
65
|
-
} &
|
|
69
|
+
} & NaviTransactionExecutionOptions & Partial<DryRunOptions>): Promise<NaviWalletTransactionResult<boolean>>;
|
|
66
70
|
/**
|
|
67
71
|
* Gets the wallet address from the signer's public key
|
|
68
72
|
* @returns The wallet address as a string
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,gBAAgB,EAEhB,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAA;AAC5B,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,EACL,aAAa,EACb,+BAA+B,EAC/B,2BAA2B,EAC5B,MAAM,SAAS,CAAA;AAGhB;;GAEG;AACH,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,OAAO,EAAE,GAAG,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