@zebec-network/zebec-vault-sdk 3.0.0 → 4.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/dist/artifacts/index.d.ts +3 -1
- package/dist/artifacts/index.js +4 -1
- package/dist/artifacts/zebec_instant_card.d.ts +6 -0
- package/dist/artifacts/zebec_instant_card.json +6 -0
- package/dist/artifacts/zebec_stake_v1.d.ts +1551 -0
- package/dist/artifacts/zebec_stake_v1.js +2 -0
- package/dist/artifacts/zebec_stake_v1.json +1125 -0
- package/dist/artifacts/zebec_stream.d.ts +5 -0
- package/dist/artifacts/zebec_stream.json +5 -0
- package/dist/constants.d.ts +3 -1
- package/dist/constants.js +10 -2
- package/dist/errors.d.ts +30 -0
- package/dist/errors.js +57 -0
- package/dist/pda.d.ts +5 -0
- package/dist/pda.js +36 -2
- package/dist/service.d.ts +80 -123
- package/dist/service.js +1092 -345
- package/dist/types.d.ts +227 -1
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +8 -0
- package/package.json +13 -12
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Address, BN } from "@coral-xyz/anchor";
|
|
2
|
+
import { Keypair, PublicKey } from "@solana/web3.js";
|
|
2
3
|
export type Numeric = number | string;
|
|
3
4
|
export type ProposalAction = {
|
|
4
5
|
programId: PublicKey;
|
|
@@ -41,3 +42,228 @@ export type WhitelistInfo = {
|
|
|
41
42
|
tokenAddress: PublicKey;
|
|
42
43
|
}[];
|
|
43
44
|
};
|
|
45
|
+
export type CreateSilverCardInstructionData = {
|
|
46
|
+
amount: BN;
|
|
47
|
+
index: BN;
|
|
48
|
+
currency: string;
|
|
49
|
+
emailHash: number[];
|
|
50
|
+
};
|
|
51
|
+
export type LoadCarbonCardInstructionData = {
|
|
52
|
+
amount: BN;
|
|
53
|
+
index: BN;
|
|
54
|
+
currency: string;
|
|
55
|
+
emailHash: number[];
|
|
56
|
+
reloadCardId: string;
|
|
57
|
+
};
|
|
58
|
+
export type ParsedCardConfigInfo = {
|
|
59
|
+
index: BN;
|
|
60
|
+
zicOwner: PublicKey;
|
|
61
|
+
nativeFee: BN;
|
|
62
|
+
nonNativeFee: BN;
|
|
63
|
+
revenueFee: BN;
|
|
64
|
+
usdcMint: PublicKey;
|
|
65
|
+
revenueVault: PublicKey;
|
|
66
|
+
commissionVault: PublicKey;
|
|
67
|
+
cardVault: PublicKey;
|
|
68
|
+
totalBought: BN;
|
|
69
|
+
dailyCardBuyLimit: BN;
|
|
70
|
+
providerConfig: ParsedProviderConfig;
|
|
71
|
+
};
|
|
72
|
+
export type ParsedProviderConfig = {
|
|
73
|
+
minCardAmount: BN;
|
|
74
|
+
maxCardAmount: BN;
|
|
75
|
+
feeTiers: {
|
|
76
|
+
tiers: ParsedFeeTier[];
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export type ParsedFeeTier = {
|
|
80
|
+
minAmount: BN;
|
|
81
|
+
maxAmount: BN;
|
|
82
|
+
fee: BN;
|
|
83
|
+
};
|
|
84
|
+
export type CreateSilverCardParams = {
|
|
85
|
+
vaultOwnerAddress?: Address;
|
|
86
|
+
nextCardIndex: bigint;
|
|
87
|
+
amount: Numeric;
|
|
88
|
+
usdcAddress: Address;
|
|
89
|
+
emailHash: Buffer;
|
|
90
|
+
currency: string;
|
|
91
|
+
};
|
|
92
|
+
export type LoadCarbonCardParams = {
|
|
93
|
+
vaultOwnerAddress?: Address;
|
|
94
|
+
nextCardIndex: bigint;
|
|
95
|
+
amount: Numeric;
|
|
96
|
+
usdcAddress: Address;
|
|
97
|
+
emailHash: Buffer;
|
|
98
|
+
currency: string;
|
|
99
|
+
reloadCardId: string;
|
|
100
|
+
};
|
|
101
|
+
export type SwapAndCreateSilverCardParams = {
|
|
102
|
+
quoteInfo: QuoteInfo;
|
|
103
|
+
vaultOwnerAddress: Address;
|
|
104
|
+
nextCardCounter: bigint;
|
|
105
|
+
emailHash: Buffer;
|
|
106
|
+
currency: string;
|
|
107
|
+
wrapAndUnwrapSol?: boolean;
|
|
108
|
+
};
|
|
109
|
+
export type SwapAndLoadCarbonCardParams = {
|
|
110
|
+
quoteInfo: QuoteInfo;
|
|
111
|
+
nextCardCounter: bigint;
|
|
112
|
+
emailHash: Buffer;
|
|
113
|
+
currency: string;
|
|
114
|
+
reloadCardId: string;
|
|
115
|
+
vaultOwnerAddress: Address;
|
|
116
|
+
wrapAndUnwrapSol?: boolean;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Juptier quote info
|
|
120
|
+
*/
|
|
121
|
+
export type QuoteInfo = {
|
|
122
|
+
inputMint: string;
|
|
123
|
+
inAmount: string;
|
|
124
|
+
outputMint: string;
|
|
125
|
+
outAmount: string;
|
|
126
|
+
otherAmountThreshold: string;
|
|
127
|
+
swapMode: "ExactIn" | "ExactOut";
|
|
128
|
+
slippageBps: number;
|
|
129
|
+
platformFee: {
|
|
130
|
+
amount: string;
|
|
131
|
+
feeBps: number;
|
|
132
|
+
} | null;
|
|
133
|
+
priceImpactPct: string;
|
|
134
|
+
routePlan: RouteInfo[];
|
|
135
|
+
contextSlot: number;
|
|
136
|
+
timeTaken: number;
|
|
137
|
+
swapUsdValue: string;
|
|
138
|
+
simplerRouteUsed: boolean;
|
|
139
|
+
mostReliableAmmsQuoteReport: {
|
|
140
|
+
info: Record<string, string>;
|
|
141
|
+
};
|
|
142
|
+
} | {
|
|
143
|
+
error: string;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Jupiter quote routes info
|
|
147
|
+
*/
|
|
148
|
+
export type RouteInfo = {
|
|
149
|
+
swapInfo: {
|
|
150
|
+
ammKey: string;
|
|
151
|
+
label: string;
|
|
152
|
+
inputMint: string;
|
|
153
|
+
outputMint: string;
|
|
154
|
+
inAmount: string;
|
|
155
|
+
outAmount: string;
|
|
156
|
+
feeAmount: string;
|
|
157
|
+
feeMint: string;
|
|
158
|
+
};
|
|
159
|
+
percent: number;
|
|
160
|
+
bps: number;
|
|
161
|
+
};
|
|
162
|
+
export type CreateStreamFromVaultParams = {
|
|
163
|
+
vaultOwner: Address;
|
|
164
|
+
receiver: Address;
|
|
165
|
+
streamToken: Address;
|
|
166
|
+
amount: Numeric;
|
|
167
|
+
automaticWithdrawal: boolean;
|
|
168
|
+
cancelableByRecipient: boolean;
|
|
169
|
+
cancelableBySender: boolean;
|
|
170
|
+
cliffPercentage: Numeric;
|
|
171
|
+
duration: number;
|
|
172
|
+
isPausable: boolean;
|
|
173
|
+
startNow: boolean;
|
|
174
|
+
startTime: number;
|
|
175
|
+
autoWithdrawFrequency: number;
|
|
176
|
+
streamName: string;
|
|
177
|
+
transferableByRecipient: boolean;
|
|
178
|
+
transferableBySender: boolean;
|
|
179
|
+
canTopup: boolean;
|
|
180
|
+
rateUpdatable: boolean;
|
|
181
|
+
streamMetadataKeypair?: Keypair;
|
|
182
|
+
};
|
|
183
|
+
export type createMultipleStreamFromVaultParams = {
|
|
184
|
+
vaultOwner: Address;
|
|
185
|
+
streamInfo: {
|
|
186
|
+
receiver: Address;
|
|
187
|
+
streamToken: Address;
|
|
188
|
+
amount: Numeric;
|
|
189
|
+
automaticWithdrawal: boolean;
|
|
190
|
+
cancelableByRecipient: boolean;
|
|
191
|
+
cancelableBySender: boolean;
|
|
192
|
+
cliffPercentage: Numeric;
|
|
193
|
+
duration: number;
|
|
194
|
+
isPausable: boolean;
|
|
195
|
+
startNow: boolean;
|
|
196
|
+
startTime: number;
|
|
197
|
+
autoWithdrawFrequency: number;
|
|
198
|
+
streamName: string;
|
|
199
|
+
transferableByRecipient: boolean;
|
|
200
|
+
transferableBySender: boolean;
|
|
201
|
+
canTopup: boolean;
|
|
202
|
+
rateUpdatable: boolean;
|
|
203
|
+
streamMetadataKeypair?: Keypair;
|
|
204
|
+
}[];
|
|
205
|
+
};
|
|
206
|
+
export type TokenFeeRecord = {
|
|
207
|
+
tokenAddress: Address;
|
|
208
|
+
fee: Numeric;
|
|
209
|
+
};
|
|
210
|
+
export type CancelStreamParams = {
|
|
211
|
+
streamMetadata: Address;
|
|
212
|
+
vaultOwner?: Address;
|
|
213
|
+
};
|
|
214
|
+
export type PauseResumeStreamParams = {
|
|
215
|
+
streamMetadata: Address;
|
|
216
|
+
vaultOwner?: Address;
|
|
217
|
+
};
|
|
218
|
+
export type ChangeStreamReceiverParams = {
|
|
219
|
+
streamMetadata: Address;
|
|
220
|
+
vaultOwner?: Address;
|
|
221
|
+
newRecipient: Address;
|
|
222
|
+
};
|
|
223
|
+
export type WithdrawStreamParams = {
|
|
224
|
+
streamMetadata: Address;
|
|
225
|
+
vaultOwner?: Address;
|
|
226
|
+
};
|
|
227
|
+
export type StakeInstructionData = {
|
|
228
|
+
amount: BN;
|
|
229
|
+
lockPeriod: BN;
|
|
230
|
+
nonce: BN;
|
|
231
|
+
};
|
|
232
|
+
export type StreamMetadataInfo = {
|
|
233
|
+
address: PublicKey;
|
|
234
|
+
parties: {
|
|
235
|
+
sender: PublicKey;
|
|
236
|
+
receiver: PublicKey;
|
|
237
|
+
};
|
|
238
|
+
financials: {
|
|
239
|
+
streamToken: PublicKey;
|
|
240
|
+
cliffPercentage: number;
|
|
241
|
+
depositedAmount: string;
|
|
242
|
+
withdrawnAmount: string;
|
|
243
|
+
};
|
|
244
|
+
schedule: {
|
|
245
|
+
startTime: number;
|
|
246
|
+
endTime: number;
|
|
247
|
+
lastWithdrawTime: number;
|
|
248
|
+
frequency: number;
|
|
249
|
+
duration: number;
|
|
250
|
+
pausedTimestamp: number;
|
|
251
|
+
pausedInterval: number;
|
|
252
|
+
canceledTimestamp: number;
|
|
253
|
+
};
|
|
254
|
+
permissions: {
|
|
255
|
+
cancelableBySender: boolean;
|
|
256
|
+
cancelableByRecipient: boolean;
|
|
257
|
+
automaticWithdrawal: boolean;
|
|
258
|
+
transferableBySender: boolean;
|
|
259
|
+
transferableByRecipient: boolean;
|
|
260
|
+
canTopup: boolean;
|
|
261
|
+
isPausable: boolean;
|
|
262
|
+
rateUpdatable: boolean;
|
|
263
|
+
};
|
|
264
|
+
streamName: string;
|
|
265
|
+
};
|
|
266
|
+
export type StakeUserNonceInfo = {
|
|
267
|
+
address: string;
|
|
268
|
+
nonce: bigint;
|
|
269
|
+
};
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { TransactionInstruction } from "@solana/web3.js";
|
|
1
2
|
import { ProposalAction } from "./types";
|
|
2
3
|
export declare function calculateActionsSize(actions: ProposalAction[]): number;
|
|
3
4
|
export declare function calculateProposalSize(name: string, actions: ProposalAction[]): number;
|
|
5
|
+
export declare function transactionInstructionToPropoalAction(ix: TransactionInstruction): ProposalAction;
|
package/dist/utils.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculateActionsSize = calculateActionsSize;
|
|
4
4
|
exports.calculateProposalSize = calculateProposalSize;
|
|
5
|
+
exports.transactionInstructionToPropoalAction = transactionInstructionToPropoalAction;
|
|
5
6
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
6
7
|
function calculateActionsSize(actions) {
|
|
7
8
|
return actions
|
|
@@ -24,3 +25,10 @@ function calculateProposalSize(name, actions) {
|
|
|
24
25
|
/** extra */ 20;
|
|
25
26
|
return withExtraSpace;
|
|
26
27
|
}
|
|
28
|
+
function transactionInstructionToPropoalAction(ix) {
|
|
29
|
+
return {
|
|
30
|
+
accountSpecs: ix.keys,
|
|
31
|
+
data: ix.data,
|
|
32
|
+
programId: ix.programId,
|
|
33
|
+
};
|
|
34
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zebec-network/zebec-vault-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "An SDK for zebec vault solana program",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,25 +26,26 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/mocha": "^10.0.10",
|
|
29
|
-
"@types/node": "^24.
|
|
30
|
-
"@zebec-network/zebec-card-v2-sdk": "^2.
|
|
31
|
-
"@zebec-network/zebec-stake-sdk": "^1.1.
|
|
32
|
-
"@zebec-network/zebec-stream-sdk": "^1.
|
|
33
|
-
"dotenv": "^17.2.
|
|
34
|
-
"mocha": "^11.
|
|
35
|
-
"prettier": "^3.
|
|
29
|
+
"@types/node": "^24.3.1",
|
|
30
|
+
"@zebec-network/zebec-card-v2-sdk": "^2.1.2",
|
|
31
|
+
"@zebec-network/zebec-stake-sdk": "^1.1.3",
|
|
32
|
+
"@zebec-network/zebec-stream-sdk": "^1.7.0",
|
|
33
|
+
"dotenv": "^17.2.2",
|
|
34
|
+
"mocha": "^11.7.2",
|
|
35
|
+
"prettier": "^3.6.2",
|
|
36
36
|
"rimraf": "^6.0.1",
|
|
37
37
|
"ts-mocha": "^11.1.0",
|
|
38
38
|
"ts-node": "^10.9.2",
|
|
39
|
-
"typescript": "^5.
|
|
39
|
+
"typescript": "^5.9.2"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@coral-xyz/anchor": "^0.31.1",
|
|
43
|
+
"@solana/spl-token": "^0.4.14",
|
|
43
44
|
"@solana/web3.js": "^1.98.2",
|
|
44
45
|
"@types/bn.js": "^5.2.0",
|
|
45
|
-
"@zebec-network/core-utils": "^1.1.
|
|
46
|
-
"@zebec-network/solana-common": "^
|
|
47
|
-
"bignumber.js": "^9.3.
|
|
46
|
+
"@zebec-network/core-utils": "^1.1.1",
|
|
47
|
+
"@zebec-network/solana-common": "^2.3.0",
|
|
48
|
+
"bignumber.js": "^9.3.1",
|
|
48
49
|
"buffer": "^6.0.3"
|
|
49
50
|
}
|
|
50
51
|
}
|