@wuwei-labs/srsly 3.0.0-beta.19 → 3.0.0-beta.20
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/cjs/accounts/member.js +2 -1
- package/dist/cjs/accounts/member.js.map +1 -1
- package/dist/cjs/accounts/owner.js +105 -0
- package/dist/cjs/accounts/owner.js.map +1 -0
- package/dist/cjs/demos.js +85 -9
- package/dist/cjs/demos.js.map +1 -1
- package/dist/cjs/generated/codama/accounts/borrowerState.js +0 -4
- package/dist/cjs/generated/codama/accounts/borrowerState.js.map +1 -1
- package/dist/cjs/generated/codama/accounts/configState.js +0 -2
- package/dist/cjs/generated/codama/accounts/configState.js.map +1 -1
- package/dist/cjs/generated/codama/accounts/contractState.js +4 -2
- package/dist/cjs/generated/codama/accounts/contractState.js.map +1 -1
- package/dist/cjs/generated/codama/accounts/index.js +1 -0
- package/dist/cjs/generated/codama/accounts/index.js.map +1 -1
- package/dist/cjs/generated/codama/accounts/ownerState.js +86 -0
- package/dist/cjs/generated/codama/accounts/ownerState.js.map +1 -0
- package/dist/cjs/generated/codama/errors/srsly.js +26 -29
- package/dist/cjs/generated/codama/errors/srsly.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/claimBorrower.js +24 -11
- package/dist/cjs/generated/codama/instructions/claimBorrower.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/{claimContractPayments.js → claimOwner.js} +58 -44
- package/dist/cjs/generated/codama/instructions/claimOwner.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/closeContract.js +10 -78
- package/dist/cjs/generated/codama/instructions/closeContract.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/closeRental.js +15 -15
- package/dist/cjs/generated/codama/instructions/closeRental.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/createContract.js +25 -11
- package/dist/cjs/generated/codama/instructions/createContract.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/index.js +2 -4
- package/dist/cjs/generated/codama/instructions/index.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/payRental.js +12 -12
- package/dist/cjs/generated/codama/instructions/payRental.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/reserveRental.js +27 -8
- package/dist/cjs/generated/codama/instructions/reserveRental.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/updateConfig.js +0 -2
- package/dist/cjs/generated/codama/instructions/updateConfig.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/updateOwner.js +79 -0
- package/dist/cjs/generated/codama/instructions/updateOwner.js.map +1 -0
- package/dist/cjs/generated/codama/programs/srsly.js +29 -33
- package/dist/cjs/generated/codama/programs/srsly.js.map +1 -1
- package/dist/cjs/generated/codama/types/index.js +0 -1
- package/dist/cjs/generated/codama/types/index.js.map +1 -1
- package/dist/cjs/index.js +17 -11
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/instructions/acceptRental.js +2 -2
- package/dist/cjs/instructions/acceptRental.js.map +1 -1
- package/dist/cjs/instructions/cancelRental.js +4 -2
- package/dist/cjs/instructions/cancelRental.js.map +1 -1
- package/dist/cjs/instructions/claimBorrower.js +7 -3
- package/dist/cjs/instructions/claimBorrower.js.map +1 -1
- package/dist/cjs/instructions/claimRental.js +2 -2
- package/dist/cjs/instructions/claimRental.js.map +1 -1
- package/dist/cjs/instructions/closeContract.js +4 -3
- package/dist/cjs/instructions/closeContract.js.map +1 -1
- package/dist/cjs/instructions/closeRental.js +8 -4
- package/dist/cjs/instructions/closeRental.js.map +1 -1
- package/dist/cjs/instructions/createContract.js +4 -2
- package/dist/cjs/instructions/createContract.js.map +1 -1
- package/dist/cjs/instructions/deleteConfig.js +15 -4
- package/dist/cjs/instructions/deleteConfig.js.map +1 -1
- package/dist/cjs/instructions/index.js +5 -9
- package/dist/cjs/instructions/index.js.map +1 -1
- package/dist/cjs/instructions/ownerClaim.js +110 -0
- package/dist/cjs/instructions/ownerClaim.js.map +1 -0
- package/dist/cjs/instructions/ownerUpdate.js +68 -0
- package/dist/cjs/instructions/ownerUpdate.js.map +1 -0
- package/dist/cjs/instructions/reserveRental.js +6 -5
- package/dist/cjs/instructions/reserveRental.js.map +1 -1
- package/dist/cjs/instructions/updateBorrower.js +4 -2
- package/dist/cjs/instructions/updateBorrower.js.map +1 -1
- package/dist/cjs/instructions/updateConfig.js +0 -1
- package/dist/cjs/instructions/updateConfig.js.map +1 -1
- package/dist/cjs/legacy/index.js +6 -5
- package/dist/cjs/legacy/index.js.map +1 -1
- package/dist/cjs/package.json +3 -2
- package/dist/cjs/pda/constants.js +2 -1
- package/dist/cjs/pda/constants.js.map +1 -1
- package/dist/cjs/pda/index.js +3 -1
- package/dist/cjs/pda/index.js.map +1 -1
- package/dist/cjs/pda/srsly.js +21 -0
- package/dist/cjs/pda/srsly.js.map +1 -1
- package/dist/cjs/utils/addresses.js +1 -1
- package/dist/cjs/utils/addresses.js.map +1 -1
- package/dist/cjs/utils/signer.js +8 -8
- package/dist/cjs/utils/signer.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/accounts/member.js +1 -1
- package/dist/esm/accounts/member.js.map +1 -1
- package/dist/esm/accounts/owner.js +101 -0
- package/dist/esm/accounts/owner.js.map +1 -0
- package/dist/esm/demos.js +84 -8
- package/dist/esm/demos.js.map +1 -1
- package/dist/esm/generated/codama/accounts/borrowerState.js +0 -4
- package/dist/esm/generated/codama/accounts/borrowerState.js.map +1 -1
- package/dist/esm/generated/codama/accounts/configState.js +0 -2
- package/dist/esm/generated/codama/accounts/configState.js.map +1 -1
- package/dist/esm/generated/codama/accounts/contractState.js +4 -2
- package/dist/esm/generated/codama/accounts/contractState.js.map +1 -1
- package/dist/esm/generated/codama/accounts/index.js +1 -0
- package/dist/esm/generated/codama/accounts/index.js.map +1 -1
- package/dist/esm/generated/codama/accounts/ownerState.js +73 -0
- package/dist/esm/generated/codama/accounts/ownerState.js.map +1 -0
- package/dist/esm/generated/codama/errors/srsly.js +25 -28
- package/dist/esm/generated/codama/errors/srsly.js.map +1 -1
- package/dist/esm/generated/codama/instructions/claimBorrower.js +25 -12
- package/dist/esm/generated/codama/instructions/claimBorrower.js.map +1 -1
- package/dist/esm/generated/codama/instructions/{claimContractPayments.js → claimOwner.js} +51 -37
- package/dist/esm/generated/codama/instructions/claimOwner.js.map +1 -0
- package/dist/esm/generated/codama/instructions/closeContract.js +10 -78
- package/dist/esm/generated/codama/instructions/closeContract.js.map +1 -1
- package/dist/esm/generated/codama/instructions/closeRental.js +15 -15
- package/dist/esm/generated/codama/instructions/closeRental.js.map +1 -1
- package/dist/esm/generated/codama/instructions/createContract.js +25 -11
- package/dist/esm/generated/codama/instructions/createContract.js.map +1 -1
- package/dist/esm/generated/codama/instructions/index.js +2 -4
- package/dist/esm/generated/codama/instructions/index.js.map +1 -1
- package/dist/esm/generated/codama/instructions/payRental.js +12 -12
- package/dist/esm/generated/codama/instructions/payRental.js.map +1 -1
- package/dist/esm/generated/codama/instructions/reserveRental.js +27 -8
- package/dist/esm/generated/codama/instructions/reserveRental.js.map +1 -1
- package/dist/esm/generated/codama/instructions/updateConfig.js +0 -2
- package/dist/esm/generated/codama/instructions/updateConfig.js.map +1 -1
- package/dist/esm/generated/codama/instructions/updateOwner.js +70 -0
- package/dist/esm/generated/codama/instructions/updateOwner.js.map +1 -0
- package/dist/esm/generated/codama/programs/srsly.js +29 -33
- package/dist/esm/generated/codama/programs/srsly.js.map +1 -1
- package/dist/esm/generated/codama/types/index.js +0 -1
- package/dist/esm/generated/codama/types/index.js.map +1 -1
- package/dist/esm/index.js +10 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/instructions/acceptRental.js +2 -2
- package/dist/esm/instructions/acceptRental.js.map +1 -1
- package/dist/esm/instructions/cancelRental.js +4 -2
- package/dist/esm/instructions/cancelRental.js.map +1 -1
- package/dist/esm/instructions/claimBorrower.js +8 -4
- package/dist/esm/instructions/claimBorrower.js.map +1 -1
- package/dist/esm/instructions/claimRental.js +2 -2
- package/dist/esm/instructions/claimRental.js.map +1 -1
- package/dist/esm/instructions/closeContract.js +4 -3
- package/dist/esm/instructions/closeContract.js.map +1 -1
- package/dist/esm/instructions/closeRental.js +9 -5
- package/dist/esm/instructions/closeRental.js.map +1 -1
- package/dist/esm/instructions/createContract.js +4 -2
- package/dist/esm/instructions/createContract.js.map +1 -1
- package/dist/esm/instructions/deleteConfig.js +15 -4
- package/dist/esm/instructions/deleteConfig.js.map +1 -1
- package/dist/esm/instructions/index.js +2 -4
- package/dist/esm/instructions/index.js.map +1 -1
- package/dist/esm/instructions/ownerClaim.js +107 -0
- package/dist/esm/instructions/ownerClaim.js.map +1 -0
- package/dist/esm/instructions/ownerUpdate.js +65 -0
- package/dist/esm/instructions/ownerUpdate.js.map +1 -0
- package/dist/esm/instructions/reserveRental.js +7 -6
- package/dist/esm/instructions/reserveRental.js.map +1 -1
- package/dist/esm/instructions/updateBorrower.js +4 -2
- package/dist/esm/instructions/updateBorrower.js.map +1 -1
- package/dist/esm/instructions/updateConfig.js +0 -1
- package/dist/esm/instructions/updateConfig.js.map +1 -1
- package/dist/esm/legacy/index.js +5 -4
- package/dist/esm/legacy/index.js.map +1 -1
- package/dist/esm/package.json +3 -2
- package/dist/esm/pda/constants.js +1 -0
- package/dist/esm/pda/constants.js.map +1 -1
- package/dist/esm/pda/index.js +2 -2
- package/dist/esm/pda/index.js.map +1 -1
- package/dist/esm/pda/srsly.js +21 -1
- package/dist/esm/pda/srsly.js.map +1 -1
- package/dist/esm/utils/addresses.js +1 -1
- package/dist/esm/utils/addresses.js.map +1 -1
- package/dist/esm/utils/signer.js +8 -8
- package/dist/esm/utils/signer.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/idl/srsly.json +662 -806
- package/dist/types/accounts/member.d.ts +1 -1
- package/dist/types/accounts/member.d.ts.map +1 -1
- package/dist/types/accounts/owner.d.ts +52 -0
- package/dist/types/accounts/owner.d.ts.map +1 -0
- package/dist/types/demos.d.ts +14 -2
- package/dist/types/demos.d.ts.map +1 -1
- package/dist/types/generated/codama/accounts/borrowerState.d.ts +0 -8
- package/dist/types/generated/codama/accounts/borrowerState.d.ts.map +1 -1
- package/dist/types/generated/codama/accounts/configState.d.ts +0 -4
- package/dist/types/generated/codama/accounts/configState.d.ts.map +1 -1
- package/dist/types/generated/codama/accounts/contractState.d.ts +8 -4
- package/dist/types/generated/codama/accounts/contractState.d.ts.map +1 -1
- package/dist/types/generated/codama/accounts/index.d.ts +1 -0
- package/dist/types/generated/codama/accounts/index.d.ts.map +1 -1
- package/dist/types/generated/codama/accounts/ownerState.d.ts +65 -0
- package/dist/types/generated/codama/accounts/ownerState.d.ts.map +1 -0
- package/dist/types/generated/codama/errors/srsly.d.ts +26 -28
- package/dist/types/generated/codama/errors/srsly.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/claimBorrower.d.ts +31 -19
- package/dist/types/generated/codama/instructions/claimBorrower.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/claimOwner.d.ts +91 -0
- package/dist/types/generated/codama/instructions/claimOwner.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/closeContract.d.ts +15 -27
- package/dist/types/generated/codama/instructions/closeContract.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/closeRental.d.ts +18 -15
- package/dist/types/generated/codama/instructions/closeRental.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/createContract.d.ts +20 -16
- package/dist/types/generated/codama/instructions/createContract.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/index.d.ts +2 -4
- package/dist/types/generated/codama/instructions/index.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/payRental.d.ts +22 -22
- package/dist/types/generated/codama/instructions/payRental.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/reserveRental.d.ts +21 -17
- package/dist/types/generated/codama/instructions/reserveRental.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/updateConfig.d.ts +0 -6
- package/dist/types/generated/codama/instructions/updateConfig.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/updateOwner.d.ts +44 -0
- package/dist/types/generated/codama/instructions/updateOwner.d.ts.map +1 -0
- package/dist/types/generated/codama/programs/srsly.d.ts +27 -32
- package/dist/types/generated/codama/programs/srsly.d.ts.map +1 -1
- package/dist/types/generated/codama/types/index.d.ts +0 -1
- package/dist/types/generated/codama/types/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +6 -7
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/instructions/cancelRental.d.ts.map +1 -1
- package/dist/types/instructions/claimBorrower.d.ts +6 -0
- package/dist/types/instructions/claimBorrower.d.ts.map +1 -1
- package/dist/types/instructions/closeContract.d.ts.map +1 -1
- package/dist/types/instructions/closeRental.d.ts.map +1 -1
- package/dist/types/instructions/createContract.d.ts.map +1 -1
- package/dist/types/instructions/deleteConfig.d.ts +4 -2
- package/dist/types/instructions/deleteConfig.d.ts.map +1 -1
- package/dist/types/instructions/index.d.ts +2 -4
- package/dist/types/instructions/index.d.ts.map +1 -1
- package/dist/types/instructions/ownerClaim.d.ts +72 -0
- package/dist/types/instructions/ownerClaim.d.ts.map +1 -0
- package/dist/types/instructions/ownerUpdate.d.ts +57 -0
- package/dist/types/instructions/ownerUpdate.d.ts.map +1 -0
- package/dist/types/instructions/reserveRental.d.ts.map +1 -1
- package/dist/types/instructions/updateBorrower.d.ts.map +1 -1
- package/dist/types/instructions/updateConfig.d.ts.map +1 -1
- package/dist/types/legacy/index.d.ts +7 -8
- package/dist/types/legacy/index.d.ts.map +1 -1
- package/dist/types/pda/constants.d.ts +1 -0
- package/dist/types/pda/constants.d.ts.map +1 -1
- package/dist/types/pda/index.d.ts +2 -2
- package/dist/types/pda/index.d.ts.map +1 -1
- package/dist/types/pda/srsly.d.ts +7 -0
- package/dist/types/pda/srsly.d.ts.map +1 -1
- package/dist/types/utils/addresses.d.ts +5 -1
- package/dist/types/utils/addresses.d.ts.map +1 -1
- package/dist/types/utils/signer.d.ts +2 -2
- package/dist/types/utils/signer.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +25 -19
- package/dist/cjs/generated/codama/instructions/claimContractPayments.js.map +0 -1
- package/dist/cjs/generated/codama/instructions/closeBorrower.js +0 -84
- package/dist/cjs/generated/codama/instructions/closeBorrower.js.map +0 -1
- package/dist/cjs/generated/codama/instructions/deleteBorrower.js +0 -126
- package/dist/cjs/generated/codama/instructions/deleteBorrower.js.map +0 -1
- package/dist/cjs/generated/codama/instructions/discountBorrower.js +0 -118
- package/dist/cjs/generated/codama/instructions/discountBorrower.js.map +0 -1
- package/dist/cjs/generated/codama/types/borrowerDiscountSet.js +0 -29
- package/dist/cjs/generated/codama/types/borrowerDiscountSet.js.map +0 -1
- package/dist/cjs/instructions/claimContractPayments.js +0 -79
- package/dist/cjs/instructions/claimContractPayments.js.map +0 -1
- package/dist/cjs/instructions/closeBorrower.js +0 -60
- package/dist/cjs/instructions/closeBorrower.js.map +0 -1
- package/dist/cjs/instructions/deleteBorrower.js +0 -60
- package/dist/cjs/instructions/deleteBorrower.js.map +0 -1
- package/dist/cjs/instructions/discountBorrower.js +0 -76
- package/dist/cjs/instructions/discountBorrower.js.map +0 -1
- package/dist/esm/generated/codama/instructions/claimContractPayments.js.map +0 -1
- package/dist/esm/generated/codama/instructions/closeBorrower.js +0 -75
- package/dist/esm/generated/codama/instructions/closeBorrower.js.map +0 -1
- package/dist/esm/generated/codama/instructions/deleteBorrower.js +0 -116
- package/dist/esm/generated/codama/instructions/deleteBorrower.js.map +0 -1
- package/dist/esm/generated/codama/instructions/discountBorrower.js +0 -108
- package/dist/esm/generated/codama/instructions/discountBorrower.js.map +0 -1
- package/dist/esm/generated/codama/types/borrowerDiscountSet.js +0 -24
- package/dist/esm/generated/codama/types/borrowerDiscountSet.js.map +0 -1
- package/dist/esm/instructions/claimContractPayments.js +0 -76
- package/dist/esm/instructions/claimContractPayments.js.map +0 -1
- package/dist/esm/instructions/closeBorrower.js +0 -57
- package/dist/esm/instructions/closeBorrower.js.map +0 -1
- package/dist/esm/instructions/deleteBorrower.js +0 -57
- package/dist/esm/instructions/deleteBorrower.js.map +0 -1
- package/dist/esm/instructions/discountBorrower.js +0 -73
- package/dist/esm/instructions/discountBorrower.js.map +0 -1
- package/dist/types/generated/codama/instructions/claimContractPayments.d.ts +0 -98
- package/dist/types/generated/codama/instructions/claimContractPayments.d.ts.map +0 -1
- package/dist/types/generated/codama/instructions/closeBorrower.d.ts +0 -43
- package/dist/types/generated/codama/instructions/closeBorrower.d.ts.map +0 -1
- package/dist/types/generated/codama/instructions/deleteBorrower.d.ts +0 -55
- package/dist/types/generated/codama/instructions/deleteBorrower.d.ts.map +0 -1
- package/dist/types/generated/codama/instructions/discountBorrower.d.ts +0 -56
- package/dist/types/generated/codama/instructions/discountBorrower.d.ts.map +0 -1
- package/dist/types/generated/codama/types/borrowerDiscountSet.d.ts +0 -20
- package/dist/types/generated/codama/types/borrowerDiscountSet.d.ts.map +0 -1
- package/dist/types/instructions/claimContractPayments.d.ts +0 -78
- package/dist/types/instructions/claimContractPayments.d.ts.map +0 -1
- package/dist/types/instructions/closeBorrower.d.ts +0 -45
- package/dist/types/instructions/closeBorrower.d.ts.map +0 -1
- package/dist/types/instructions/deleteBorrower.d.ts +0 -53
- package/dist/types/instructions/deleteBorrower.d.ts.map +0 -1
- package/dist/types/instructions/discountBorrower.d.ts +0 -64
- package/dist/types/instructions/discountBorrower.d.ts.map +0 -1
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @purpose Simplified claimContractPayments instruction wrapper
|
|
4
|
-
*
|
|
5
|
-
* Thin convenience wrapper around Codama-generated claimContractPayments instruction.
|
|
6
|
-
* Allows contract owners to claim accumulated rental payments.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.claimContractPayments = claimContractPayments;
|
|
10
|
-
const kit_1 = require("@solana/kit");
|
|
11
|
-
const instructions_1 = require("../generated/codama/instructions");
|
|
12
|
-
const config_1 = require("../utils/config");
|
|
13
|
-
const signer_1 = require("../utils/signer");
|
|
14
|
-
const instructions_2 = require("../utils/instructions");
|
|
15
|
-
/**
|
|
16
|
-
* Claim contract payments
|
|
17
|
-
*
|
|
18
|
-
* Allows the contract owner to claim accumulated rental payments from
|
|
19
|
-
* the contract's token account to their destination account.
|
|
20
|
-
* Can be automated via Antegen by creating a thread with authority as the contract owner.
|
|
21
|
-
*
|
|
22
|
-
* @param params - Payment claim parameters
|
|
23
|
-
* @param config - Optional SDK configuration overrides
|
|
24
|
-
* @returns Kit instruction (or web3.js if PublicKey in config)
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* // Manual claim (owner signs as payer)
|
|
29
|
-
* const ix = await claimContractPayments({
|
|
30
|
-
* payer: ownerWallet,
|
|
31
|
-
* owner: ownerWallet.address,
|
|
32
|
-
* contract: contractAddress
|
|
33
|
-
* });
|
|
34
|
-
*
|
|
35
|
-
* // Automated claim via Antegen thread
|
|
36
|
-
* const ix2 = await claimContractPayments({
|
|
37
|
-
* payer: threadSigner,
|
|
38
|
-
* owner: ownerAddress,
|
|
39
|
-
* contract: contractAddress,
|
|
40
|
-
* claimThread: threadAddress
|
|
41
|
-
* });
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
async function claimContractPayments(params, config) {
|
|
45
|
-
// Merge config
|
|
46
|
-
const finalConfig = (0, config_1.mergeConfig)(config);
|
|
47
|
-
// Validate required params
|
|
48
|
-
if (!params.payer) {
|
|
49
|
-
throw new Error('payer is required');
|
|
50
|
-
}
|
|
51
|
-
if (!params.owner) {
|
|
52
|
-
throw new Error('owner is required');
|
|
53
|
-
}
|
|
54
|
-
if (!params.contract) {
|
|
55
|
-
throw new Error('contract is required');
|
|
56
|
-
}
|
|
57
|
-
// Convert payer to transaction signer
|
|
58
|
-
const payerSigner = (0, signer_1.toTransactionSigner)(params.payer);
|
|
59
|
-
// Get network-specific addresses
|
|
60
|
-
const addresses = (0, config_1.getAddresses)(config);
|
|
61
|
-
const atlasMint = (0, kit_1.address)(addresses.atlasMint);
|
|
62
|
-
const programAddress = (0, kit_1.address)(addresses.srsly);
|
|
63
|
-
// Call Codama-generated instruction
|
|
64
|
-
const kitInstruction = await (0, instructions_1.getClaimContractPaymentsInstructionAsync)({
|
|
65
|
-
payer: payerSigner,
|
|
66
|
-
mint: atlasMint,
|
|
67
|
-
owner: (0, kit_1.address)(params.owner),
|
|
68
|
-
contract: (0, kit_1.address)(params.contract),
|
|
69
|
-
destinationTokenAccount: params.destinationTokenAccount
|
|
70
|
-
? (0, kit_1.address)(params.destinationTokenAccount)
|
|
71
|
-
: undefined,
|
|
72
|
-
claimThread: params.claimThread ? (0, kit_1.address)(params.claimThread) : undefined,
|
|
73
|
-
}, { programAddress });
|
|
74
|
-
return (0, instructions_2.prepareInstructions)(kitInstruction, {
|
|
75
|
-
computeUnits: params.computeUnits,
|
|
76
|
-
PublicKey: finalConfig.PublicKey
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=claimContractPayments.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claimContractPayments.js","sourceRoot":"","sources":["../../../src/instructions/claimContractPayments.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAiFH,sDA6CC;AA5HD,qCAAoD;AACpD,mEAA4F;AAC5F,4CAA4E;AAC5E,4CAA4E;AAE5E,wDAA4D;AA6C5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACI,KAAK,UAAU,qBAAqB,CACzC,MAAmC,EACnC,MAA2B;IAE3B,eAAe;IACf,MAAM,WAAW,GAAG,IAAA,oBAAW,EAAC,MAAM,CAAC,CAAC;IAExC,2BAA2B;IAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,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
3
|
-
* @purpose Simplified closeBorrower instruction wrapper
|
|
4
|
-
*
|
|
5
|
-
* Thin convenience wrapper around Codama-generated closeBorrower instruction.
|
|
6
|
-
* Closes the borrower account and reclaims rent.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.closeBorrower = closeBorrower;
|
|
10
|
-
const kit_1 = require("@solana/kit");
|
|
11
|
-
const instructions_1 = require("../generated/codama/instructions");
|
|
12
|
-
const config_1 = require("../utils/config");
|
|
13
|
-
const signer_1 = require("../utils/signer");
|
|
14
|
-
const instructions_2 = require("../utils/instructions");
|
|
15
|
-
const srsly_1 = require("../pda/srsly");
|
|
16
|
-
/**
|
|
17
|
-
* Close borrower account
|
|
18
|
-
*
|
|
19
|
-
* Closes the borrower account and reclaims rent.
|
|
20
|
-
*
|
|
21
|
-
* This function automatically derives the borrower state PDA.
|
|
22
|
-
*
|
|
23
|
-
* @param params - Close borrower parameters
|
|
24
|
-
* @param config - Optional SDK configuration overrides
|
|
25
|
-
* @returns Kit instruction (or web3.js if PublicKey in config)
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* // Close borrower account
|
|
30
|
-
* const ix = await closeBorrower({
|
|
31
|
-
* borrower: borrowerWallet
|
|
32
|
-
* });
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
async function closeBorrower(params, config) {
|
|
36
|
-
// Merge config
|
|
37
|
-
const finalConfig = (0, config_1.mergeConfig)(config);
|
|
38
|
-
// Validate required params
|
|
39
|
-
if (!params.borrower) {
|
|
40
|
-
throw new Error('borrower is required');
|
|
41
|
-
}
|
|
42
|
-
// Convert borrower to transaction signer
|
|
43
|
-
const borrowerSigner = (0, signer_1.toTransactionSigner)(params.borrower);
|
|
44
|
-
const borrowerAddress = (0, signer_1.getSignerAddress)(borrowerSigner);
|
|
45
|
-
// Get network-specific addresses
|
|
46
|
-
const addresses = (0, config_1.getAddresses)(config);
|
|
47
|
-
const programAddress = (0, kit_1.address)(addresses.srsly);
|
|
48
|
-
// Derive borrower state PDA
|
|
49
|
-
const borrowerState = await (0, srsly_1.deriveBorrowerState)(borrowerAddress);
|
|
50
|
-
// Call Codama-generated instruction (sync version - no async derivation)
|
|
51
|
-
const kitInstruction = (0, instructions_1.getCloseBorrowerInstruction)({
|
|
52
|
-
borrower: borrowerSigner,
|
|
53
|
-
borrowerState,
|
|
54
|
-
}, { programAddress });
|
|
55
|
-
return (0, instructions_2.prepareInstructions)(kitInstruction, {
|
|
56
|
-
computeUnits: params.computeUnits,
|
|
57
|
-
PublicKey: finalConfig.PublicKey
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=closeBorrower.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"closeBorrower.js","sourceRoot":"","sources":["../../../src/instructions/closeBorrower.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AA8CH,sCAoCC;AAhFD,qCAAoD;AACpD,mEAA+E;AAC/E,4CAA4E;AAC5E,4CAA8F;AAE9F,wDAA4D;AAC5D,wCAAmD;AAmBnD;;;;;;;;;;;;;;;;;;GAkBG;AACI,KAAK,UAAU,aAAa,CACjC,MAA2B,EAC3B,MAA2B;IAE3B,eAAe;IACf,MAAM,WAAW,GAAG,IAAA,oBAAW,EAAC,MAAM,CAAC,CAAC;IAExC,2BAA2B;IAC3B,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,yCAAyC;IACzC,MAAM,cAAc,GAAG,IAAA,4BAAmB,EAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC5D,MAAM,eAAe,GAAG,IAAA,yBAAgB,EAAC,cAAc,CAAC,CAAC;IAEzD,iCAAiC;IACjC,MAAM,SAAS,GAAG,IAAA,qBAAY,EAAC,MAAM,CAAC,CAAC;IACvC,MAAM,cAAc,GAAG,IAAA,aAAO,EAAC,SAAS,CAAC,KAAgB,CAAC,CAAC;IAE3D,4BAA4B;IAC5B,MAAM,aAAa,GAAG,MAAM,IAAA,2BAAmB,EAAC,eAAe,CAAC,CAAC;IAEjE,yEAAyE;IACzE,MAAM,cAAc,GAAG,IAAA,0CAA2B,EAChD;QACE,QAAQ,EAAE,cAAc;QACxB,aAAa;KACd,EACD,EAAE,cAAc,EAAE,CACnB,CAAC;IAEF,OAAO,IAAA,kCAAmB,EAAC,cAAc,EAAE;QACzC,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,SAAS,EAAE,WAAW,CAAC,SAAS;KACjC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @purpose Simplified deleteBorrower instruction wrapper
|
|
4
|
-
*
|
|
5
|
-
* Thin convenience wrapper around Codama-generated deleteBorrower instruction.
|
|
6
|
-
* Allows admin OR borrower to delete borrower state for schema migrations.
|
|
7
|
-
* Returns lamports to the borrower. Next rental will lazy-init fresh state.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.deleteBorrower = deleteBorrower;
|
|
11
|
-
const kit_1 = require("@solana/kit");
|
|
12
|
-
const instructions_1 = require("../generated/codama/instructions");
|
|
13
|
-
const config_1 = require("../utils/config");
|
|
14
|
-
const signer_1 = require("../utils/signer");
|
|
15
|
-
const instructions_2 = require("../utils/instructions");
|
|
16
|
-
/**
|
|
17
|
-
* Delete borrower state (admin only)
|
|
18
|
-
*
|
|
19
|
-
* Used for schema migrations when BorrowerState structure changes.
|
|
20
|
-
* Returns lamports to the borrower. Next rental will lazy-init fresh state.
|
|
21
|
-
*
|
|
22
|
-
* @param params - Delete borrower parameters
|
|
23
|
-
* @param config - Optional SDK configuration overrides
|
|
24
|
-
* @returns Kit instruction (or web3.js if PublicKey in config)
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* // Admin deletes borrower state for migration
|
|
29
|
-
* const ix = await deleteBorrower({
|
|
30
|
-
* admin: adminWallet,
|
|
31
|
-
* borrower: "BORROWER_WALLET_ADDRESS"
|
|
32
|
-
* });
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
async function deleteBorrower(params, config) {
|
|
36
|
-
// Merge config
|
|
37
|
-
const finalConfig = (0, config_1.mergeConfig)(config);
|
|
38
|
-
// Validate required params
|
|
39
|
-
if (!params.admin) {
|
|
40
|
-
throw new Error('admin is required');
|
|
41
|
-
}
|
|
42
|
-
if (!params.borrower) {
|
|
43
|
-
throw new Error('borrower is required');
|
|
44
|
-
}
|
|
45
|
-
// Convert admin to transaction signer
|
|
46
|
-
const adminSigner = (0, signer_1.toTransactionSigner)(params.admin);
|
|
47
|
-
// Get network-specific addresses
|
|
48
|
-
const addresses = (0, config_1.getAddresses)(config);
|
|
49
|
-
const programAddress = (0, kit_1.address)(addresses.srsly);
|
|
50
|
-
// Call Codama-generated instruction
|
|
51
|
-
const kitInstruction = await (0, instructions_1.getDeleteBorrowerInstructionAsync)({
|
|
52
|
-
admin: adminSigner,
|
|
53
|
-
borrower: (0, kit_1.address)(params.borrower)
|
|
54
|
-
}, { programAddress });
|
|
55
|
-
return (0, instructions_2.prepareInstructions)(kitInstruction, {
|
|
56
|
-
computeUnits: params.computeUnits,
|
|
57
|
-
PublicKey: finalConfig.PublicKey
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=deleteBorrower.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deleteBorrower.js","sourceRoot":"","sources":["../../../src/instructions/deleteBorrower.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAmDH,wCAmCC;AApFD,qCAAoD;AACpD,mEAAqF;AACrF,4CAA4E;AAC5E,4CAA4E;AAC5E,wDAA4D;AA0B5D;;;;;;;;;;;;;;;;;;GAkBG;AACI,KAAK,UAAU,cAAc,CAClC,MAA4B,EAC5B,MAA2B;IAE3B,eAAe;IACf,MAAM,WAAW,GAAG,IAAA,oBAAW,EAAC,MAAM,CAAC,CAAC;IAExC,2BAA2B;IAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,sCAAsC;IACtC,MAAM,WAAW,GAAG,IAAA,4BAAmB,EAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEtD,iCAAiC;IACjC,MAAM,SAAS,GAAG,IAAA,qBAAY,EAAC,MAAM,CAAC,CAAC;IACvC,MAAM,cAAc,GAAG,IAAA,aAAO,EAAC,SAAS,CAAC,KAAgB,CAAC,CAAC;IAE3D,oCAAoC;IACpC,MAAM,cAAc,GAAG,MAAM,IAAA,gDAAiC,EAC5D;QACE,KAAK,EAAE,WAAW;QAClB,QAAQ,EAAE,IAAA,aAAO,EAAC,MAAM,CAAC,QAAmB,CAAC;KAC9C,EACD,EAAE,cAAc,EAAE,CACnB,CAAC;IAEF,OAAO,IAAA,kCAAmB,EAAC,cAAc,EAAE;QACzC,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,SAAS,EAAE,WAAW,CAAC,SAAS;KACjC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @purpose Simplified discountBorrower instruction wrapper
|
|
4
|
-
*
|
|
5
|
-
* Thin convenience wrapper around Codama-generated discountBorrower instruction.
|
|
6
|
-
* Admin-only instruction to apply a discount to a specific borrower.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.discountBorrower = discountBorrower;
|
|
10
|
-
const kit_1 = require("@solana/kit");
|
|
11
|
-
const instructions_1 = require("../generated/codama/instructions");
|
|
12
|
-
const config_1 = require("../utils/config");
|
|
13
|
-
const signer_1 = require("../utils/signer");
|
|
14
|
-
const srsly_1 = require("../pda/srsly");
|
|
15
|
-
const instructions_2 = require("../utils/instructions");
|
|
16
|
-
const slyvault_1 = require("@wuwei-labs/slyvault");
|
|
17
|
-
/**
|
|
18
|
-
* Apply discount to borrower
|
|
19
|
-
*
|
|
20
|
-
* Admin-only instruction that applies a discount to a specific borrower.
|
|
21
|
-
* The discount is specified in basis points (1 basis point = 0.01%).
|
|
22
|
-
*
|
|
23
|
-
* @param params - Discount parameters
|
|
24
|
-
* @param config - Optional SDK configuration overrides
|
|
25
|
-
* @returns Kit instruction (or web3.js if PublicKey in config)
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* // Apply 10% discount
|
|
30
|
-
* const ix = await discountBorrower({
|
|
31
|
-
* admin: adminWallet,
|
|
32
|
-
* borrower: borrowerAddress,
|
|
33
|
-
* discount: 10
|
|
34
|
-
* });
|
|
35
|
-
*
|
|
36
|
-
* // Remove discount
|
|
37
|
-
* const ix2 = await discountBorrower({
|
|
38
|
-
* admin: adminWallet,
|
|
39
|
-
* borrower: borrowerAddress,
|
|
40
|
-
* discount: null
|
|
41
|
-
* });
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
async function discountBorrower(params, config) {
|
|
45
|
-
// Merge config
|
|
46
|
-
const finalConfig = (0, config_1.mergeConfig)(config);
|
|
47
|
-
// Validate required params
|
|
48
|
-
if (!params.admin) {
|
|
49
|
-
throw new Error('admin is required');
|
|
50
|
-
}
|
|
51
|
-
if (!params.borrower) {
|
|
52
|
-
throw new Error('borrower is required');
|
|
53
|
-
}
|
|
54
|
-
// Convert admin to transaction signer
|
|
55
|
-
const adminSigner = (0, signer_1.toTransactionSigner)(params.admin);
|
|
56
|
-
// Derive borrower state PDA
|
|
57
|
-
const borrowerState = await (0, srsly_1.deriveBorrowerState)(params.borrower);
|
|
58
|
-
// Get network-specific addresses
|
|
59
|
-
const addresses = (0, config_1.getAddresses)(config);
|
|
60
|
-
const programAddress = (0, kit_1.address)(addresses.srsly);
|
|
61
|
-
// Convert percentage to BPS Option<number>
|
|
62
|
-
const discountBps = params.discount === null || params.discount === undefined
|
|
63
|
-
? (0, kit_1.none)()
|
|
64
|
-
: (0, kit_1.some)((0, slyvault_1.percentToBps)(params.discount));
|
|
65
|
-
// Call Codama-generated instruction
|
|
66
|
-
const kitInstruction = await (0, instructions_1.getDiscountBorrowerInstructionAsync)({
|
|
67
|
-
admin: adminSigner,
|
|
68
|
-
borrowerState,
|
|
69
|
-
discountBps,
|
|
70
|
-
}, { programAddress });
|
|
71
|
-
return (0, instructions_2.prepareInstructions)(kitInstruction, {
|
|
72
|
-
computeUnits: params.computeUnits,
|
|
73
|
-
PublicKey: finalConfig.PublicKey
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=discountBorrower.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discountBorrower.js","sourceRoot":"","sources":["../../../src/instructions/discountBorrower.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAmEH,4CA6CC;AA9GD,qCAAgE;AAChE,mEAAuF;AACvF,4CAA4E;AAC5E,4CAA4E;AAE5E,wCAAmD;AACnD,wDAA4D;AAC5D,mDAAoD;AA+BpD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACI,KAAK,UAAU,gBAAgB,CACpC,MAA8B,EAC9B,MAA2B;IAE3B,eAAe;IACf,MAAM,WAAW,GAAG,IAAA,oBAAW,EAAC,MAAM,CAAC,CAAC;IAExC,2BAA2B;IAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED,sCAAsC;IACtC,MAAM,WAAW,GAAG,IAAA,4BAAmB,EAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEtD,4BAA4B;IAC5B,MAAM,aAAa,GAAG,MAAM,IAAA,2BAAmB,EAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEjE,iCAAiC;IACjC,MAAM,SAAS,GAAG,IAAA,qBAAY,EAAC,MAAM,CAAC,CAAC;IACvC,MAAM,cAAc,GAAG,IAAA,aAAO,EAAC,SAAS,CAAC,KAAgB,CAAC,CAAC;IAE3D,2CAA2C;IAC3C,MAAM,WAAW,GACf,MAAM,CAAC,QAAQ,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS;QACvD,CAAC,CAAC,IAAA,UAAI,GAAU;QAChB,CAAC,CAAC,IAAA,UAAI,EAAS,IAAA,uBAAY,EAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAElD,oCAAoC;IACpC,MAAM,cAAc,GAAG,MAAM,IAAA,kDAAmC,EAC9D;QACE,KAAK,EAAE,WAAW;QAClB,aAAa;QACb,WAAW;KACZ,EACD,EAAE,cAAc,EAAE,CACnB,CAAC;IAEF,OAAO,IAAA,kCAAmB,EAAC,cAAc,EAAE;QACzC,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,SAAS,EAAE,WAAW,CAAC,SAAS;KACjC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"claimContractPayments.js","sourceRoot":"","sources":["../../../../../src/generated/codama/instructions/claimContractPayments.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,wBAA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EAAE;YACR,KAAK,EAAE,cAAc,EAAE;YACvB,MAAM,EAAE,cAAc,EAAE;YACxB,IAAI,EAAE,cAAc,EAAE;YACtB,KAAK,EAAE,cAAc,EAAE;YACvB,QAAQ,EAAE,cAAc,EAAE;YAC1B,oBAAoB,EAAE,cAAc,EAAE;YACtC,uBAAuB,EAAE,cAAc,EAAE;YACzC,WAAW,EAAE,sBAAsB,EAAE;YACrC,YAAY,EAAE,cAAc,EAAE;YAC9B,sBAAsB,EAAE,cAAc,EAAE;YACxC,aAAa,EAAE,cAAc,EAAE;SAChC;QACD,IAAI,EAAE,8CAA8C,EAAE,CAAC,MAAM,CAC3D,WAAW,CAAC,IAAI,CACjB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
-
* to add features, then rerun Codama to update it.
|
|
5
|
-
*
|
|
6
|
-
* @see https://github.com/codama-idl/codama
|
|
7
|
-
*/
|
|
8
|
-
import { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, transformEncoder, } from "@solana/kit";
|
|
9
|
-
import { SRSLY_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
-
import { getAccountMetaFactory } from "../shared";
|
|
11
|
-
export const CLOSE_BORROWER_DISCRIMINATOR = new Uint8Array([
|
|
12
|
-
136, 79, 95, 44, 18, 151, 73, 199,
|
|
13
|
-
]);
|
|
14
|
-
export function getCloseBorrowerDiscriminatorBytes() {
|
|
15
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(CLOSE_BORROWER_DISCRIMINATOR);
|
|
16
|
-
}
|
|
17
|
-
export function getCloseBorrowerInstructionDataEncoder() {
|
|
18
|
-
return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: CLOSE_BORROWER_DISCRIMINATOR }));
|
|
19
|
-
}
|
|
20
|
-
export function getCloseBorrowerInstructionDataDecoder() {
|
|
21
|
-
return getStructDecoder([
|
|
22
|
-
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
23
|
-
]);
|
|
24
|
-
}
|
|
25
|
-
export function getCloseBorrowerInstructionDataCodec() {
|
|
26
|
-
return combineCodec(getCloseBorrowerInstructionDataEncoder(), getCloseBorrowerInstructionDataDecoder());
|
|
27
|
-
}
|
|
28
|
-
export function getCloseBorrowerInstruction(input, config) {
|
|
29
|
-
// Program address.
|
|
30
|
-
const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
|
|
31
|
-
// Original accounts.
|
|
32
|
-
const originalAccounts = {
|
|
33
|
-
borrower: { value: input.borrower ?? null, isWritable: true },
|
|
34
|
-
borrowerState: { value: input.borrowerState ?? null, isWritable: true },
|
|
35
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
36
|
-
};
|
|
37
|
-
const accounts = originalAccounts;
|
|
38
|
-
// Resolve default values.
|
|
39
|
-
if (!accounts.systemProgram.value) {
|
|
40
|
-
accounts.systemProgram.value =
|
|
41
|
-
"11111111111111111111111111111111";
|
|
42
|
-
}
|
|
43
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
44
|
-
return Object.freeze({
|
|
45
|
-
accounts: [
|
|
46
|
-
getAccountMeta(accounts.borrower),
|
|
47
|
-
getAccountMeta(accounts.borrowerState),
|
|
48
|
-
getAccountMeta(accounts.systemProgram),
|
|
49
|
-
],
|
|
50
|
-
data: getCloseBorrowerInstructionDataEncoder().encode({}),
|
|
51
|
-
programAddress,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
export function parseCloseBorrowerInstruction(instruction) {
|
|
55
|
-
if (instruction.accounts.length < 3) {
|
|
56
|
-
// TODO: Coded error.
|
|
57
|
-
throw new Error("Not enough accounts");
|
|
58
|
-
}
|
|
59
|
-
let accountIndex = 0;
|
|
60
|
-
const getNextAccount = () => {
|
|
61
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
62
|
-
accountIndex += 1;
|
|
63
|
-
return accountMeta;
|
|
64
|
-
};
|
|
65
|
-
return {
|
|
66
|
-
programAddress: instruction.programAddress,
|
|
67
|
-
accounts: {
|
|
68
|
-
borrower: getNextAccount(),
|
|
69
|
-
borrowerState: getNextAccount(),
|
|
70
|
-
systemProgram: getNextAccount(),
|
|
71
|
-
},
|
|
72
|
-
data: getCloseBorrowerInstructionDataDecoder().decode(instruction.data),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=closeBorrower.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"closeBorrower.js","sourceRoot":"","sources":["../../../../../src/generated/codama/instructions/closeBorrower.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GAejB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAwB,MAAM,WAAW,CAAC;AAExE,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,UAAU,CAAC;IACzD,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG;CAClC,CAAC,CAAC;AAEH,MAAM,UAAU,kCAAkC;IAChD,OAAO,cAAc,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAChD,4BAA4B,CAC7B,CAAC;AACJ,CAAC;AAiCD,MAAM,UAAU,sCAAsC;IACpD,OAAO,gBAAgB,CACrB,gBAAgB,CAAC,CAAC,CAAC,eAAe,EAAE,cAAc,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC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AC;YACjC,cAAc,CAAC,QAAQ,CAAC,aAAa,CAAC;YACtC,cAAc,CAAC,QAAQ,CAAC,aAAa,CAAC;SACvC;QACD,IAAI,EAAE,sCAAsC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;QACzD,cAAc;KAMf,CAAC,CAAC;AACL,CAAC;AAeD,MAAM,UAAU,6BAA6B,CAI3C,WAEyC;IAEzC,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,qBAAqB;QACrB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,MAAM,WAAW,GAAI,WAAW,CAAC,QAA0B,CAAC,YAAY,CAAE,CAAC;QAC3E,YAAY,IAAI,CAAC,CAAC;QAClB,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;IACF,OAAO;QACL,cAAc,EAAE,WAAW,CAAC,cAAc;QAC1C,QAAQ,EAAE;YACR,QAAQ,EAAE,cAAc,EAAE;YAC1B,aAAa,EAAE,cAAc,EAAE;YAC/B,aAAa,EAAE,cAAc,EAAE;SAChC;QACD,IAAI,EAAE,sCAAsC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;KACxE,CAAC;AACJ,CAAC"}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
-
* to add features, then rerun Codama to update it.
|
|
5
|
-
*
|
|
6
|
-
* @see https://github.com/codama-idl/codama
|
|
7
|
-
*/
|
|
8
|
-
import { combineCodec, fixDecoderSize, fixEncoderSize, getAddressEncoder, getBytesDecoder, getBytesEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, transformEncoder, } from "@solana/kit";
|
|
9
|
-
import { SRSLY_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
-
import { expectAddress, getAccountMetaFactory, } from "../shared";
|
|
11
|
-
export const DELETE_BORROWER_DISCRIMINATOR = new Uint8Array([
|
|
12
|
-
89, 147, 185, 127, 231, 56, 190, 45,
|
|
13
|
-
]);
|
|
14
|
-
export function getDeleteBorrowerDiscriminatorBytes() {
|
|
15
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(DELETE_BORROWER_DISCRIMINATOR);
|
|
16
|
-
}
|
|
17
|
-
export function getDeleteBorrowerInstructionDataEncoder() {
|
|
18
|
-
return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: DELETE_BORROWER_DISCRIMINATOR }));
|
|
19
|
-
}
|
|
20
|
-
export function getDeleteBorrowerInstructionDataDecoder() {
|
|
21
|
-
return getStructDecoder([
|
|
22
|
-
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
23
|
-
]);
|
|
24
|
-
}
|
|
25
|
-
export function getDeleteBorrowerInstructionDataCodec() {
|
|
26
|
-
return combineCodec(getDeleteBorrowerInstructionDataEncoder(), getDeleteBorrowerInstructionDataDecoder());
|
|
27
|
-
}
|
|
28
|
-
export async function getDeleteBorrowerInstructionAsync(input, config) {
|
|
29
|
-
// Program address.
|
|
30
|
-
const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
|
|
31
|
-
// Original accounts.
|
|
32
|
-
const originalAccounts = {
|
|
33
|
-
admin: { value: input.admin ?? null, isWritable: true },
|
|
34
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
35
|
-
borrower: { value: input.borrower ?? null, isWritable: true },
|
|
36
|
-
borrowerState: { value: input.borrowerState ?? null, isWritable: true },
|
|
37
|
-
};
|
|
38
|
-
const accounts = originalAccounts;
|
|
39
|
-
// Resolve default values.
|
|
40
|
-
if (!accounts.config.value) {
|
|
41
|
-
accounts.config.value = await getProgramDerivedAddress({
|
|
42
|
-
programAddress,
|
|
43
|
-
seeds: [
|
|
44
|
-
getBytesEncoder().encode(new Uint8Array([99, 111, 110, 102, 105, 103])),
|
|
45
|
-
],
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
if (!accounts.borrowerState.value) {
|
|
49
|
-
accounts.borrowerState.value = await getProgramDerivedAddress({
|
|
50
|
-
programAddress,
|
|
51
|
-
seeds: [
|
|
52
|
-
getBytesEncoder().encode(new Uint8Array([
|
|
53
|
-
98, 111, 114, 114, 111, 119, 101, 114, 95, 115, 116, 97, 116, 101,
|
|
54
|
-
])),
|
|
55
|
-
getAddressEncoder().encode(expectAddress(accounts.borrower.value)),
|
|
56
|
-
],
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
60
|
-
return Object.freeze({
|
|
61
|
-
accounts: [
|
|
62
|
-
getAccountMeta(accounts.admin),
|
|
63
|
-
getAccountMeta(accounts.config),
|
|
64
|
-
getAccountMeta(accounts.borrower),
|
|
65
|
-
getAccountMeta(accounts.borrowerState),
|
|
66
|
-
],
|
|
67
|
-
data: getDeleteBorrowerInstructionDataEncoder().encode({}),
|
|
68
|
-
programAddress,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
export function getDeleteBorrowerInstruction(input, config) {
|
|
72
|
-
// Program address.
|
|
73
|
-
const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
|
|
74
|
-
// Original accounts.
|
|
75
|
-
const originalAccounts = {
|
|
76
|
-
admin: { value: input.admin ?? null, isWritable: true },
|
|
77
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
78
|
-
borrower: { value: input.borrower ?? null, isWritable: true },
|
|
79
|
-
borrowerState: { value: input.borrowerState ?? null, isWritable: true },
|
|
80
|
-
};
|
|
81
|
-
const accounts = originalAccounts;
|
|
82
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
83
|
-
return Object.freeze({
|
|
84
|
-
accounts: [
|
|
85
|
-
getAccountMeta(accounts.admin),
|
|
86
|
-
getAccountMeta(accounts.config),
|
|
87
|
-
getAccountMeta(accounts.borrower),
|
|
88
|
-
getAccountMeta(accounts.borrowerState),
|
|
89
|
-
],
|
|
90
|
-
data: getDeleteBorrowerInstructionDataEncoder().encode({}),
|
|
91
|
-
programAddress,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
export function parseDeleteBorrowerInstruction(instruction) {
|
|
95
|
-
if (instruction.accounts.length < 4) {
|
|
96
|
-
// TODO: Coded error.
|
|
97
|
-
throw new Error("Not enough accounts");
|
|
98
|
-
}
|
|
99
|
-
let accountIndex = 0;
|
|
100
|
-
const getNextAccount = () => {
|
|
101
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
102
|
-
accountIndex += 1;
|
|
103
|
-
return accountMeta;
|
|
104
|
-
};
|
|
105
|
-
return {
|
|
106
|
-
programAddress: instruction.programAddress,
|
|
107
|
-
accounts: {
|
|
108
|
-
admin: getNextAccount(),
|
|
109
|
-
config: getNextAccount(),
|
|
110
|
-
borrower: getNextAccount(),
|
|
111
|
-
borrowerState: getNextAccount(),
|
|
112
|
-
},
|
|
113
|
-
data: getDeleteBorrowerInstructionDataDecoder().decode(instruction.data),
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
//# sourceMappingURL=deleteBorrower.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deleteBorrower.js","sourceRoot":"","sources":["../../../../../src/generated/codama/instructions/deleteBorrower.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GAejB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,aAAa,EACb,qBAA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vC;QACD,IAAI,EAAE,uCAAuC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1D,cAAc;KAOf,CAAC,CAAC;AACL,CAAC;AAgBD,MAAM,UAAU,8BAA8B,CAI5C,WAEyC;IAEzC,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,qBAAqB;QACrB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,MAAM,WAAW,GAAI,WAAW,CAAC,QAA0B,CAAC,YAAY,CAAE,CAAC;QAC3E,YAAY,IAAI,CAAC,CAAC;QAClB,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;IACF,OAAO;QACL,cAAc,EAAE,WAAW,CAAC,cAAc;QAC1C,QAAQ,EAAE;YACR,KAAK,EAAE,cAAc,EAAE;YACvB,MAAM,EAAE,cAAc,EAAE;YACxB,QAAQ,EAAE,cAAc,EAAE;YAC1B,aAAa,EAAE,cAAc,EAAE;SAChC;QACD,IAAI,EAAE,uCAAuC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;KACzE,CAAC;AACJ,CAAC"}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
3
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
-
* to add features, then rerun Codama to update it.
|
|
5
|
-
*
|
|
6
|
-
* @see https://github.com/codama-idl/codama
|
|
7
|
-
*/
|
|
8
|
-
import { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getOptionDecoder, getOptionEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, getU16Decoder, getU16Encoder, transformEncoder, } from "@solana/kit";
|
|
9
|
-
import { SRSLY_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
-
import { getAccountMetaFactory } from "../shared";
|
|
11
|
-
export const DISCOUNT_BORROWER_DISCRIMINATOR = new Uint8Array([
|
|
12
|
-
110, 191, 200, 109, 103, 39, 185, 141,
|
|
13
|
-
]);
|
|
14
|
-
export function getDiscountBorrowerDiscriminatorBytes() {
|
|
15
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(DISCOUNT_BORROWER_DISCRIMINATOR);
|
|
16
|
-
}
|
|
17
|
-
export function getDiscountBorrowerInstructionDataEncoder() {
|
|
18
|
-
return transformEncoder(getStructEncoder([
|
|
19
|
-
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
20
|
-
["discountBps", getOptionEncoder(getU16Encoder())],
|
|
21
|
-
]), (value) => ({ ...value, discriminator: DISCOUNT_BORROWER_DISCRIMINATOR }));
|
|
22
|
-
}
|
|
23
|
-
export function getDiscountBorrowerInstructionDataDecoder() {
|
|
24
|
-
return getStructDecoder([
|
|
25
|
-
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
26
|
-
["discountBps", getOptionDecoder(getU16Decoder())],
|
|
27
|
-
]);
|
|
28
|
-
}
|
|
29
|
-
export function getDiscountBorrowerInstructionDataCodec() {
|
|
30
|
-
return combineCodec(getDiscountBorrowerInstructionDataEncoder(), getDiscountBorrowerInstructionDataDecoder());
|
|
31
|
-
}
|
|
32
|
-
export async function getDiscountBorrowerInstructionAsync(input, config) {
|
|
33
|
-
// Program address.
|
|
34
|
-
const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
|
|
35
|
-
// Original accounts.
|
|
36
|
-
const originalAccounts = {
|
|
37
|
-
admin: { value: input.admin ?? null, isWritable: true },
|
|
38
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
39
|
-
borrowerState: { value: input.borrowerState ?? null, isWritable: true },
|
|
40
|
-
};
|
|
41
|
-
const accounts = originalAccounts;
|
|
42
|
-
// Original args.
|
|
43
|
-
const args = { ...input };
|
|
44
|
-
// Resolve default values.
|
|
45
|
-
if (!accounts.config.value) {
|
|
46
|
-
accounts.config.value = await getProgramDerivedAddress({
|
|
47
|
-
programAddress,
|
|
48
|
-
seeds: [
|
|
49
|
-
getBytesEncoder().encode(new Uint8Array([99, 111, 110, 102, 105, 103])),
|
|
50
|
-
],
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
54
|
-
return Object.freeze({
|
|
55
|
-
accounts: [
|
|
56
|
-
getAccountMeta(accounts.admin),
|
|
57
|
-
getAccountMeta(accounts.config),
|
|
58
|
-
getAccountMeta(accounts.borrowerState),
|
|
59
|
-
],
|
|
60
|
-
data: getDiscountBorrowerInstructionDataEncoder().encode(args),
|
|
61
|
-
programAddress,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
export function getDiscountBorrowerInstruction(input, config) {
|
|
65
|
-
// Program address.
|
|
66
|
-
const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
|
|
67
|
-
// Original accounts.
|
|
68
|
-
const originalAccounts = {
|
|
69
|
-
admin: { value: input.admin ?? null, isWritable: true },
|
|
70
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
71
|
-
borrowerState: { value: input.borrowerState ?? null, isWritable: true },
|
|
72
|
-
};
|
|
73
|
-
const accounts = originalAccounts;
|
|
74
|
-
// Original args.
|
|
75
|
-
const args = { ...input };
|
|
76
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
77
|
-
return Object.freeze({
|
|
78
|
-
accounts: [
|
|
79
|
-
getAccountMeta(accounts.admin),
|
|
80
|
-
getAccountMeta(accounts.config),
|
|
81
|
-
getAccountMeta(accounts.borrowerState),
|
|
82
|
-
],
|
|
83
|
-
data: getDiscountBorrowerInstructionDataEncoder().encode(args),
|
|
84
|
-
programAddress,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
export function parseDiscountBorrowerInstruction(instruction) {
|
|
88
|
-
if (instruction.accounts.length < 3) {
|
|
89
|
-
// TODO: Coded error.
|
|
90
|
-
throw new Error("Not enough accounts");
|
|
91
|
-
}
|
|
92
|
-
let accountIndex = 0;
|
|
93
|
-
const getNextAccount = () => {
|
|
94
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
95
|
-
accountIndex += 1;
|
|
96
|
-
return accountMeta;
|
|
97
|
-
};
|
|
98
|
-
return {
|
|
99
|
-
programAddress: instruction.programAddress,
|
|
100
|
-
accounts: {
|
|
101
|
-
admin: getNextAccount(),
|
|
102
|
-
config: getNextAccount(),
|
|
103
|
-
borrowerState: getNextAccount(),
|
|
104
|
-
},
|
|
105
|
-
data: getDiscountBorrowerInstructionDataDecoder().decode(instruction.data),
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=discountBorrower.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"discountBorrower.js","sourceRoot":"","sources":["../../../../../src/generated/codama/instructions/discountBorrower.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,gBAAgB,GAiBjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAwB,MAAM,WAAW,CAAC;AAExE,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAI,UAAU,CAAC;IAC5D,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG;CACtC,CAAC,CAAC;AAEH,MAAM,UAAU,qCAAqC;IACnD,OAAO,cAAc,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAChD,+BAA+B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