@lavarage/sdk 6.9.4 → 7.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/index.js CHANGED
@@ -1101,10 +1101,13 @@ var updateMaxLendPerTokenBatchEvm = (_0, _1, _2) => __async(void 0, [_0, _1, _2]
1101
1101
  // lending.ts
1102
1102
  var lending_exports = {};
1103
1103
  __export(lending_exports, {
1104
+ addToWithdrawalAccessList: () => addToWithdrawalAccessList,
1104
1105
  createOffer: () => createOffer,
1105
1106
  depositFunds: () => depositFunds,
1106
1107
  getNodeWalletPDA: () => getNodeWalletPDA,
1107
1108
  getTradingPoolPDA: () => getTradingPoolPDA,
1109
+ getWithdrawalAccessListPDA: () => getWithdrawalAccessListPDA,
1110
+ removeFromWithdrawalAccessList: () => removeFromWithdrawalAccessList,
1108
1111
  updateInterestRate: () => updateInterestRate,
1109
1112
  updateMaxBorrow: () => updateMaxBorrow,
1110
1113
  updateMaxExposure: () => updateMaxExposure,
@@ -1136,6 +1139,14 @@ function getTradingPoolPDA(poolOwnerPublicKey, tokenPublicKey, programId) {
1136
1139
  programId
1137
1140
  );
1138
1141
  }
1142
+ function getWithdrawalAccessListPDA(programId) {
1143
+ return getPda(
1144
+ [
1145
+ Buffer.from("withdrawal_access_list")
1146
+ ],
1147
+ programId
1148
+ );
1149
+ }
1139
1150
  function createNodeWallet(lavarageProgram, params) {
1140
1151
  return __async(this, null, function* () {
1141
1152
  const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
@@ -1483,6 +1494,47 @@ function updateMaxBorrow(lavarageProgram, params) {
1483
1494
  return new import_web3.VersionedTransaction(messageV0);
1484
1495
  });
1485
1496
  }
1497
+ function addToWithdrawalAccessList(lavarageProgram, params) {
1498
+ return __async(this, null, function* () {
1499
+ var _a;
1500
+ const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
1501
+ const withdrawalAccessList = getWithdrawalAccessListPDA(lavarageProgram.programId);
1502
+ const instruction = yield lavarageProgram.methods.addWithdrawalAccess(params.toPubkey).accounts({
1503
+ withdrawalAccessList,
1504
+ nodeWallet: params.nodeWallet,
1505
+ authority: params.authority
1506
+ }).instruction();
1507
+ const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
1508
+ microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
1509
+ });
1510
+ const messageV0 = new import_web3.TransactionMessage({
1511
+ payerKey: lavarageProgram.provider.publicKey,
1512
+ recentBlockhash: blockhash,
1513
+ instructions: [instruction, computeFeeIx]
1514
+ }).compileToV0Message();
1515
+ return new import_web3.VersionedTransaction(messageV0);
1516
+ });
1517
+ }
1518
+ function removeFromWithdrawalAccessList(lavarageProgram, params) {
1519
+ return __async(this, null, function* () {
1520
+ var _a;
1521
+ const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
1522
+ const withdrawalAccessList = getWithdrawalAccessListPDA(lavarageProgram.programId);
1523
+ const instruction = yield lavarageProgram.methods.removeWithdrawalAccess(params.nodeWallet).accounts({
1524
+ withdrawalAccessList,
1525
+ authority: params.authority
1526
+ }).instruction();
1527
+ const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
1528
+ microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
1529
+ });
1530
+ const messageV0 = new import_web3.TransactionMessage({
1531
+ payerKey: lavarageProgram.provider.publicKey,
1532
+ recentBlockhash: blockhash,
1533
+ instructions: [instruction, computeFeeIx]
1534
+ }).compileToV0Message();
1535
+ return new import_web3.VersionedTransaction(messageV0);
1536
+ });
1537
+ }
1486
1538
 
1487
1539
  // idl/lavarage.ts
1488
1540
  var IDL = {
@@ -1589,6 +1641,11 @@ var IDL = {
1589
1641
  "name": "systemProgram",
1590
1642
  "isMut": false,
1591
1643
  "isSigner": false
1644
+ },
1645
+ {
1646
+ "name": "withdrawalAccessList",
1647
+ "isMut": false,
1648
+ "isSigner": false
1592
1649
  }
1593
1650
  ],
