@lavarage/sdk 6.9.5 → 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.mjs CHANGED
@@ -1056,10 +1056,13 @@ var updateMaxLendPerTokenBatchEvm = (_0, _1, _2) => __async(void 0, [_0, _1, _2]
1056
1056
  // lending.ts
1057
1057
  var lending_exports = {};
1058
1058
  __export(lending_exports, {
1059
+ addToWithdrawalAccessList: () => addToWithdrawalAccessList,
1059
1060
  createOffer: () => createOffer,
1060
1061
  depositFunds: () => depositFunds,
1061
1062
  getNodeWalletPDA: () => getNodeWalletPDA,
1062
1063
  getTradingPoolPDA: () => getTradingPoolPDA,
1064
+ getWithdrawalAccessListPDA: () => getWithdrawalAccessListPDA,
1065
+ removeFromWithdrawalAccessList: () => removeFromWithdrawalAccessList,
1063
1066
  updateInterestRate: () => updateInterestRate,
1064
1067
  updateMaxBorrow: () => updateMaxBorrow,
1065
1068
  updateMaxExposure: () => updateMaxExposure,
@@ -1105,6 +1108,14 @@ function getTradingPoolPDA(poolOwnerPublicKey, tokenPublicKey, programId) {
1105
1108
  programId
1106
1109
  );
1107
1110
  }
1111
+ function getWithdrawalAccessListPDA(programId) {
1112
+ return getPda(
1113
+ [
1114
+ Buffer.from("withdrawal_access_list")
1115
+ ],
1116
+ programId
1117
+ );
1118
+ }
1108
1119
  function createNodeWallet(lavarageProgram, params) {
1109
1120
  return __async(this, null, function* () {
1110
1121
  const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
@@ -1452,6 +1463,47 @@ function updateMaxBorrow(lavarageProgram, params) {
1452
1463
  return new VersionedTransaction(messageV0);
1453
1464
  });
1454
1465
  }
1466
+ function addToWithdrawalAccessList(lavarageProgram, params) {
1467
+ return __async(this, null, function* () {
1468
+ var _a;
1469
+ const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
1470
+ const withdrawalAccessList = getWithdrawalAccessListPDA(lavarageProgram.programId);
1471
+ const instruction = yield lavarageProgram.methods.addWithdrawalAccess(params.toPubkey).accounts({
1472
+ withdrawalAccessList,
1473
+ nodeWallet: params.nodeWallet,
1474
+ authority: params.authority
1475
+ }).instruction();
1476
+ const computeFeeIx = ComputeBudgetProgram.setComputeUnitPrice({
1477
+ microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
1478
+ });
1479
+ const messageV0 = new TransactionMessage({
1480
+ payerKey: lavarageProgram.provider.publicKey,
1481
+ recentBlockhash: blockhash,
1482
+ instructions: [instruction, computeFeeIx]
1483
+ }).compileToV0Message();
1484
+ return new VersionedTransaction(messageV0);
1485
+ });
1486
+ }
1487
+ function removeFromWithdrawalAccessList(lavarageProgram, params) {
1488
+ return __async(this, null, function* () {
1489
+ var _a;
1490
+ const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
1491
+ const withdrawalAccessList = getWithdrawalAccessListPDA(lavarageProgram.programId);
1492
+ const instruction = yield lavarageProgram.methods.removeWithdrawalAccess(params.nodeWallet).accounts({
1493
+ withdrawalAccessList,
1494
+ authority: params.authority
1495
+ }).instruction();
1496
+ const computeFeeIx = ComputeBudgetProgram.setComputeUnitPrice({
1497
+ microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
1498
+ });
1499
+ const messageV0 = new TransactionMessage({
1500
+ payerKey: lavarageProgram.provider.publicKey,
1501
+ recentBlockhash: blockhash,
1502
+ instructions: [instruction, computeFeeIx]
1503
+ }).compileToV0Message();
1504
+ return new VersionedTransaction(messageV0);
1505
+ });
1506
+ }
1455
1507
 
1456
1508
  // idl/lavarage.ts
1457
1509
  var IDL = {
@@ -1558,6 +1610,11 @@ var IDL = {
1558
1610
  "name": "systemProgram",
1559
1611
  "isMut": false,
1560
1612
  "isSigner": false
1613
+ },
1614
+ {
1615
+ "name": "withdrawalAccessList",
1616
+ "isMut": false,
1617
+ "isSigner": false
1561
1618
  }
1562
1619
  ],
1563
1620
  "args": [
@@ -1690,7 +1747,7 @@ var IDL = {
1690
1747
  },
1691
1748
  {
1692
1749
  "name": "toTokenAccount",
1693
- "isMut": true,
1750
+ "isMut": false,
1694
1751
  "isSigner": false
1695
1752
  },
1696
1753
  {
@@ -1761,7 +1818,7 @@ var IDL = {
1761
1818
  },
1762
1819
  {
1763
1820
  "name": "toTokenAccount",
1764
- "isMut": true,
1821
+ "isMut": false,
1765
1822
  "isSigner": false
1766
1823
  },
1767
1824
  {
@@ -2254,6 +2311,11 @@ var IDL = {
2254
2311
  "name": "systemProgram",
2255
2312
  "isMut": false,
2256
2313
  "isSigner": false
2314
+ },
2315
+ {
2316
+ "name": "mint",
2317
+ "isMut": false,
2318
+ "isSigner": false
2257
2319
  }
2258
2320
  ],
2259
2321
  "args": [
@@ -2320,6 +2382,11 @@ var IDL = {
2320
2382
  "name": "systemProgram",
2321
2383
  "isMut": false,
2322
2384
  "isSigner": false
2385
+ },
2386
+ {
2387
+ "name": "qtMint",
2388
+ "isMut": false,
2389
+ "isSigner": false
2323
2390
  }
2324
2391
  ],
2325
2392
  "args": [
@@ -2397,6 +2464,74 @@ var IDL = {
2397
2464
  "type": "publicKey"
2398
2465
  }
2399
2466
  ]
2467
+ },
2468
+ {
2469
+ "name": "initWithdrawalAccessList",
2470
+ "accounts": [
2471
+ {
2472
+ "name": "withdrawalAccessList",
2473
+ "isMut": true,
2474
+ "isSigner": false
2475
+ },
2476
+ {
2477
+ "name": "authority",
2478
+ "isMut": true,
2479
+ "isSigner": true
2480
+ },
2481
+ {
2482
+ "name": "systemProgram",
2483
+ "isMut": false,
2484
+ "isSigner": false
2485
+ }
2486
+ ],
2487
+ "args": []
2488
+ },
2489
+ {
2490
+ "name": "addWithdrawalAccess",
2491
+ "accounts": [
2492
+ {
2493
+ "name": "withdrawalAccessList",
2494
+ "isMut": true,
2495
+ "isSigner": false
2496
+ },
2497
+ {
2498
+ "name": "nodeWallet",
2499
+ "isMut": false,
2500
+ "isSigner": false
2501
+ },
2502
+ {
2503
+ "name": "authority",
2504
+ "isMut": false,
2505
+ "isSigner": true
2506
+ }
2507
+ ],
2508
+ "args": [
2509
+ {
2510
+ "name": "toPubkey",
2511
+ "type": "publicKey"
2512
+ }
2513
+ ]
2514
+ },
2515
+ {
2516
+ "name": "removeWithdrawalAccess",
2517
+ "accounts": [
2518
+ {
2519
+ "name": "withdrawalAccessList",
2520
+ "isMut": true,
2521
+ "isSigner": false
2522
+ },
2523
+ {
2524
+ "name": "authority",
2525
+ "isMut": false,
2526
+ "isSigner": true
2527
+ }
2528
+ ],
2529
+ "args": [
2530
+ {
2531
+ "name": "fromPubkey",
2532
+ "type": "string"
2533
+ }
2534
+ ]
2400
2535
  }
2401
2536
  ],
2402
2537
  "accounts": [
@@ -2559,9 +2694,45 @@ var IDL = {
2559
2694
  }
2560
2695
  ]
2561
2696
  }
2697
+ },
2698
+ {
2699
+ "name": "withdrawalAccessList",
2700
+ "type": {
2701
+ "kind": "struct",
2702
+ "fields": [
2703
+ {
2704
+ "name": "authority",
2705
+ "type": "publicKey"
2706
+ },
2707
+ {
2708
+ "name": "accessEntries",
2709
+ "type": {
2710
+ "vec": {
2711
+ "defined": "WithdrawalAccessEntry"
2712
+ }
2713
+ }
2714
+ }
2715
+ ]
2716
+ }
2562
2717
  }
2563
2718
  ],
