@huma-finance/permissionless-sdk 1.0.3-beta.20250904195059.ae633b4 → 1.0.4-beta.20250910221248.6d8b150
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/README.md +63 -2
- package/dist/permissionless/client.d.ts +4 -0
- package/dist/permissionless/client.d.ts.map +1 -1
- package/dist/permissionless/client.js +103 -16
- package/dist/permissionless/client.js.map +1 -1
- package/dist/utils/redemptionRequestAccount.d.ts +4 -0
- package/dist/utils/redemptionRequestAccount.d.ts.map +1 -0
- package/dist/utils/redemptionRequestAccount.js +14 -0
- package/dist/utils/redemptionRequestAccount.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# Huma Permissionless SDK
|
|
2
2
|
|
|
3
|
-
This is an [NPM Package](https://www.npmjs.com/package/@huma-finance/permissionless-sdk) that helps build deposit instructions for the various modes + lockups on Huma 2.0 (Permissionless).
|
|
3
|
+
This is an [NPM Package](https://www.npmjs.com/package/@huma-finance/permissionless-sdk) that helps build deposit and withdrawal instructions for the various modes + lockups on Huma 2.0 (Permissionless), and check token prices.
|
|
4
4
|
|
|
5
5
|
## Current supported features
|
|
6
6
|
|
|
7
7
|
- Deposit into classic or maxi mode (PST and mPST respectively)
|
|
8
|
+
- Withdraw from classic or maxi mode (redeem PST and mPST tokens)
|
|
9
|
+
- Check the current price of PST and mPST tokens
|
|
8
10
|
- Optionally specify a lockup on these tokens, in most cases you'll want to use the default NO_COMMIT option.
|
|
9
11
|
|
|
10
12
|
## Depositing
|
|
@@ -22,7 +24,7 @@ import {
|
|
|
22
24
|
new PermissionlessClient(connection, SolanaChainEnum.MAINNET);
|
|
23
25
|
```
|
|
24
26
|
|
|
25
|
-
2. Build a deposit instruction for either PST (DepositMode.CLASSIC) or mPST (DepositMode.MAXI) (note that token amounts should be denoted in smallest units)
|
|
27
|
+
2. Build a deposit instruction for either PST (DepositMode.CLASSIC) or mPST (DepositMode.MAXI) (note that token amounts should be denoted in smallest units). At least 1 USDC must be deposited.
|
|
26
28
|
|
|
27
29
|
```
|
|
28
30
|
import {
|
|
@@ -37,3 +39,62 @@ const tx = await client.buildDepositTx(
|
|
|
37
39
|
```
|
|
38
40
|
|
|
39
41
|
3. The deposit transaction is intended to only handle the instructions for depositing and creating relevant Huma accounts. It should be up to the implementation to optimize the transaction with the correct blockhashes, compute unit limits, priority fees, etc.
|
|
42
|
+
|
|
43
|
+
## Redeeming
|
|
44
|
+
|
|
45
|
+
An example Node script integration in /examples/addRedemptionRequest.ts is provided in this repo.
|
|
46
|
+
|
|
47
|
+
1. Create a `PermissionlessClient` (same as depositing)
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
import {
|
|
51
|
+
PermissionlessClient,
|
|
52
|
+
SolanaChainEnum,
|
|
53
|
+
} from "@huma-finance/permissionless-sdk";
|
|
54
|
+
|
|
55
|
+
new PermissionlessClient(connection, SolanaChainEnum.MAINNET);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
2. Build a withdrawal instruction for either PST (DepositMode.CLASSIC) or mPST (DepositMode.MAXI). At least 1 USDC worth of tokens must be withdrawn. Note that the withdrawal creates a redemption request and is not an instant redemption - withdrawals are typically processed within a few days, with a 7 day SLA at the latest.
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
import {
|
|
62
|
+
DepositMode
|
|
63
|
+
} from "@huma-finance/permissionless-sdk";
|
|
64
|
+
|
|
65
|
+
const tx = await client.buildWithdrawTx(
|
|
66
|
+
publicKey,
|
|
67
|
+
new BN(1000000), /* Withdraw 1 USDC worth of tokens */
|
|
68
|
+
DepositMode.CLASSIC /* Will redeem PST */
|
|
69
|
+
);
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
3. The withdrawal transaction is intended to only handle the instructions for creating a redemption request. It should be up to the implementation to optimize the transaction with the correct blockhashes, compute unit limits, priority fees, etc.
|
|
73
|
+
|
|
74
|
+
## Checking Token Price
|
|
75
|
+
|
|
76
|
+
An example Node script integration in /examples/tokenPrice.ts is provided in this repo.
|
|
77
|
+
|
|
78
|
+
1. Create a `PermissionlessClient` (same as depositing)
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
import {
|
|
82
|
+
PermissionlessClient,
|
|
83
|
+
SolanaChainEnum,
|
|
84
|
+
} from "@huma-finance/permissionless-sdk";
|
|
85
|
+
|
|
86
|
+
new PermissionlessClient(connection, SolanaChainEnum.MAINNET);
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
2. Get the current price of PST or mPST tokens denominated in the underlying mint (USDC)
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
import {
|
|
93
|
+
DepositMode
|
|
94
|
+
} from "@huma-finance/permissionless-sdk";
|
|
95
|
+
|
|
96
|
+
const price = await client.getModeTokenPrice(DepositMode.CLASSIC);
|
|
97
|
+
console.log(price.toString()); // Price in smallest units of underlying mint
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
3. The price is returned as a BN representing the price in the smallest units of the underlying mint. For example, if the price is 1.234567 USDC, it will be returned as 1234567 (since USDC has 6 decimals).
|
|
@@ -9,6 +9,10 @@ export declare class PermissionlessClient {
|
|
|
9
9
|
private metadata;
|
|
10
10
|
private program;
|
|
11
11
|
constructor(connection: Connection, chain: SolanaChainEnum);
|
|
12
|
+
getModeTokenATA(owner: PublicKey, mode: DepositMode): Promise<PublicKey>;
|
|
12
13
|
buildDepositTx(owner: PublicKey, amount: BN, mode: DepositMode, commitment?: DepositCommitment): Promise<Transaction>;
|
|
14
|
+
buildWithdrawTx(owner: PublicKey, amount: BN, mode: DepositMode): Promise<Transaction>;
|
|
15
|
+
getModeTokenPrice(mode: DepositMode): Promise<BN>;
|
|
16
|
+
private getCreateLenderStateAccountInstruction;
|
|
13
17
|
}
|
|
14
18
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/permissionless/client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/permissionless/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,WAAW,EAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAkB,MAAM,mBAAmB,CAAC;AAShE,OAAO,EAAE,EAAE,EAAwB,MAAM,mBAAmB,CAAC;AAG7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,OAAO,CAA0B;gBAE7B,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe;IAQpD,eAAe,CACnB,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,SAAS,CAAC;IAUf,cAAc,CAClB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,EAAE,EACV,IAAI,EAAE,WAAW,EACjB,UAAU,GAAE,iBAA+C,GAC1D,OAAO,CAAC,WAAW,CAAC;IAuDjB,eAAe,CACnB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,EAAE,EACV,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,WAAW,CAAC;IAwCjB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,EAAE,CAAC;YAkCzC,sCAAsC;CAqCrD"}
|
|
@@ -6,9 +6,11 @@ const metadata_1 = require("../types/metadata");
|
|
|
6
6
|
const metadata_2 = require("../utils/metadata");
|
|
7
7
|
const spl_token_1 = require("@solana/spl-token");
|
|
8
8
|
const lenderAccount_1 = require("../utils/lenderAccount");
|
|
9
|
+
const anchor_1 = require("@coral-xyz/anchor");
|
|
9
10
|
const program_1 = require("../utils/program");
|
|
10
11
|
const tokenAccount_1 = require("../utils/tokenAccount");
|
|
11
12
|
const deposit_1 = require("../types/deposit");
|
|
13
|
+
const redemptionRequestAccount_1 = require("../utils/redemptionRequestAccount");
|
|
12
14
|
class PermissionlessClient {
|
|
13
15
|
connection;
|
|
14
16
|
chain;
|
|
@@ -20,9 +22,106 @@ class PermissionlessClient {
|
|
|
20
22
|
this.metadata = (0, metadata_2.getMetadata)(chain);
|
|
21
23
|
this.program = (0, program_1.getHumaProgram)(connection, chain);
|
|
22
24
|
}
|
|
25
|
+
// Gets the associated token account (ATA) of the owner for the given mode
|
|
26
|
+
async getModeTokenATA(owner, mode) {
|
|
27
|
+
const modeMetadata = this.metadata[mode];
|
|
28
|
+
return (0, tokenAccount_1.getModeTokenATA)(owner, new web3_js_1.PublicKey(modeMetadata.mint));
|
|
29
|
+
}
|
|
30
|
+
// Returns a transaction with all the necessary instructions to deposit into
|
|
31
|
+
// Huma 2.0 for the given mode. Note that this transaction omits priority fees,
|
|
32
|
+
// compute unit limits, and recent blockhash as these should be added by the caller.
|
|
33
|
+
// Notes:
|
|
34
|
+
// - Minimum deposit amount is 1000000 (1 USDC)
|
|
23
35
|
async buildDepositTx(owner, amount, mode, commitment = deposit_1.DepositCommitment.NO_COMMIT) {
|
|
24
36
|
const modeMetadata = this.metadata[mode];
|
|
25
37
|
const tx = new web3_js_1.Transaction();
|
|
38
|
+
const createLenderAccountInstruction = await this.getCreateLenderStateAccountInstruction(owner, mode);
|
|
39
|
+
if (createLenderAccountInstruction) {
|
|
40
|
+
tx.add(createLenderAccountInstruction);
|
|
41
|
+
}
|
|
42
|
+
const lenderModeTokenATA = (0, tokenAccount_1.getModeTokenATA)(owner, new web3_js_1.PublicKey(modeMetadata.mint));
|
|
43
|
+
tx.add((0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(owner, lenderModeTokenATA, owner, new web3_js_1.PublicKey(modeMetadata.mint), spl_token_1.TOKEN_PROGRAM_ID));
|
|
44
|
+
const depositTx = await this.program.methods
|
|
45
|
+
.deposit(amount, commitment, false /* commitmentAutoRenewal */)
|
|
46
|
+
.accountsPartial({
|
|
47
|
+
depositor: owner,
|
|
48
|
+
humaConfig: this.metadata.humaConfig,
|
|
49
|
+
poolConfig: this.metadata.poolConfig,
|
|
50
|
+
modeConfig: modeMetadata.config,
|
|
51
|
+
underlyingMint: new web3_js_1.PublicKey(this.metadata.underlyingMint.address),
|
|
52
|
+
underlyingTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
53
|
+
modeTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
54
|
+
})
|
|
55
|
+
.instruction();
|
|
56
|
+
tx.add(depositTx);
|
|
57
|
+
return tx;
|
|
58
|
+
}
|
|
59
|
+
// Returns a transaction with all the necessary instructions to withdraw from
|
|
60
|
+
// Huma 2.0 for the given mode. Note that this transaction omits priority fees,
|
|
61
|
+
// compute unit limits, and recent blockhash as these should be added by the caller.
|
|
62
|
+
// Notes:
|
|
63
|
+
// - Minimum withdrawal amount is 1000000 (1 USDC)
|
|
64
|
+
// - The withdrawal creates a redemption request and is not an instant redemption.
|
|
65
|
+
// Withdrawals are typically processed within a few days, and have a 7 day SLA at the latest.
|
|
66
|
+
// - Redemptions will transfer the mode token out of the wallet where they will be held
|
|
67
|
+
// until processing is complete.
|
|
68
|
+
// - Redemption requests are processed in a FIFO queue. There is a daily redemption cap but this
|
|
69
|
+
// will not prevent new requests from being added to the queue.
|
|
70
|
+
// - In rare cases a redemption request ID can collide with another request if both are submitted
|
|
71
|
+
// at the same time. Only one of the requests will successfully create, and the other must
|
|
72
|
+
// be regenerated with a new ID and resubmitted.
|
|
73
|
+
async buildWithdrawTx(owner, amount, mode) {
|
|
74
|
+
const modeMetadata = this.metadata[mode];
|
|
75
|
+
const tx = new web3_js_1.Transaction();
|
|
76
|
+
const createLenderAccountInstruction = await this.getCreateLenderStateAccountInstruction(owner, mode);
|
|
77
|
+
if (createLenderAccountInstruction) {
|
|
78
|
+
tx.add(createLenderAccountInstruction);
|
|
79
|
+
}
|
|
80
|
+
const { humaConfig, poolConfig } = this.metadata;
|
|
81
|
+
// Get the latest last request ID from the pool state account to avoid race condition as much as possible
|
|
82
|
+
const poolState = await this.program.account.poolState.fetch(new web3_js_1.PublicKey(this.metadata.poolState));
|
|
83
|
+
const { lastRequestId } = poolState.redemptionQueue;
|
|
84
|
+
const requestIdBN = new anchor_1.BN(lastRequestId).add(new anchor_1.BN(1));
|
|
85
|
+
const redemptionRequestPDA = (0, redemptionRequestAccount_1.getRedemptionRequestPDA)(new web3_js_1.PublicKey(poolConfig), new web3_js_1.PublicKey(this.metadata.poolProgram), requestIdBN);
|
|
86
|
+
const addRedemptionRequestInstruction = await this.program.methods
|
|
87
|
+
.addRedemptionRequest(new anchor_1.BN(amount))
|
|
88
|
+
.accountsPartial({
|
|
89
|
+
lender: owner,
|
|
90
|
+
humaConfig: humaConfig,
|
|
91
|
+
poolConfig: poolConfig,
|
|
92
|
+
modeConfig: modeMetadata.config,
|
|
93
|
+
redemptionRequest: redemptionRequestPDA,
|
|
94
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
95
|
+
})
|
|
96
|
+
.instruction();
|
|
97
|
+
tx.add(addRedemptionRequestInstruction);
|
|
98
|
+
return tx;
|
|
99
|
+
}
|
|
100
|
+
// Fetches the current native price of the mode token demoninated in the underlying mint
|
|
101
|
+
async getModeTokenPrice(mode) {
|
|
102
|
+
let modeStateIndex = 0;
|
|
103
|
+
if (mode === metadata_1.DepositMode.CLASSIC) {
|
|
104
|
+
modeStateIndex = 0;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
modeStateIndex = 1;
|
|
108
|
+
}
|
|
109
|
+
const modeMetadata = this.metadata[mode];
|
|
110
|
+
const [poolState, modeMint] = await Promise.all([
|
|
111
|
+
this.program.account.poolState.fetch(new web3_js_1.PublicKey(this.metadata.poolState)),
|
|
112
|
+
(0, spl_token_1.getMint)(this.connection, new web3_js_1.PublicKey(modeMetadata.mint), undefined, spl_token_1.TOKEN_PROGRAM_ID),
|
|
113
|
+
]);
|
|
114
|
+
const assets = new anchor_1.BN(poolState.modeStates[modeStateIndex].assets);
|
|
115
|
+
const decimals = new anchor_1.BN(10).pow(new anchor_1.BN(this.metadata.underlyingMint.decimals));
|
|
116
|
+
const supply = new anchor_1.BN(modeMint.supply);
|
|
117
|
+
// Handle division by zero
|
|
118
|
+
if (supply.isZero()) {
|
|
119
|
+
return new anchor_1.BN(0);
|
|
120
|
+
}
|
|
121
|
+
return assets.mul(decimals).div(supply);
|
|
122
|
+
}
|
|
123
|
+
async getCreateLenderStateAccountInstruction(owner, mode) {
|
|
124
|
+
const modeMetadata = this.metadata[mode];
|
|
26
125
|
const { classicLenderStateAccount, maxiLenderStateAccount } = await (0, lenderAccount_1.getLenderStateAccounts)(this.connection, owner, this.chain);
|
|
27
126
|
const lenderModeTokenATA = (0, tokenAccount_1.getModeTokenATA)(owner, new web3_js_1.PublicKey(modeMetadata.mint));
|
|
28
127
|
let lenderStateAccount;
|
|
@@ -44,23 +143,11 @@ class PermissionlessClient {
|
|
|
44
143
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
45
144
|
})
|
|
46
145
|
.instruction();
|
|
47
|
-
|
|
146
|
+
return createLenderAccountInstruction;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
return null;
|
|
48
150
|
}
|
|
49
|
-
tx.add((0, spl_token_1.createAssociatedTokenAccountIdempotentInstruction)(owner, lenderModeTokenATA, owner, new web3_js_1.PublicKey(modeMetadata.mint), spl_token_1.TOKEN_PROGRAM_ID));
|
|
50
|
-
const depositTx = await this.program.methods
|
|
51
|
-
.deposit(amount, commitment, false /* commitmentAutoRenewal */)
|
|
52
|
-
.accountsPartial({
|
|
53
|
-
depositor: owner,
|
|
54
|
-
humaConfig: this.metadata.humaConfig,
|
|
55
|
-
poolConfig: this.metadata.poolConfig,
|
|
56
|
-
modeConfig: modeMetadata.config,
|
|
57
|
-
underlyingMint: new web3_js_1.PublicKey(this.metadata.underlyingMint.address),
|
|
58
|
-
underlyingTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
59
|
-
modeTokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
60
|
-
})
|
|
61
|
-
.instruction();
|
|
62
|
-
tx.add(depositTx);
|
|
63
|
-
return tx;
|
|
64
151
|
}
|
|
65
152
|
}
|
|
66
153
|
exports.PermissionlessClient = PermissionlessClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/permissionless/client.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/permissionless/client.ts"],"names":[],"mappings":";;;AAAA,6CAKyB;AAEzB,gDAAgE;AAChE,gDAAgD;AAChD,iDAI2B;AAC3B,0DAAgE;AAEhE,8CAA6D;AAC7D,8CAAkD;AAClD,wDAAwD;AACxD,8CAAqD;AACrD,gFAA4E;AAE5E,MAAa,oBAAoB;IACvB,UAAU,CAAa;IACvB,KAAK,CAAkB;IACvB,QAAQ,CAAiB;IACzB,OAAO,CAA0B;IAEzC,YAAY,UAAsB,EAAE,KAAsB;QACxD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,IAAA,sBAAW,EAAC,KAAK,CAAC,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,IAAA,wBAAc,EAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;IAED,0EAA0E;IAC1E,KAAK,CAAC,eAAe,CACnB,KAAgB,EAChB,IAAiB;QAEjB,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzC,OAAO,IAAA,8BAAe,EAAC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,CAAC,QAAQ,CAAC,UAAU;gBACpC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU;gBACpC,UAAU,EAAE,YAAY,CAAC,MAAM;gBAC/B,eAAe,EAAE,kBAAkB;gBACnC,YAAY,EAAE,4BAAgB;aAC/B,CAAC;iBACD,WAAW,EAAE,CAAC;YAEjB,OAAO,8BAA8B,CAAC;QACxC,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF;AA1MD,oDA0MC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redemptionRequestAccount.d.ts","sourceRoot":"","sources":["../../src/utils/redemptionRequestAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,eAAO,MAAM,uBAAuB,GAClC,YAAY,SAAS,EACrB,aAAa,SAAS,EACtB,WAAW,EAAE,KACZ,SAUF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRedemptionRequestPDA = void 0;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
const getRedemptionRequestPDA = (poolConfig, poolProgram, requestId) => {
|
|
6
|
+
const [PDA] = web3_js_1.PublicKey.findProgramAddressSync([
|
|
7
|
+
Buffer.from("redemption_request"),
|
|
8
|
+
requestId.toBuffer("be", 16),
|
|
9
|
+
poolConfig.toBuffer(),
|
|
10
|
+
], new web3_js_1.PublicKey(poolProgram));
|
|
11
|
+
return PDA;
|
|
12
|
+
};
|
|
13
|
+
exports.getRedemptionRequestPDA = getRedemptionRequestPDA;
|
|
14
|
+
//# sourceMappingURL=redemptionRequestAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redemptionRequestAccount.js","sourceRoot":"","sources":["../../src/utils/redemptionRequestAccount.ts"],"names":[],"mappings":";;;AACA,6CAA4C;AAErC,MAAM,uBAAuB,GAAG,CACrC,UAAqB,EACrB,WAAsB,EACtB,SAAa,EACF,EAAE;IACb,MAAM,CAAC,GAAG,CAAC,GAAG,mBAAS,CAAC,sBAAsB,CAC5C;QACE,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC;QACjC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;QAC5B,UAAU,CAAC,QAAQ,EAAE;KACtB,EACD,IAAI,mBAAS,CAAC,WAAW,CAAC,CAC3B,CAAC;IACF,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAdW,QAAA,uBAAuB,2BAclC"}
|
package/package.json
CHANGED