1594
1651
  "args": [
@@ -1721,7 +1778,7 @@ var IDL = {
1721
1778
  },
1722
1779
  {
1723
1780
  "name": "toTokenAccount",
1724
- "isMut": true,
1781
+ "isMut": false,
1725
1782
  "isSigner": false
1726
1783
  },
1727
1784
  {
@@ -1792,7 +1849,7 @@ var IDL = {
1792
1849
  },
1793
1850
  {
1794
1851
  "name": "toTokenAccount",
1795
- "isMut": true,
1852
+ "isMut": false,
1796
1853
  "isSigner": false
1797
1854
  },
1798
1855
  {
@@ -2285,6 +2342,11 @@ var IDL = {
2285
2342
  "name": "systemProgram",
2286
2343
  "isMut": false,
2287
2344
  "isSigner": false
2345
+ },
2346
+ {
2347
+ "name": "mint",
2348
+ "isMut": false,
2349
+ "isSigner": false
2288
2350
  }
2289
2351
  ],
2290
2352
  "args": [
@@ -2351,6 +2413,11 @@ var IDL = {
2351
2413
  "name": "systemProgram",
2352
2414
  "isMut": false,
2353
2415
  "isSigner": false
2416
+ },
2417
+ {
2418
+ "name": "qtMint",
2419
+ "isMut": false,
2420
+ "isSigner": false
2354
2421
  }
2355
2422
  ],
2356
2423
  "args": [
@@ -2428,6 +2495,74 @@ var IDL = {
2428
2495
  "type": "publicKey"
2429
2496
  }
2430
2497
  ]
2498
+ },
2499
+ {
2500
+ "name": "initWithdrawalAccessList",
2501
+ "accounts": [
2502
+ {
2503
+ "name": "withdrawalAccessList",
2504
+ "isMut": true,
2505
+ "isSigner": false
2506
+ },
2507
+ {
2508
+ "name": "authority",
2509
+ "isMut": true,
2510
+ "isSigner": true
2511
+ },
2512
+ {
2513
+ "name": "systemProgram",
2514
+ "isMut": false,
2515
+ "isSigner": false
2516
+ }
2517
+ ],
2518
+ "args": []
2519
+ },
2520
+ {
2521
+ "name": "addWithdrawalAccess",
2522
+ "accounts": [
2523
+ {
2524
+ "name": "withdrawalAccessList",
2525
+ "isMut": true,
2526
+ "isSigner": false
2527
+ },
2528
+ {
2529
+ "name": "nodeWallet",
2530
+ "isMut": false,
2531
+ "isSigner": false
2532
+ },
2533
+ {
2534
+ "name": "authority",
2535
+ "isMut": false,
2536
+ "isSigner": true
2537
+ }
2538
+ ],
2539
+ "args": [
2540
+ {
2541
+ "name": "toPubkey",
2542
+ "type": "publicKey"
2543
+ }
2544
+ ]
2545
+ },
2546
+ {
2547
+ "name": "removeWithdrawalAccess",
2548
+ "accounts": [
2549
+ {
2550
+ "name": "withdrawalAccessList",
2551
+ "isMut": true,
2552
+ "isSigner": false
2553
+ },
2554
+ {
2555
+ "name": "authority",
2556
+ "isMut": false,
2557
+ "isSigner": true
2558
+ }
2559
+ ],
2560
+ "args": [
2561
+ {
2562
+ "name": "fromPubkey",
2563
+ "type": "string"
2564
+ }
2565
+ ]
2431
2566
  }
2432
2567
  ],
2433
2568
  "accounts": [
@@ -2590,9 +2725,45 @@ var IDL = {
2590
2725
  }
2591
2726
  ]
2592
2727
  }
2728
+ },
2729
+ {
2730
+ "name": "withdrawalAccessList",
2731
+ "type": {
2732
+ "kind": "struct",
2733
+ "fields": [
2734
+ {
2735
+ "name": "authority",
2736
+ "type": "publicKey"
2737
+ },
2738
+ {
2739
+ "name": "accessEntries",
2740
+ "type": {
2741
+ "vec": {
2742
+ "defined": "WithdrawalAccessEntry"
2743
+ }
2744
+ }
2745
+ }
2746
+ ]
2747
+ }
2593
2748
  }
2594
2749
  ],
2595
2750
  "types": [
2751
+ {
2752
+ "name": "WithdrawalAccessEntry",
2753
+ "type": {
2754
+ "kind": "struct",
2755
+ "fields": [
2756
+ {
2757
+ "name": "fromPubkey",
2758
+ "type": "string"
2759
+ },
2760
+ {
2761
+ "name": "toPubkey",
2762
+ "type": "publicKey"
2763
+ }
2764
+ ]
2765
+ }
2766
+ },
2596
2767
  {
2597
2768
  "name": "LendingErrors",
2598
2769
  "docs": [
@@ -2624,6 +2795,15 @@ var IDL = {
2624
2795
  },
2625
2796
  {
2626
2797
  "name": "ExpectedCollateralNotEnough"
2798
+ },
2799
+ {
2800
+ "name": "AccessEntryAlreadyExists"
2801
+ },
2802
+ {
2803
+ "name": "AccessEntryNotFound"
2804
+ },
2805
+ {
2806
+ "name": "UnauthorizedWithdrawal"
2627
2807
  }
2628
2808
  ]
2629
2809
  }
@@ -2820,6 +3000,11 @@ var IDL = {
2820
3000
  "code": 6008,
2821
3001
  "name": "ForTesting",
2822
3002
  "msg": "TestError"
3003
+ },
3004
+ {
3005
+ "code": 6009,
3006
+ "name": "BlacklistedAccount",
3007
+ "msg": "Account is blacklisted"
2823
3008
  }
2824
3009
  ]