2564
2719
  "types": [
2720
+ {
2721
+ "name": "WithdrawalAccessEntry",
2722
+ "type": {
2723
+ "kind": "struct",
2724
+ "fields": [
2725
+ {
2726
+ "name": "fromPubkey",
2727
+ "type": "string"
2728
+ },
2729
+ {
2730
+ "name": "toPubkey",
2731
+ "type": "publicKey"
2732
+ }
2733
+ ]
2734
+ }
2735
+ },
2565
2736
  {
2566
2737
  "name": "LendingErrors",
2567
2738
  "docs": [
@@ -2593,6 +2764,15 @@ var IDL = {
2593
2764
  },
2594
2765
  {
2595
2766
  "name": "ExpectedCollateralNotEnough"
2767
+ },
2768
+ {
2769
+ "name": "AccessEntryAlreadyExists"
2770
+ },
2771
+ {
2772
+ "name": "AccessEntryNotFound"
2773
+ },
2774
+ {
2775
+ "name": "UnauthorizedWithdrawal"
2596
2776
  }
2597
2777
  ]
2598
2778
  }
@@ -2789,6 +2969,11 @@ var IDL = {
2789
2969
  "code": 6008,
2790
2970
  "name": "ForTesting",
2791
2971
  "msg": "TestError"
2972
+ },
2973
+ {
2974
+ "code": 6009,
2975
+ "name": "BlacklistedAccount",
2976
+ "msg": "Account is blacklisted"
2792
2977
  }
2793
2978
  ]
