@zebec-network/admin-sdk 1.0.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/LICENSE +21 -0
- package/README.md +730 -0
- package/dist/artifacts/abi/index.d.ts +161 -0
- package/dist/artifacts/abi/index.js +7 -0
- package/dist/artifacts/abi/token.json +350 -0
- package/dist/artifacts/abi/weth.json +153 -0
- package/dist/artifacts/abi/zebecCard.json +1229 -0
- package/dist/artifacts/index.d.ts +11 -0
- package/dist/artifacts/index.js +11 -0
- package/dist/artifacts/typechain-types/OdysseyZebecCard.d.ts +559 -0
- package/dist/artifacts/typechain-types/OdysseyZebecCard.js +1 -0
- package/dist/artifacts/typechain-types/Token.d.ts +149 -0
- package/dist/artifacts/typechain-types/Token.js +1 -0
- package/dist/artifacts/typechain-types/Weth.d.ts +179 -0
- package/dist/artifacts/typechain-types/Weth.js +1 -0
- package/dist/artifacts/typechain-types/ZebecCard.d.ts +723 -0
- package/dist/artifacts/typechain-types/ZebecCard.js +1 -0
- package/dist/artifacts/typechain-types/common.d.ts +50 -0
- package/dist/artifacts/typechain-types/common.js +1 -0
- package/dist/artifacts/typechain-types/factories/OdysseyZebecCard__factory.d.ts +735 -0
- package/dist/artifacts/typechain-types/factories/OdysseyZebecCard__factory.js +959 -0
- package/dist/artifacts/typechain-types/factories/Token__factory.d.ts +280 -0
- package/dist/artifacts/typechain-types/factories/Token__factory.js +374 -0
- package/dist/artifacts/typechain-types/factories/Weth__factory.d.ts +219 -0
- package/dist/artifacts/typechain-types/factories/Weth__factory.js +292 -0
- package/dist/artifacts/typechain-types/factories/ZebecCard__factory.d.ts +966 -0
- package/dist/artifacts/typechain-types/factories/ZebecCard__factory.js +1253 -0
- package/dist/artifacts/typechain-types/factories/index.d.ts +4 -0
- package/dist/artifacts/typechain-types/factories/index.js +7 -0
- package/dist/artifacts/typechain-types/index.d.ts +9 -0
- package/dist/artifacts/typechain-types/index.js +8 -0
- package/dist/artifacts/zebec_instant_card.d.ts +3683 -0
- package/dist/artifacts/zebec_instant_card.js +1 -0
- package/dist/artifacts/zebec_instant_card.json +2801 -0
- package/dist/artifacts/zebec_proxy_stream.d.ts +1933 -0
- package/dist/artifacts/zebec_proxy_stream.js +1 -0
- package/dist/artifacts/zebec_proxy_stream.json +1497 -0
- package/dist/artifacts/zebec_stake_v1.d.ts +1679 -0
- package/dist/artifacts/zebec_stake_v1.js +1 -0
- package/dist/artifacts/zebec_stake_v1.json +1255 -0
- package/dist/artifacts/zebec_stream.d.ts +1481 -0
- package/dist/artifacts/zebec_stream.js +1 -0
- package/dist/artifacts/zebec_stream.json +1243 -0
- package/dist/constants.d.ts +32 -0
- package/dist/constants.js +115 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/pda.d.ts +23 -0
- package/dist/pda.js +125 -0
- package/dist/services/evmCardService.d.ts +189 -0
- package/dist/services/evmCardService.js +322 -0
- package/dist/services/index.d.ts +6 -0
- package/dist/services/index.js +6 -0
- package/dist/services/proxyStreamService.d.ts +72 -0
- package/dist/services/proxyStreamService.js +302 -0
- package/dist/services/solanaCardV2Service.d.ts +50 -0
- package/dist/services/solanaCardV2Service.js +717 -0
- package/dist/services/stakingService.d.ts +39 -0
- package/dist/services/stakingService.js +265 -0
- package/dist/services/streamServices.d.ts +50 -0
- package/dist/services/streamServices.js +322 -0
- package/dist/services/suiCardService.d.ts +91 -0
- package/dist/services/suiCardService.js +487 -0
- package/dist/types.d.ts +433 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +39 -0
- package/package.json +57 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
import type { Address, BN } from "@coral-xyz/anchor";
|
|
2
|
+
import type { Transaction } from "@mysten/sui/transactions";
|
|
3
|
+
import type { PublicKey } from "@solana/web3.js";
|
|
4
|
+
export type RpcNetwork = "mainnet-beta" | "devnet";
|
|
5
|
+
export type Numeric = string | number;
|
|
6
|
+
export type StreamConfigInfo = {
|
|
7
|
+
address: PublicKey;
|
|
8
|
+
admin: PublicKey;
|
|
9
|
+
configName: string;
|
|
10
|
+
withdrawerAccount: PublicKey;
|
|
11
|
+
whitelistedTokens: PublicKey[];
|
|
12
|
+
platformFee: number;
|
|
13
|
+
baseFee: number;
|
|
14
|
+
frequencies: number[];
|
|
15
|
+
feeTiers: StreamFeeTier[];
|
|
16
|
+
feeVault: PublicKey;
|
|
17
|
+
};
|
|
18
|
+
export type TokenMetadata = {
|
|
19
|
+
mint: PublicKey;
|
|
20
|
+
decimals: number;
|
|
21
|
+
freezeAuthority: PublicKey | null;
|
|
22
|
+
supply: string;
|
|
23
|
+
isInitialized: boolean;
|
|
24
|
+
mintAuthority: PublicKey | null;
|
|
25
|
+
metadata: {
|
|
26
|
+
address: PublicKey;
|
|
27
|
+
updateAuthority: PublicKey;
|
|
28
|
+
name: string;
|
|
29
|
+
symbol: string;
|
|
30
|
+
uri: string;
|
|
31
|
+
} | null;
|
|
32
|
+
};
|
|
33
|
+
export type InitializeStreamConfigParams = {
|
|
34
|
+
admin?: Address;
|
|
35
|
+
config: {
|
|
36
|
+
baseFeePercent: Numeric;
|
|
37
|
+
frequencies: number[];
|
|
38
|
+
platformFeePercent: Numeric;
|
|
39
|
+
withdrawAccount: Address;
|
|
40
|
+
feeTiers: StreamFeeTier[];
|
|
41
|
+
feeVault: Address;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export type StreamFeeTier = {
|
|
45
|
+
minThreshold: Numeric;
|
|
46
|
+
maxThreshold: Numeric;
|
|
47
|
+
feeRateInPercent: Numeric;
|
|
48
|
+
};
|
|
49
|
+
export type UpdateStreamConfigParams = {
|
|
50
|
+
admin?: Address;
|
|
51
|
+
config: {
|
|
52
|
+
baseFeePercent: Numeric;
|
|
53
|
+
frequencies: number[];
|
|
54
|
+
platformFeePercent: Numeric;
|
|
55
|
+
withdrawAccount: Address;
|
|
56
|
+
feeTiers: StreamFeeTier[];
|
|
57
|
+
feeVault: Address;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export type WhiteListTokensParams = {
|
|
61
|
+
admin: Address;
|
|
62
|
+
tokens: Address[];
|
|
63
|
+
};
|
|
64
|
+
export type StreamMetadataInfo = {
|
|
65
|
+
address: PublicKey;
|
|
66
|
+
parties: {
|
|
67
|
+
sender: PublicKey;
|
|
68
|
+
receiver: PublicKey;
|
|
69
|
+
};
|
|
70
|
+
financials: {
|
|
71
|
+
streamToken: PublicKey;
|
|
72
|
+
cliffPercentage: number;
|
|
73
|
+
depositedAmount: string;
|
|
74
|
+
withdrawnAmount: string;
|
|
75
|
+
};
|
|
76
|
+
schedule: {
|
|
77
|
+
startTime: number;
|
|
78
|
+
endTime: number;
|
|
79
|
+
lastWithdrawTime: number;
|
|
80
|
+
frequency: number;
|
|
81
|
+
duration: number;
|
|
82
|
+
pausedTimestamp: number;
|
|
83
|
+
pausedInterval: number;
|
|
84
|
+
canceledTimestamp: number;
|
|
85
|
+
};
|
|
86
|
+
permissions: {
|
|
87
|
+
cancelableBySender: boolean;
|
|
88
|
+
cancelableByRecipient: boolean;
|
|
89
|
+
automaticWithdrawal: boolean;
|
|
90
|
+
transferableBySender: boolean;
|
|
91
|
+
transferableByRecipient: boolean;
|
|
92
|
+
canTopup: boolean;
|
|
93
|
+
isPausable: boolean;
|
|
94
|
+
rateUpdatable: boolean;
|
|
95
|
+
};
|
|
96
|
+
streamName: string;
|
|
97
|
+
};
|
|
98
|
+
export type ProxyConfigInfo = {
|
|
99
|
+
address: PublicKey;
|
|
100
|
+
fee: string;
|
|
101
|
+
minAmount: string;
|
|
102
|
+
proxyAdmin: PublicKey;
|
|
103
|
+
mintableTokens: PublicKey[];
|
|
104
|
+
feeVault: PublicKey;
|
|
105
|
+
emergencyPaused: boolean;
|
|
106
|
+
chainId: string;
|
|
107
|
+
};
|
|
108
|
+
export type InitLockupInstructionData = {
|
|
109
|
+
rewardSchemes: ParsedRewardScheme[];
|
|
110
|
+
fee: BN;
|
|
111
|
+
feeVault: PublicKey;
|
|
112
|
+
name: string;
|
|
113
|
+
minimumStake: BN;
|
|
114
|
+
};
|
|
115
|
+
export type UpdateLockupInstructionData = {
|
|
116
|
+
rewardSchemes: ParsedRewardScheme[];
|
|
117
|
+
fee: BN;
|
|
118
|
+
feeVault: PublicKey;
|
|
119
|
+
minimumStake: BN;
|
|
120
|
+
};
|
|
121
|
+
export type DeletePartnerCustomFeesInstructionData = {
|
|
122
|
+
tokenList: PublicKey[];
|
|
123
|
+
partnershipName: string;
|
|
124
|
+
};
|
|
125
|
+
export type ParsedRewardScheme = {
|
|
126
|
+
duration: BN;
|
|
127
|
+
reward: BN;
|
|
128
|
+
};
|
|
129
|
+
export type RewardScheme = {
|
|
130
|
+
duration: number;
|
|
131
|
+
rewardRate: Numeric;
|
|
132
|
+
};
|
|
133
|
+
export type LockupInfo = {
|
|
134
|
+
address: Address;
|
|
135
|
+
feeInfo: {
|
|
136
|
+
fee: string;
|
|
137
|
+
feeVault: Address;
|
|
138
|
+
};
|
|
139
|
+
rewardToken: {
|
|
140
|
+
tokenAddress: Address;
|
|
141
|
+
};
|
|
142
|
+
stakeToken: {
|
|
143
|
+
tokenAddress: Address;
|
|
144
|
+
totalStaked: string;
|
|
145
|
+
};
|
|
146
|
+
stakeInfo: {
|
|
147
|
+
name: string;
|
|
148
|
+
creator: Address;
|
|
149
|
+
rewardSchemes: RewardScheme[];
|
|
150
|
+
minimumStake: string;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
export type StakeInfo = {
|
|
154
|
+
address: Address;
|
|
155
|
+
nonce: bigint;
|
|
156
|
+
createdTime: number;
|
|
157
|
+
stakedAmount: string;
|
|
158
|
+
rewardAmount: string;
|
|
159
|
+
stakeClaimed: boolean;
|
|
160
|
+
lockPeriod: number;
|
|
161
|
+
staker: string;
|
|
162
|
+
lockup: string;
|
|
163
|
+
};
|
|
164
|
+
export type InitCardConfigInstructionData = {
|
|
165
|
+
cardVault: PublicKey;
|
|
166
|
+
revenueVault: PublicKey;
|
|
167
|
+
commissionVault: PublicKey;
|
|
168
|
+
revenueFee: BN;
|
|
169
|
+
nativeFee: BN;
|
|
170
|
+
carbonFee: BN;
|
|
171
|
+
nonNativeFee: BN;
|
|
172
|
+
maxCardAmount: BN;
|
|
173
|
+
minCardAmount: BN;
|
|
174
|
+
dailyCardPurchaseLimit: BN;
|
|
175
|
+
feeTiers: ParsedCardFeeTier[];
|
|
176
|
+
};
|
|
177
|
+
export type SetCardConfigInstructionData = {
|
|
178
|
+
newZicOwner: PublicKey;
|
|
179
|
+
cardVault: PublicKey;
|
|
180
|
+
revenueVault: PublicKey;
|
|
181
|
+
commissionVault: PublicKey;
|
|
182
|
+
revenueFee: BN;
|
|
183
|
+
carbonFee: BN;
|
|
184
|
+
nativeFee: BN;
|
|
185
|
+
nonNativeFee: BN;
|
|
186
|
+
maxCardAmount: BN;
|
|
187
|
+
minCardAmount: BN;
|
|
188
|
+
dailyCardPurchaseLimit: BN;
|
|
189
|
+
feeTiers: ParsedCardFeeTier[];
|
|
190
|
+
};
|
|
191
|
+
export type InitPartnerCardConfigInstructionData = {
|
|
192
|
+
cardVault: PublicKey;
|
|
193
|
+
revenueVault: PublicKey;
|
|
194
|
+
carbonFee: BN;
|
|
195
|
+
maxCardAmount: BN;
|
|
196
|
+
minCardAmount: BN;
|
|
197
|
+
dailyCardPurchaseLimit: BN;
|
|
198
|
+
feeTiers: ParsedCardFeeTier[];
|
|
199
|
+
partnershipName: string;
|
|
200
|
+
};
|
|
201
|
+
export type SetPartnerCardConfigInstructionData = {
|
|
202
|
+
newZicOwner: PublicKey;
|
|
203
|
+
cardVault: PublicKey;
|
|
204
|
+
revenueVault: PublicKey;
|
|
205
|
+
carbonFee: BN;
|
|
206
|
+
maxCardAmount: BN;
|
|
207
|
+
minCardAmount: BN;
|
|
208
|
+
dailyCardPurchaseLimit: BN;
|
|
209
|
+
feeTiers: ParsedCardFeeTier[];
|
|
210
|
+
partnershipName: string;
|
|
211
|
+
};
|
|
212
|
+
export type ParsedCardFeeTier = {
|
|
213
|
+
minAmount: BN;
|
|
214
|
+
maxAmount: BN;
|
|
215
|
+
fee: BN;
|
|
216
|
+
};
|
|
217
|
+
export type ParsedCardConfigInfo = {
|
|
218
|
+
index: BN;
|
|
219
|
+
zicOwner: PublicKey;
|
|
220
|
+
nativeFee: BN;
|
|
221
|
+
nonNativeFee: BN;
|
|
222
|
+
revenueFee: BN;
|
|
223
|
+
usdcMint: PublicKey;
|
|
224
|
+
revenueVault: PublicKey;
|
|
225
|
+
commissionVault: PublicKey;
|
|
226
|
+
cardVault: PublicKey;
|
|
227
|
+
totalBought: BN;
|
|
228
|
+
dailyCardBuyLimit: BN;
|
|
229
|
+
providerConfig: ParsedProviderConfig;
|
|
230
|
+
};
|
|
231
|
+
export type ParsedProviderConfig = {
|
|
232
|
+
minCardAmount: BN;
|
|
233
|
+
maxCardAmount: BN;
|
|
234
|
+
feeTiers: {
|
|
235
|
+
tiers: ParsedCardFeeTier[];
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
export type ParsedTokenFeeRecord = {
|
|
239
|
+
tokenAddress: PublicKey;
|
|
240
|
+
fee: BN;
|
|
241
|
+
};
|
|
242
|
+
export type CardFeeTier = {
|
|
243
|
+
minAmount: Numeric;
|
|
244
|
+
maxAmount: Numeric;
|
|
245
|
+
feePercent: Numeric;
|
|
246
|
+
};
|
|
247
|
+
export type InitCardConfigParams = {
|
|
248
|
+
zicOwnerAddress?: Address;
|
|
249
|
+
cardVaultAddress: Address;
|
|
250
|
+
revenueVaultAddress: Address;
|
|
251
|
+
commissionVaultAddress: Address;
|
|
252
|
+
usdcAddress: Address;
|
|
253
|
+
revenueFeePercent: Numeric;
|
|
254
|
+
nativeFeePercent: Numeric;
|
|
255
|
+
nonNativeFeePercent: Numeric;
|
|
256
|
+
carbonFeePercent: Numeric;
|
|
257
|
+
minCardAmount: Numeric;
|
|
258
|
+
maxCardAmount: Numeric;
|
|
259
|
+
dailyCardPurchaseLimit: Numeric;
|
|
260
|
+
feeTiers: CardFeeTier[];
|
|
261
|
+
};
|
|
262
|
+
export type InitPartnerCardConfigParams = {
|
|
263
|
+
zicOwnerAddress?: Address;
|
|
264
|
+
cardVaultAddress: Address;
|
|
265
|
+
revenueVaultAddress: Address;
|
|
266
|
+
usdcAddress: Address;
|
|
267
|
+
carbonFeePercent: Numeric;
|
|
268
|
+
minCardAmount: Numeric;
|
|
269
|
+
maxCardAmount: Numeric;
|
|
270
|
+
dailyCardPurchaseLimit: Numeric;
|
|
271
|
+
feeTiers: CardFeeTier[];
|
|
272
|
+
};
|
|
273
|
+
export type SetCardConfigParams = {
|
|
274
|
+
zicOwnerAddress?: Address;
|
|
275
|
+
newZicOwnerAddress: Address;
|
|
276
|
+
cardVaultAddress: Address;
|
|
277
|
+
revenueVaultAddress: Address;
|
|
278
|
+
commissionVaultAddress: Address;
|
|
279
|
+
revenueFeePercent: Numeric;
|
|
280
|
+
nativeFeePercent: Numeric;
|
|
281
|
+
nonNativeFeePercent: Numeric;
|
|
282
|
+
carbonFeePercent: Numeric;
|
|
283
|
+
minCardAmount: Numeric;
|
|
284
|
+
maxCardAmount: Numeric;
|
|
285
|
+
dailyCardPurchaseLimit: Numeric;
|
|
286
|
+
feeTiers: CardFeeTier[];
|
|
287
|
+
};
|
|
288
|
+
export type SetPartnerCardConfigParams = {
|
|
289
|
+
zicOwnerAddress?: Address;
|
|
290
|
+
newZicOwnerAddress: Address;
|
|
291
|
+
cardVaultAddress: Address;
|
|
292
|
+
revenueVaultAddress: Address;
|
|
293
|
+
carbonFeePercent: Numeric;
|
|
294
|
+
minCardAmount: Numeric;
|
|
295
|
+
maxCardAmount: Numeric;
|
|
296
|
+
dailyCardPurchaseLimit: Numeric;
|
|
297
|
+
feeTiers: CardFeeTier[];
|
|
298
|
+
};
|
|
299
|
+
export type SetPartnerCustomFeesParams = {
|
|
300
|
+
zicOwnerAddress?: Address;
|
|
301
|
+
tokenFeeList: TokenFeeRecord[];
|
|
302
|
+
};
|
|
303
|
+
export type DeletePartnerCustomFeesParams = {
|
|
304
|
+
zicOwnerAddress?: Address;
|
|
305
|
+
tokenAddressList: Address[];
|
|
306
|
+
partnershipName: string;
|
|
307
|
+
};
|
|
308
|
+
export type SetCustomFeesParams = {
|
|
309
|
+
zicOwnerAddress?: Address;
|
|
310
|
+
tokenFeeList: TokenFeeRecord[];
|
|
311
|
+
};
|
|
312
|
+
export type TokenFeeRecord = {
|
|
313
|
+
tokenAddress: Address;
|
|
314
|
+
fee: Numeric;
|
|
315
|
+
};
|
|
316
|
+
export type DeleteCustomFeesParams = {
|
|
317
|
+
zicOwnerAddress?: Address;
|
|
318
|
+
tokenAddressList: Address[];
|
|
319
|
+
};
|
|
320
|
+
export type CardPurchaseInfo = {
|
|
321
|
+
address: Address;
|
|
322
|
+
index: bigint;
|
|
323
|
+
buyerAddress: Address;
|
|
324
|
+
amount: Numeric;
|
|
325
|
+
purchaseAt: number;
|
|
326
|
+
};
|
|
327
|
+
export type UserPurchaseRecordInfo = {
|
|
328
|
+
address: Address;
|
|
329
|
+
owner: Address;
|
|
330
|
+
lastCardBoughtTimestamp: number;
|
|
331
|
+
totalCardBoughtPerDay: Numeric;
|
|
332
|
+
};
|
|
333
|
+
export type PartnerCardConfigInfo = {
|
|
334
|
+
address: Address;
|
|
335
|
+
partnerName: string;
|
|
336
|
+
index: bigint;
|
|
337
|
+
zicOwner: Address;
|
|
338
|
+
carbonFeePercent: Numeric;
|
|
339
|
+
usdcMint: Address;
|
|
340
|
+
revenueVault: Address;
|
|
341
|
+
cardVault: Address;
|
|
342
|
+
totalCardSold: Numeric;
|
|
343
|
+
providerConfig: ProviderConfig;
|
|
344
|
+
dailyCardPurchaseLimit: Numeric;
|
|
345
|
+
};
|
|
346
|
+
export type CardConfigInfo = {
|
|
347
|
+
address: Address;
|
|
348
|
+
index: bigint;
|
|
349
|
+
zicOwner: Address;
|
|
350
|
+
nativeFeePercent: Numeric;
|
|
351
|
+
nonNativeFeePercent: Numeric;
|
|
352
|
+
revenueFeePercent: Numeric;
|
|
353
|
+
carbonFeePercent: Numeric;
|
|
354
|
+
usdcMint: Address;
|
|
355
|
+
revenueVault: Address;
|
|
356
|
+
commissionVault: Address;
|
|
357
|
+
cardVault: Address;
|
|
358
|
+
totalCardSold: Numeric;
|
|
359
|
+
providerConfig: ProviderConfig;
|
|
360
|
+
dailyCardPurchaseLimit: Numeric;
|
|
361
|
+
};
|
|
362
|
+
export type ProviderConfig = {
|
|
363
|
+
minCardAmount: Numeric;
|
|
364
|
+
maxCardAmount: Numeric;
|
|
365
|
+
feeTiers: CardFeeTier[];
|
|
366
|
+
};
|
|
367
|
+
export type CardPurchaseOfDay = {
|
|
368
|
+
totalCardPurchased: string;
|
|
369
|
+
cardPurchasedTimestamp: number;
|
|
370
|
+
};
|
|
371
|
+
export type EvmCardConfig = {
|
|
372
|
+
nativeFeePercent: string;
|
|
373
|
+
nonNativeFeePercent: string;
|
|
374
|
+
revenueFeePercent: string;
|
|
375
|
+
totalCardSold: bigint;
|
|
376
|
+
cardVault: string;
|
|
377
|
+
revenueVault: string;
|
|
378
|
+
commissionVault: string;
|
|
379
|
+
usdcAddress: string;
|
|
380
|
+
minCardAmount: string;
|
|
381
|
+
maxCardAmount: string;
|
|
382
|
+
dailyCardPurchaseLimit: string;
|
|
383
|
+
};
|
|
384
|
+
export type SuiNetwork = "mainnet" | "devnet" | "testnet";
|
|
385
|
+
export type SuiCardConfig = {
|
|
386
|
+
id: string;
|
|
387
|
+
admin: string;
|
|
388
|
+
cardVault: string;
|
|
389
|
+
dailyCardBuyLimit: string;
|
|
390
|
+
maxCardAmount: string;
|
|
391
|
+
minCardAmount: string;
|
|
392
|
+
nativeFee: string;
|
|
393
|
+
nonNativeFee: string;
|
|
394
|
+
revenueFee: string;
|
|
395
|
+
revenueVault: string;
|
|
396
|
+
version: string;
|
|
397
|
+
usdcAddress: string;
|
|
398
|
+
};
|
|
399
|
+
export type SuiFeeTier = {
|
|
400
|
+
minAmount: string;
|
|
401
|
+
maxAmount: string;
|
|
402
|
+
fee: string;
|
|
403
|
+
};
|
|
404
|
+
export type SuiFeeTierList = {
|
|
405
|
+
id: string;
|
|
406
|
+
tiers: SuiFeeTier[];
|
|
407
|
+
version: string;
|
|
408
|
+
};
|
|
409
|
+
export type SuiSwapFee = {
|
|
410
|
+
tokenType: string;
|
|
411
|
+
fee: string;
|
|
412
|
+
};
|
|
413
|
+
export type SuiSwapFeeList = {
|
|
414
|
+
id: string;
|
|
415
|
+
version: string;
|
|
416
|
+
swapFees: SuiSwapFee[];
|
|
417
|
+
};
|
|
418
|
+
export type DecimalString = string;
|
|
419
|
+
export type NumberString = string;
|
|
420
|
+
export type SuiAddress = string;
|
|
421
|
+
export type Percent = number;
|
|
422
|
+
export interface SuiSignTransactionInput {
|
|
423
|
+
transaction: Transaction | string;
|
|
424
|
+
}
|
|
425
|
+
export interface SuiSignTransactionOutput {
|
|
426
|
+
bytes: string;
|
|
427
|
+
signature: string;
|
|
428
|
+
}
|
|
429
|
+
export type SuiSignTransactionMethod = (transactionInput: SuiSignTransactionInput) => Promise<SuiSignTransactionOutput>;
|
|
430
|
+
export interface WalletInterface {
|
|
431
|
+
address: string;
|
|
432
|
+
signTransaction?: SuiSignTransactionMethod;
|
|
433
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ClientWithCoreApi } from "@mysten/sui/client";
|
|
2
|
+
import type { Signer } from "@mysten/sui/cryptography";
|
|
3
|
+
import type { SuiSignTransactionInput, SuiSignTransactionOutput } from "./types.js";
|
|
4
|
+
export declare function createSuiSignTransactionMethodFromSigner(signer: Signer, suiClient?: ClientWithCoreApi): (transactionInput: SuiSignTransactionInput) => Promise<SuiSignTransactionOutput>;
|
|
5
|
+
export declare function getCoinDecimals(client: ClientWithCoreApi, coinType: string): Promise<number>;
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
+
import { SUI_USDC_COIN_TYPE } from "./constants.js";
|
|
3
|
+
export function createSuiSignTransactionMethodFromSigner(signer, suiClient) {
|
|
4
|
+
return async (transactionInput) => {
|
|
5
|
+
let transaction;
|
|
6
|
+
if (typeof transactionInput.transaction === "string") {
|
|
7
|
+
transaction = Transaction.from(transactionInput.transaction);
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
transaction = transactionInput.transaction;
|
|
11
|
+
}
|
|
12
|
+
const signatureWithBytes = await transaction.sign({
|
|
13
|
+
signer: signer,
|
|
14
|
+
client: suiClient,
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
signature: signatureWithBytes.signature,
|
|
18
|
+
bytes: signatureWithBytes.bytes,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const coinTypeToDecimalMap = new Map([
|
|
23
|
+
[SUI_USDC_COIN_TYPE.devnet, 6],
|
|
24
|
+
[SUI_USDC_COIN_TYPE.mainnet, 6],
|
|
25
|
+
// [SUI_USDC_COIN_TYPE.Testnet, 6],
|
|
26
|
+
]);
|
|
27
|
+
export async function getCoinDecimals(client, coinType) {
|
|
28
|
+
if (coinTypeToDecimalMap.has(coinType)) {
|
|
29
|
+
// biome-ignore lint/style/noNonNullAssertion: we check for existence of the key before calling get, so it won't be null
|
|
30
|
+
return coinTypeToDecimalMap.get(coinType);
|
|
31
|
+
}
|
|
32
|
+
const metadata = await client.core.getCoinMetadata({ coinType });
|
|
33
|
+
if (!metadata.coinMetadata) {
|
|
34
|
+
throw new Error("Could not find metadata for given coin type.");
|
|
35
|
+
}
|
|
36
|
+
// console.log("coin metadata:", metadata.coinMetadata);
|
|
37
|
+
coinTypeToDecimalMap.set(coinType, metadata.coinMetadata.decimals);
|
|
38
|
+
return metadata.coinMetadata.decimals;
|
|
39
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Zebec Network",
|
|
3
|
+
"dependencies": {
|
|
4
|
+
"@coral-xyz/anchor": "^0.31.1",
|
|
5
|
+
"@metaplex-foundation/mpl-token-metadata": "^3.4.0",
|
|
6
|
+
"@metaplex-foundation/umi": "^1.5.1",
|
|
7
|
+
"@metaplex-foundation/umi-bundle-defaults": "^1.5.1",
|
|
8
|
+
"@metaplex-foundation/umi-web3js-adapters": "^1.5.1",
|
|
9
|
+
"@solana/spl-token": "^0.4.14",
|
|
10
|
+
"@solana/web3.js": "^1.98.2",
|
|
11
|
+
"@zebec-network/core-utils": "^1.1.1",
|
|
12
|
+
"@zebec-network/solana-common": "^2.3.1",
|
|
13
|
+
"bignumber.js": "^10.0.2",
|
|
14
|
+
"bn.js": "^5.2.3",
|
|
15
|
+
"buffer": "^6.0.3",
|
|
16
|
+
"ethers": "^6.16.0"
|
|
17
|
+
},
|
|
18
|
+
"description": "An SDK for performing admin operation in zebec smart contract in multiple chains",
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@mysten/bcs": "^2.0.2",
|
|
21
|
+
"@mysten/sui": "^2.7.0",
|
|
22
|
+
"@typechain/ethers-v6": "^0.5.1",
|
|
23
|
+
"@types/bn.js": "^5.2.0",
|
|
24
|
+
"@types/mocha": "^10.0.10",
|
|
25
|
+
"@types/node": "^25.3.0",
|
|
26
|
+
"dotenv": "^17.3.1",
|
|
27
|
+
"mocha": "^11.7.5",
|
|
28
|
+
"rimraf": "^6.1.3",
|
|
29
|
+
"ts-mocha": "^11.1.0",
|
|
30
|
+
"ts-node": "^10.9.2",
|
|
31
|
+
"typechain": "^8.3.2",
|
|
32
|
+
"typescript": "^5.9.3"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
],
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"main": "dist/index.js",
|
|
39
|
+
"name": "@zebec-network/admin-sdk",
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@coral-xyz/anchor": "^0.31.1",
|
|
42
|
+
"@mysten/bcs": "^2.0.2",
|
|
43
|
+
"@mysten/sui": "^2.7.0",
|
|
44
|
+
"ethers": "^6.16.0"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "npm run clean && tsc",
|
|
48
|
+
"clean": "rimraf ./dist",
|
|
49
|
+
"format": "npx @biomejs/biome format --write",
|
|
50
|
+
"gen:typechain": "typechain --target ethers-v6 --out-dir \"src/artifacts/typechain-types\" \"src/artifacts/abi/*.json\"",
|
|
51
|
+
"start": "ts-node src/index.ts",
|
|
52
|
+
"test": "ts-mocha -p ./tsconfig.json -b -t 1000000000 test/**/*.test.ts",
|
|
53
|
+
"test:single": "ts-mocha -p ./tsconfig.json -b -t 1000000000"
|
|
54
|
+
},
|
|
55
|
+
"type": "module",
|
|
56
|
+
"version": "1.0.0"
|
|
57
|
+
}
|