2825
3010
  };
@@ -2937,6 +3122,11 @@ var IDL2 = {
2937
3122
  "name": "tokenProgram",
2938
3123
  "isMut": false,
2939
3124
  "isSigner": false
3125
+ },
3126
+ {
3127
+ "name": "withdrawalAccessList",
3128
+ "isMut": false,
3129
+ "isSigner": false
2940
3130
  }
2941
3131
  ],
2942
3132
  "args": [
@@ -3911,6 +4101,74 @@ var IDL2 = {
3911
4101
  "type": "publicKey"
3912
4102
  }
3913
4103
  ]
4104
+ },
4105
+ {
4106
+ "name": "initWithdrawalAccessList",
4107
+ "accounts": [
4108
+ {
4109
+ "name": "withdrawalAccessList",
4110
+ "isMut": true,
4111
+ "isSigner": false
4112
+ },
4113
+ {
4114
+ "name": "authority",
4115
+ "isMut": true,
4116
+ "isSigner": true
4117
+ },
4118
+ {
4119
+ "name": "systemProgram",
4120
+ "isMut": false,
4121
+ "isSigner": false
4122
+ }
4123
+ ],
4124
+ "args": []
4125
+ },
4126
+ {
4127
+ "name": "addWithdrawalAccess",
4128
+ "accounts": [
4129
+ {
4130
+ "name": "withdrawalAccessList",
4131
+ "isMut": true,
4132
+ "isSigner": false
4133
+ },
4134
+ {
4135
+ "name": "nodeWallet",
4136
+ "isMut": false,
4137
+ "isSigner": false
4138
+ },
4139
+ {
4140
+ "name": "authority",
4141
+ "isMut": false,
4142
+ "isSigner": true
4143
+ }
4144
+ ],
4145
+ "args": [
4146
+ {
4147
+ "name": "toPubkey",
4148
+ "type": "publicKey"
4149
+ }
4150
+ ]
4151
+ },
4152
+ {
4153
+ "name": "removeWithdrawalAccess",
4154
+ "accounts": [
4155
+ {
4156
+ "name": "withdrawalAccessList",
4157
+ "isMut": true,
4158
+ "isSigner": false
4159
+ },
4160
+ {
4161
+ "name": "authority",
4162
+ "isMut": false,
4163
+ "isSigner": true
4164
+ }
4165
+ ],
4166
+ "args": [
4167
+ {
4168
+ "name": "fromPubkey",
4169
+ "type": "string"
4170
+ }
4171
+ ]
3914
4172
  }
3915
4173
  ],
3916
4174
  "accounts": [
@@ -4081,9 +4339,45 @@ var IDL2 = {
4081
4339
  }
4082
4340
  ]
4083
4341
  }
4342
+ },
4343
+ {
4344
+ "name": "withdrawalAccessList",
4345
+ "type": {
4346
+ "kind": "struct",
4347
+ "fields": [
4348
+ {
4349
+ "name": "authority",
4350
+ "type": "publicKey"
4351
+ },
4352
+ {
4353
+ "name": "accessEntries",
4354
+ "type": {
4355
+ "vec": {
4356
+ "defined": "WithdrawalAccessEntry"
4357
+ }
4358
+ }
4359
+ }
4360
+ ]
4361
+ }
4084
4362
  }
4085
4363
  ],
4086
4364
  "types": [
4365
+ {
4366
+ "name": "WithdrawalAccessEntry",
4367
+ "type": {
4368
+ "kind": "struct",
4369
+ "fields": [
4370
+ {
4371
+ "name": "fromPubkey",
4372
+ "type": "string"
4373
+ },
4374
+ {
4375
+ "name": "toPubkey",
4376
+ "type": "publicKey"
4377
+ }
4378
+ ]
4379
+ }
4380
+ },
4087
4381
  {
4088
4382
  "name": "LendingErrors",
4089
4383
  "docs": [
@@ -4115,6 +4409,15 @@ var IDL2 = {
4115
4409
  },
4116
4410
  {
4117
4411
  "name": "ExpectedCollateralNotEnough"
4412
+ },
4413
+ {
4414
+ "name": "AccessEntryAlreadyExists"
4415
+ },
4416
+ {
4417
+ "name": "AccessEntryNotFound"
4418
+ },
4419
+ {
4420
+ "name": "UnauthorizedWithdrawal"
4118
4421
  }
4119
4422
  ]
4120
4423
  }