2794
2979
  };
@@ -2906,6 +3091,11 @@ var IDL2 = {
2906
3091
  "name": "tokenProgram",
2907
3092
  "isMut": false,
2908
3093
  "isSigner": false
3094
+ },
3095
+ {
3096
+ "name": "withdrawalAccessList",
3097
+ "isMut": false,
3098
+ "isSigner": false
2909
3099
  }
2910
3100
  ],
2911
3101
  "args": [
@@ -3880,6 +4070,74 @@ var IDL2 = {
3880
4070
  "type": "publicKey"
3881
4071
  }
3882
4072
  ]
4073
+ },
4074
+ {
4075
+ "name": "initWithdrawalAccessList",
4076
+ "accounts": [
4077
+ {
4078
+ "name": "withdrawalAccessList",
4079
+ "isMut": true,
4080
+ "isSigner": false
4081
+ },
4082
+ {
4083
+ "name": "authority",
4084
+ "isMut": true,
4085
+ "isSigner": true
4086
+ },
4087
+ {
4088
+ "name": "systemProgram",
4089
+ "isMut": false,
4090
+ "isSigner": false
4091
+ }
4092
+ ],
4093
+ "args": []
4094
+ },
4095
+ {
4096
+ "name": "addWithdrawalAccess",
4097
+ "accounts": [
4098
+ {
4099
+ "name": "withdrawalAccessList",
4100
+ "isMut": true,
4101
+ "isSigner": false
4102
+ },
4103
+ {
4104
+ "name": "nodeWallet",
4105
+ "isMut": false,
4106
+ "isSigner": false
4107
+ },
4108
+ {
4109
+ "name": "authority",
4110
+ "isMut": false,
4111
+ "isSigner": true
4112
+ }
4113
+ ],
4114
+ "args": [
4115
+ {
4116
+ "name": "toPubkey",
4117
+ "type": "publicKey"
4118
+ }
4119
+ ]
4120
+ },
4121
+ {
4122
+ "name": "removeWithdrawalAccess",
4123
+ "accounts": [
4124
+ {
4125
+ "name": "withdrawalAccessList",
4126
+ "isMut": true,
4127
+ "isSigner": false
4128
+ },
4129
+ {
4130
+ "name": "authority",
4131
+ "isMut": false,
4132
+ "isSigner": true
4133
+ }
4134
+ ],
4135
+ "args": [
4136
+ {
4137
+ "name": "fromPubkey",
4138
+ "type": "string"
4139
+ }
4140
+ ]
3883
4141
  }
3884
4142
  ],
3885
4143
  "accounts": [
@@ -4050,9 +4308,45 @@ var IDL2 = {
4050
4308
  }
4051
4309
  ]
4052
4310
  }
4311
+ },
4312
+ {
4313
+ "name": "withdrawalAccessList",
4314
+ "type": {
4315
+ "kind": "struct",
4316
+ "fields": [
4317
+ {
4318
+ "name": "authority",
4319
+ "type": "publicKey"
4320
+ },
4321
+ {
4322
+ "name": "accessEntries",
4323
+ "type": {
4324
+ "vec": {
4325
+ "defined": "WithdrawalAccessEntry"
4326
+ }
4327
+ }
4328
+ }
4329
+ ]
4330
+ }
4053
4331
  }
4054
4332
  ],
4055
4333
  "types": [
4334
+ {
4335
+ "name": "WithdrawalAccessEntry",
4336
+ "type": {
4337
+ "kind": "struct",
4338
+ "fields": [
4339
+ {
4340
+ "name": "fromPubkey",
4341
+ "type": "string"
4342
+ },
4343
+ {
4344
+ "name": "toPubkey",
4345
+ "type": "publicKey"
4346
+ }
4347
+ ]
4348
+ }
4349
+ },
4056
4350
  {
4057
4351
  "name": "LendingErrors",
4058
4352
  "docs": [
@@ -4084,6 +4378,15 @@ var IDL2 = {
4084
4378
  },
4085
4379
  {
4086
4380
  "name": "ExpectedCollateralNotEnough"
4381
+ },
4382
+ {
4383
+ "name": "AccessEntryAlreadyExists"
4384
+ },
4385
+ {
4386
+ "name": "AccessEntryNotFound"
4387
+ },
4388
+ {
4389
+ "name": "UnauthorizedWithdrawal"
4087
4390
  }
4088
4391
  ]
4089
4392
  }