@n1xyz/nord-ts 0.0.9 → 0.0.10
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/bridge/client.d.ts +2 -2
- package/dist/bridge/client.js +5 -5
- package/dist/bridge/types.d.ts +1 -1
- package/dist/bridge/types.js +1 -1
- package/dist/idl/bridge.js +0 -33
- package/package.json +1 -1
- package/src/bridge/client.ts +5 -5
- package/src/bridge/types.ts +1 -1
- package/src/idl/bridge.ts +1 -34
package/dist/bridge/client.d.ts
CHANGED
|
@@ -38,12 +38,12 @@ export declare class SolanaBridgeClient {
|
|
|
38
38
|
*/
|
|
39
39
|
findContractStoragePda(): Promise<[PublicKey, number]>;
|
|
40
40
|
/**
|
|
41
|
-
* Find the asset
|
|
41
|
+
* Find the asset config PDA for a token mint
|
|
42
42
|
*
|
|
43
43
|
* @param mint Token mint address
|
|
44
44
|
* @returns [PDA, bump]
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
findAssetConfigPda(mint: PublicKey): Promise<[PublicKey, number]>;
|
|
47
47
|
/**
|
|
48
48
|
* Find the deposit storage PDA for a deposit index
|
|
49
49
|
*
|
package/dist/bridge/client.js
CHANGED
|
@@ -105,13 +105,13 @@ class SolanaBridgeClient {
|
|
|
105
105
|
return this.findPda(types_1.PdaSeedType.ContractStorage);
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
|
-
* Find the asset
|
|
108
|
+
* Find the asset config PDA for a token mint
|
|
109
109
|
*
|
|
110
110
|
* @param mint Token mint address
|
|
111
111
|
* @returns [PDA, bump]
|
|
112
112
|
*/
|
|
113
|
-
async
|
|
114
|
-
return this.findPda(types_1.PdaSeedType.
|
|
113
|
+
async findAssetConfigPda(mint) {
|
|
114
|
+
return this.findPda(types_1.PdaSeedType.AssetConfig, mint);
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
117
117
|
* Find the deposit storage PDA for a deposit index
|
|
@@ -172,7 +172,7 @@ class SolanaBridgeClient {
|
|
|
172
172
|
*/
|
|
173
173
|
async depositSpl(params) {
|
|
174
174
|
const [contractStorage] = await this.findContractStoragePda();
|
|
175
|
-
const [assetWhitelisted] = await this.
|
|
175
|
+
const [assetWhitelisted] = await this.findAssetConfigPda(params.mint);
|
|
176
176
|
// Get the last deposit index from contract storage
|
|
177
177
|
const contractStorageAccount = await this.program.account.contractStorage.fetch(contractStorage);
|
|
178
178
|
const lastDepositIndex = contractStorageAccount.lastDepositIndex.toNumber();
|
|
@@ -256,7 +256,7 @@ class SolanaBridgeClient {
|
|
|
256
256
|
*/
|
|
257
257
|
async whitelistAsset(mint, signer) {
|
|
258
258
|
const [contractStorage] = await this.findContractStoragePda();
|
|
259
|
-
const [assetWhitelisted] = await this.
|
|
259
|
+
const [assetWhitelisted] = await this.findAssetConfigPda(mint);
|
|
260
260
|
// Build the transaction
|
|
261
261
|
const tx = await this.program.methods
|
|
262
262
|
.whitelistAsset(mint)
|
package/dist/bridge/types.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ export interface TransferParams {
|
|
|
109
109
|
*/
|
|
110
110
|
export declare enum PdaSeedType {
|
|
111
111
|
ContractStorage = "contract_storage",
|
|
112
|
-
|
|
112
|
+
AssetConfig = "asset_config",
|
|
113
113
|
DepositStorage = "deposit_storage",
|
|
114
114
|
BlockStorage = "block_storage",
|
|
115
115
|
WithdrawalNullifier = "withdrawal_nullifier",
|
package/dist/bridge/types.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.PdaSeedType = void 0;
|
|
|
7
7
|
var PdaSeedType;
|
|
8
8
|
(function (PdaSeedType) {
|
|
9
9
|
PdaSeedType["ContractStorage"] = "contract_storage";
|
|
10
|
-
PdaSeedType["
|
|
10
|
+
PdaSeedType["AssetConfig"] = "asset_config";
|
|
11
11
|
PdaSeedType["DepositStorage"] = "deposit_storage";
|
|
12
12
|
PdaSeedType["BlockStorage"] = "block_storage";
|
|
13
13
|
PdaSeedType["WithdrawalNullifier"] = "withdrawal_nullifier";
|
package/dist/idl/bridge.js
CHANGED
|
@@ -111,10 +111,6 @@ exports.BRIDGE_IDL = {
|
|
|
111
111
|
},
|
|
112
112
|
},
|
|
113
113
|
},
|
|
114
|
-
{
|
|
115
|
-
name: "program",
|
|
116
|
-
address: "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB",
|
|
117
|
-
},
|
|
118
114
|
{
|
|
119
115
|
name: "token_program",
|
|
120
116
|
},
|
|
@@ -200,10 +196,6 @@ exports.BRIDGE_IDL = {
|
|
|
200
196
|
],
|
|
201
197
|
},
|
|
202
198
|
},
|
|
203
|
-
{
|
|
204
|
-
name: "program",
|
|
205
|
-
address: "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB",
|
|
206
|
-
},
|
|
207
199
|
{
|
|
208
200
|
name: "system_program",
|
|
209
201
|
address: "11111111111111111111111111111111",
|
|
@@ -258,10 +250,6 @@ exports.BRIDGE_IDL = {
|
|
|
258
250
|
],
|
|
259
251
|
},
|
|
260
252
|
},
|
|
261
|
-
{
|
|
262
|
-
name: "program",
|
|
263
|
-
address: "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB",
|
|
264
|
-
},
|
|
265
253
|
{
|
|
266
254
|
name: "system_program",
|
|
267
255
|
address: "11111111111111111111111111111111",
|
|
@@ -285,11 +273,6 @@ exports.BRIDGE_IDL = {
|
|
|
285
273
|
writable: true,
|
|
286
274
|
signer: true,
|
|
287
275
|
},
|
|
288
|
-
{
|
|
289
|
-
name: "program",
|
|
290
|
-
signer: true,
|
|
291
|
-
address: "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB",
|
|
292
|
-
},
|
|
293
276
|
{
|
|
294
277
|
name: "contract_storage",
|
|
295
278
|
writable: true,
|
|
@@ -377,10 +360,6 @@ exports.BRIDGE_IDL = {
|
|
|
377
360
|
],
|
|
378
361
|
},
|
|
379
362
|
},
|
|
380
|
-
{
|
|
381
|
-
name: "program",
|
|
382
|
-
address: "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB",
|
|
383
|
-
},
|
|
384
363
|
{
|
|
385
364
|
name: "system_program",
|
|
386
365
|
address: "11111111111111111111111111111111",
|
|
@@ -437,10 +416,6 @@ exports.BRIDGE_IDL = {
|
|
|
437
416
|
],
|
|
438
417
|
},
|
|
439
418
|
},
|
|
440
|
-
{
|
|
441
|
-
name: "program",
|
|
442
|
-
address: "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB",
|
|
443
|
-
},
|
|
444
419
|
],
|
|
445
420
|
args: [
|
|
446
421
|
{
|
|
@@ -494,10 +469,6 @@ exports.BRIDGE_IDL = {
|
|
|
494
469
|
],
|
|
495
470
|
},
|
|
496
471
|
},
|
|
497
|
-
{
|
|
498
|
-
name: "program",
|
|
499
|
-
address: "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB",
|
|
500
|
-
},
|
|
501
472
|
{
|
|
502
473
|
name: "system_program",
|
|
503
474
|
address: "11111111111111111111111111111111",
|
|
@@ -624,10 +595,6 @@ exports.BRIDGE_IDL = {
|
|
|
624
595
|
],
|
|
625
596
|
},
|
|
626
597
|
},
|
|
627
|
-
{
|
|
628
|
-
name: "program",
|
|
629
|
-
address: "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB",
|
|
630
|
-
},
|
|
631
598
|
{
|
|
632
599
|
name: "token_program",
|
|
633
600
|
},
|
package/package.json
CHANGED
package/src/bridge/client.ts
CHANGED
|
@@ -110,13 +110,13 @@ export class SolanaBridgeClient {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
* Find the asset
|
|
113
|
+
* Find the asset config PDA for a token mint
|
|
114
114
|
*
|
|
115
115
|
* @param mint Token mint address
|
|
116
116
|
* @returns [PDA, bump]
|
|
117
117
|
*/
|
|
118
|
-
async
|
|
119
|
-
return this.findPda(PdaSeedType.
|
|
118
|
+
async findAssetConfigPda(mint: PublicKey): Promise<[PublicKey, number]> {
|
|
119
|
+
return this.findPda(PdaSeedType.AssetConfig, mint);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
/**
|
|
@@ -195,7 +195,7 @@ export class SolanaBridgeClient {
|
|
|
195
195
|
*/
|
|
196
196
|
async depositSpl(params: DepositSplParams): Promise<string> {
|
|
197
197
|
const [contractStorage] = await this.findContractStoragePda();
|
|
198
|
-
const [assetWhitelisted] = await this.
|
|
198
|
+
const [assetWhitelisted] = await this.findAssetConfigPda(params.mint);
|
|
199
199
|
|
|
200
200
|
// Get the last deposit index from contract storage
|
|
201
201
|
const contractStorageAccount =
|
|
@@ -300,7 +300,7 @@ export class SolanaBridgeClient {
|
|
|
300
300
|
*/
|
|
301
301
|
async whitelistAsset(mint: PublicKey, signer: Keypair): Promise<string> {
|
|
302
302
|
const [contractStorage] = await this.findContractStoragePda();
|
|
303
|
-
const [assetWhitelisted] = await this.
|
|
303
|
+
const [assetWhitelisted] = await this.findAssetConfigPda(mint);
|
|
304
304
|
|
|
305
305
|
// Build the transaction
|
|
306
306
|
const tx = await this.program.methods
|
package/src/bridge/types.ts
CHANGED
|
@@ -118,7 +118,7 @@ export interface TransferParams {
|
|
|
118
118
|
*/
|
|
119
119
|
export enum PdaSeedType {
|
|
120
120
|
ContractStorage = "contract_storage",
|
|
121
|
-
|
|
121
|
+
AssetConfig = "asset_config",
|
|
122
122
|
DepositStorage = "deposit_storage",
|
|
123
123
|
BlockStorage = "block_storage",
|
|
124
124
|
WithdrawalNullifier = "withdrawal_nullifier",
|
package/src/idl/bridge.ts
CHANGED
|
@@ -110,10 +110,6 @@ export const BRIDGE_IDL: Idl = {
|
|
|
110
110
|
},
|
|
111
111
|
},
|
|
112
112
|
},
|
|
113
|
-
{
|
|
114
|
-
name: "program",
|
|
115
|
-
address: "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB",
|
|
116
|
-
},
|
|
117
113
|
{
|
|
118
114
|
name: "token_program",
|
|
119
115
|
},
|
|
@@ -199,10 +195,6 @@ export const BRIDGE_IDL: Idl = {
|
|
|
199
195
|
],
|
|
200
196
|
},
|
|
201
197
|
},
|
|
202
|
-
{
|
|
203
|
-
name: "program",
|
|
204
|
-
address: "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB",
|
|
205
|
-
},
|
|
206
198
|
{
|
|
207
199
|
name: "system_program",
|
|
208
200
|
address: "11111111111111111111111111111111",
|
|
@@ -257,10 +249,6 @@ export const BRIDGE_IDL: Idl = {
|
|
|
257
249
|
],
|
|
258
250
|
},
|
|
259
251
|
},
|
|
260
|
-
{
|
|
261
|
-
name: "program",
|
|
262
|
-
address: "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB",
|
|
263
|
-
},
|
|
264
252
|
{
|
|
265
253
|
name: "system_program",
|
|
266
254
|
address: "11111111111111111111111111111111",
|
|
@@ -284,11 +272,6 @@ export const BRIDGE_IDL: Idl = {
|
|
|
284
272
|
writable: true,
|
|
285
273
|
signer: true,
|
|
286
274
|
},
|
|
287
|
-
{
|
|
288
|
-
name: "program",
|
|
289
|
-
signer: true,
|
|
290
|
-
address: "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB",
|
|
291
|
-
},
|
|
292
275
|
{
|
|
293
276
|
name: "contract_storage",
|
|
294
277
|
writable: true,
|
|
@@ -376,10 +359,6 @@ export const BRIDGE_IDL: Idl = {
|
|
|
376
359
|
],
|
|
377
360
|
},
|
|
378
361
|
},
|
|
379
|
-
{
|
|
380
|
-
name: "program",
|
|
381
|
-
address: "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB",
|
|
382
|
-
},
|
|
383
362
|
{
|
|
384
363
|
name: "system_program",
|
|
385
364
|
address: "11111111111111111111111111111111",
|
|
@@ -436,10 +415,6 @@ export const BRIDGE_IDL: Idl = {
|
|
|
436
415
|
],
|
|
437
416
|
},
|
|
438
417
|
},
|
|
439
|
-
{
|
|
440
|
-
name: "program",
|
|
441
|
-
address: "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB",
|
|
442
|
-
},
|
|
443
418
|
],
|
|
444
419
|
args: [
|
|
445
420
|
{
|
|
@@ -493,10 +468,6 @@ export const BRIDGE_IDL: Idl = {
|
|
|
493
468
|
],
|
|
494
469
|
},
|
|
495
470
|
},
|
|
496
|
-
{
|
|
497
|
-
name: "program",
|
|
498
|
-
address: "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB",
|
|
499
|
-
},
|
|
500
471
|
{
|
|
501
472
|
name: "system_program",
|
|
502
473
|
address: "11111111111111111111111111111111",
|
|
@@ -623,10 +594,6 @@ export const BRIDGE_IDL: Idl = {
|
|
|
623
594
|
],
|
|
624
595
|
},
|
|
625
596
|
},
|
|
626
|
-
{
|
|
627
|
-
name: "program",
|
|
628
|
-
address: "CVDFLCAjXhVWiPXH9nTCTpCgVzmDVoiPzNJYuccr1dqB",
|
|
629
|
-
},
|
|
630
597
|
{
|
|
631
598
|
name: "token_program",
|
|
632
599
|
},
|
|
@@ -926,4 +893,4 @@ export const BRIDGE_IDL: Idl = {
|
|
|
926
893
|
},
|
|
927
894
|
},
|
|
928
895
|
],
|
|
929
|
-
};
|
|
896
|
+
};
|