@huma-finance/sdk 0.0.52-beta.405 → 0.0.52

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/API.md CHANGED
@@ -40,6 +40,12 @@ attempt to first increase the allowance of the pool.</p></dd>
40
40
  <dt><a href="#getRealWorldReceivableContract">getRealWorldReceivableContract(signerOrProvider, chainId)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
41
41
  <dd><p>Returns an ethers contract instance for the RealWorldReceivable contract
42
42
  associated with the given pool name on the current chain.</p></dd>
43
+ <dt><a href="#getAvailableBalanceForPool">getAvailableBalanceForPool(poolName, provider)</a></dt>
44
+ <dd><p>Returns the current pool balance available for borrowing</p></dd>
45
+ <dt><a href="#getAvailableCreditForPool">getAvailableCreditForPool(borrower, poolName, provider)</a></dt>
46
+ <dd><p>Returns the borrower's remaining credit they can use for borrowing. Note that this might not be
47
+ currently available for borrowing as the credit limit might exceed the available pool balance. Use
48
+ getPoolBalance() to get the current available pool balance.</p></dd>
43
49
  <dt><a href="#getReceivableBackedCreditLineContractV2">getReceivableBackedCreditLineContractV2(signerOrProvider, poolName)</a> ⇒ <code>ReceivableBackedCreditLine</code> | <code>null</code></dt>
44
50
  <dd><p>Returns an ethers contract instance for the V2 Receivable contract
45
51
  associated with the given pool name on the current chain.</p></dd>
@@ -762,6 +768,33 @@ associated with the given pool name on the current chain.</p>
762
768
  | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
763
769
  | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
764
770
 
771
+ <a name="getAvailableBalanceForPool"></a>
772
+
773
+ ## getAvailableBalanceForPool(poolName, provider)
774
+ <p>Returns the current pool balance available for borrowing</p>
775
+
776
+ **Kind**: global function
777
+
778
+ | Param | Type | Description |
779
+ | --- | --- | --- |
780
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to get the contract instance for.</p> |
781
+ | provider | <code>JsonRpcProvider</code> \| <code>Web3Provider</code> | <p>The provider instance to use for reading from the contract.</p> |
782
+
783
+ <a name="getAvailableCreditForPool"></a>
784
+
785
+ ## getAvailableCreditForPool(borrower, poolName, provider)
786
+ <p>Returns the borrower's remaining credit they can use for borrowing. Note that this might not be
787
+ currently available for borrowing as the credit limit might exceed the available pool balance. Use
788
+ getPoolBalance() to get the current available pool balance.</p>
789
+
790
+ **Kind**: global function
791
+
792
+ | Param | Type | Description |
793
+ | --- | --- | --- |
794
+ | borrower | <code>string</code> | <p>The address of the borrower to check the available credit for.</p> |
795
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to get the contract instance for.</p> |
796
+ | provider | <code>JsonRpcProvider</code> \| <code>Web3Provider</code> | <p>The provider instance to use for reading from the contract.</p> |
797
+
765
798
  <a name="getReceivableBackedCreditLineContractV2"></a>
766
799
 
767
800
  ## getReceivableBackedCreditLineContractV2(signerOrProvider, poolName) ⇒ <code>ReceivableBackedCreditLine</code> \| <code>null</code>
@@ -3,3 +3,4 @@ export * from './ERC20TransferableReceivableContractHelper';
3
3
  export * from './PoolContractHelper';
4
4
  export * from './v2/ReceivableContractHelper';
5
5
  export * from './v2/ReceivableBackedCreditLineContractHelper';
6
+ export * from './v2/CreditContractHelper';
@@ -6,4 +6,5 @@ tslib_1.__exportStar(require("./ERC20TransferableReceivableContractHelper"), exp
6
6
  tslib_1.__exportStar(require("./PoolContractHelper"), exports);
7
7
  tslib_1.__exportStar(require("./v2/ReceivableContractHelper"), exports);
8
8
  tslib_1.__exportStar(require("./v2/ReceivableBackedCreditLineContractHelper"), exports);
9
+ tslib_1.__exportStar(require("./v2/CreditContractHelper"), exports);
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":";;;AAAA,8EAAmD;AACnD,sFAA2D;AAC3D,+DAAoC;AACpC,wEAA6C;AAC7C,wFAA6D"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":";;;AAAA,8EAAmD;AACnD,sFAA2D;AAC3D,+DAAoC;AACpC,wEAA6C;AAC7C,wFAA6D;AAC7D,oEAAyC"}
@@ -0,0 +1,20 @@
1
+ import { JsonRpcProvider, Web3Provider } from '@ethersproject/providers';
2
+ import { POOL_NAME } from '@huma-finance/shared';
3
+ import { ethers } from 'ethers';
4
+ /**
5
+ * Returns the current pool balance available for borrowing
6
+ *
7
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
8
+ * @param {JsonRpcProvider | Web3Provider} provider The provider instance to use for reading from the contract.
9
+ */
10
+ export declare function getAvailableBalanceForPool(poolName: POOL_NAME, provider: JsonRpcProvider | Web3Provider): Promise<ethers.BigNumber>;
11
+ /**
12
+ * Returns the borrower's remaining credit they can use for borrowing. Note that this might not be
13
+ * currently available for borrowing as the credit limit might exceed the available pool balance. Use
14
+ * getPoolBalance() to get the current available pool balance.
15
+ *
16
+ * @param {string} borrower - The address of the borrower to check the available credit for.
17
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
18
+ * @param {JsonRpcProvider | Web3Provider} provider The provider instance to use for reading from the contract.
19
+ */
20
+ export declare function getAvailableCreditForPool(borrower: string, poolName: POOL_NAME, provider: JsonRpcProvider | Web3Provider): Promise<ethers.BigNumber>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAvailableCreditForPool = exports.getAvailableBalanceForPool = void 0;
4
+ const shared_1 = require("@huma-finance/shared");
5
+ /**
6
+ * Returns the current pool balance available for borrowing
7
+ *
8
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
9
+ * @param {JsonRpcProvider | Web3Provider} provider The provider instance to use for reading from the contract.
10
+ */
11
+ async function getAvailableBalanceForPool(poolName, provider) {
12
+ const safeContract = await (0, shared_1.getPoolSafeContractV2)(poolName, provider);
13
+ if (!safeContract) {
14
+ throw new Error('Could not find safe contract for pool');
15
+ }
16
+ return safeContract.getAvailableBalanceForPool();
17
+ }
18
+ exports.getAvailableBalanceForPool = getAvailableBalanceForPool;
19
+ /**
20
+ * Returns the borrower's remaining credit they can use for borrowing. Note that this might not be
21
+ * currently available for borrowing as the credit limit might exceed the available pool balance. Use
22
+ * getPoolBalance() to get the current available pool balance.
23
+ *
24
+ * @param {string} borrower - The address of the borrower to check the available credit for.
25
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
26
+ * @param {JsonRpcProvider | Web3Provider} provider The provider instance to use for reading from the contract.
27
+ */
28
+ async function getAvailableCreditForPool(borrower, poolName, provider) {
29
+ const creditConfig = await (0, shared_1.getCreditConfigV2)(poolName, borrower, provider);
30
+ const creditRecord = await (0, shared_1.getCreditRecordV2)(poolName, borrower, provider);
31
+ if (!creditConfig || !creditRecord) {
32
+ throw new Error('Could not find credit config or credit record');
33
+ }
34
+ return creditConfig.creditLimit.sub(creditRecord.unbilledPrincipal);
35
+ }
36
+ exports.getAvailableCreditForPool = getAvailableCreditForPool;
37
+ //# sourceMappingURL=CreditContractHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreditContractHelper.js","sourceRoot":"","sources":["../../../../src/helpers/v2/CreditContractHelper.ts"],"names":[],"mappings":";;;AACA,iDAK6B;AAG7B;;;;;GAKG;AACI,KAAK,UAAU,0BAA0B,CAC9C,QAAmB,EACnB,QAAwC;IAExC,MAAM,YAAY,GAAG,MAAM,IAAA,8BAAqB,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAEpE,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;KACzD;IAED,OAAO,YAAY,CAAC,0BAA0B,EAAE,CAAA;AAClD,CAAC;AAXD,gEAWC;AAED;;;;;;;;GAQG;AACI,KAAK,UAAU,yBAAyB,CAC7C,QAAgB,EAChB,QAAmB,EACnB,QAAwC;IAExC,MAAM,YAAY,GAAG,MAAM,IAAA,0BAAiB,EAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAC1E,MAAM,YAAY,GAAG,MAAM,IAAA,0BAAiB,EAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAE1E,IAAI,CAAC,YAAY,IAAI,CAAC,YAAY,EAAE;QAClC,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;KACjE;IAED,OAAO,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAA;AACrE,CAAC;AAbD,8DAaC"}
@@ -1,5 +1,5 @@
1
1
  import { TransactionResponse } from '@ethersproject/providers';
2
- import { BigNumber, Overrides } from 'ethers';
2
+ import { BigNumber, BigNumberish, Overrides } from 'ethers';
3
3
  import { HumaContext } from './HumaContext';
4
4
  export declare class HumaReceivableHandler {
5
5
  #private;
@@ -7,4 +7,5 @@ export declare class HumaReceivableHandler {
7
7
  humaContext: HumaContext;
8
8
  });
9
9
  declarePayment(paymentAmount: BigNumber, referenceId?: string, gasOpts?: Overrides): Promise<TransactionResponse>;
10
+ burnReceivable(tokenId: BigNumberish, gasOpts?: Overrides): Promise<TransactionResponse>;
10
11
  }
@@ -26,6 +26,14 @@ class HumaReceivableHandler {
26
26
  }
27
27
  return contract.declarePayment(tokenId, paymentAmount, gasOpts);
28
28
  }
29
+ async burnReceivable(tokenId, gasOpts = {}) {
30
+ const contract = await (0, helpers_1.getReceivableContractV2)(tslib_1.__classPrivateFieldGet(this, _HumaReceivableHandler_humaContext, "f").poolName, tslib_1.__classPrivateFieldGet(this, _HumaReceivableHandler_humaContext, "f").signer);
31
+ if (!contract) {
32
+ throw new Error('Could not find Receivable contract');
33
+ }
34
+ gasOpts = await (0, utils_1.getDefaultGasOptions)(gasOpts, tslib_1.__classPrivateFieldGet(this, _HumaReceivableHandler_humaContext, "f").chainId);
35
+ return contract.burn(tokenId, gasOpts);
36
+ }
29
37
  }
30
38
  exports.HumaReceivableHandler = HumaReceivableHandler;
31
39
  _HumaReceivableHandler_humaContext = new WeakMap();
@@ -1 +1 @@
1
- {"version":3,"file":"HumaReceivableHandler.js","sourceRoot":"","sources":["../../../../src/services/v2/HumaReceivableHandler.ts"],"names":[],"mappings":";;;;;AAGA,uCAAkD;AAClD,2CAGsB;AAEtB,MAAa,qBAAqB;IAGhC,YAAY,EAAE,WAAW,EAAgC;QAFzD,qDAAyB;QAGvB,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;SAC/C;QAED,+BAAA,IAAI,sCAAgB,WAAW,MAAA,CAAA;IACjC,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,aAAwB,EACxB,cAAsB,EAAE,EACxB,UAAqB,EAAE;QAEvB,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAuB,EAC5C,+BAAA,IAAI,0CAAa,CAAC,QAAQ,EAC1B,+BAAA,IAAI,0CAAa,CAAC,MAAM,CACzB,CAAA;QACD,IAAI,CAAC,QAAQ,EAAE;YACb,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;SACtD;QAED,OAAO,GAAG,MAAM,IAAA,4BAAoB,EAAC,OAAO,EAAE,+BAAA,IAAI,0CAAa,CAAC,OAAO,CAAC,CAAA;QAExE,MAAM,aAAa,GAAG,MAAM,+BAAA,IAAI,0CAAa,CAAC,MAAM,CAAC,UAAU,EAAE,CAAA;QACjE,MAAM,OAAO,GAAG,MAAM,IAAA,6CAAmC,EACvD,WAAW,EACX,aAAa,EACb,+BAAA,IAAI,0CAAa,CAAC,QAAQ,EAC1B,+BAAA,IAAI,0CAAa,CAAC,QAAQ,CAC3B,CAAA;QAED,IAAI,CAAC,OAAO,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;SAC1C;QAED,OAAO,QAAQ,CAAC,cAAc,CAAC,OA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,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,OAAqB,EACrB,UAAqB,EAAE;QAEvB,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAuB,EAC5C,+BAAA,IAAI,0CAAa,CAAC,QAAQ,EAC1B,+BAAA,IAAI,0CAAa,CAAC,MAAM,CACzB,CAAA;QACD,IAAI,CAAC,QAAQ,EAAE;YACb,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;SACtD;QAED,OAAO,GAAG,MAAM,IAAA,4BAAoB,EAAC,OAAO,EAAE,+BAAA,IAAI,0CAAa,CAAC,OAAO,CAAC,CAAA;QAExE,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACxC,CAAC;CACF;AAzDD,sDAyDC"}
@@ -3,3 +3,4 @@ export * from './ERC20TransferableReceivableContractHelper';
3
3
  export * from './PoolContractHelper';
4
4
  export * from './v2/ReceivableContractHelper';
5
5
  export * from './v2/ReceivableBackedCreditLineContractHelper';
6
+ export * from './v2/CreditContractHelper';
@@ -3,4 +3,5 @@ export * from './ERC20TransferableReceivableContractHelper';
3
3
  export * from './PoolContractHelper';
4
4
  export * from './v2/ReceivableContractHelper';
5
5
  export * from './v2/ReceivableBackedCreditLineContractHelper';
6
+ export * from './v2/CreditContractHelper';
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAA;AACnD,cAAc,6CAA6C,CAAA;AAC3D,cAAc,sBAAsB,CAAA;AACpC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+CAA+C,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAA;AACnD,cAAc,6CAA6C,CAAA;AAC3D,cAAc,sBAAsB,CAAA;AACpC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+CAA+C,CAAA;AAC7D,cAAc,2BAA2B,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { JsonRpcProvider, Web3Provider } from '@ethersproject/providers';
2
+ import { POOL_NAME } from '@huma-finance/shared';
3
+ import { ethers } from 'ethers';
4
+ /**
5
+ * Returns the current pool balance available for borrowing
6
+ *
7
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
8
+ * @param {JsonRpcProvider | Web3Provider} provider The provider instance to use for reading from the contract.
9
+ */
10
+ export declare function getAvailableBalanceForPool(poolName: POOL_NAME, provider: JsonRpcProvider | Web3Provider): Promise<ethers.BigNumber>;
11
+ /**
12
+ * Returns the borrower's remaining credit they can use for borrowing. Note that this might not be
13
+ * currently available for borrowing as the credit limit might exceed the available pool balance. Use
14
+ * getPoolBalance() to get the current available pool balance.
15
+ *
16
+ * @param {string} borrower - The address of the borrower to check the available credit for.
17
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
18
+ * @param {JsonRpcProvider | Web3Provider} provider The provider instance to use for reading from the contract.
19
+ */
20
+ export declare function getAvailableCreditForPool(borrower: string, poolName: POOL_NAME, provider: JsonRpcProvider | Web3Provider): Promise<ethers.BigNumber>;
@@ -0,0 +1,32 @@
1
+ import { getCreditConfigV2, getCreditRecordV2, getPoolSafeContractV2, } from '@huma-finance/shared';
2
+ /**
3
+ * Returns the current pool balance available for borrowing
4
+ *
5
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
6
+ * @param {JsonRpcProvider | Web3Provider} provider The provider instance to use for reading from the contract.
7
+ */
8
+ export async function getAvailableBalanceForPool(poolName, provider) {
9
+ const safeContract = await getPoolSafeContractV2(poolName, provider);
10
+ if (!safeContract) {
11
+ throw new Error('Could not find safe contract for pool');
12
+ }
13
+ return safeContract.getAvailableBalanceForPool();
14
+ }
15
+ /**
16
+ * Returns the borrower's remaining credit they can use for borrowing. Note that this might not be
17
+ * currently available for borrowing as the credit limit might exceed the available pool balance. Use
18
+ * getPoolBalance() to get the current available pool balance.
19
+ *
20
+ * @param {string} borrower - The address of the borrower to check the available credit for.
21
+ * @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
22
+ * @param {JsonRpcProvider | Web3Provider} provider The provider instance to use for reading from the contract.
23
+ */
24
+ export async function getAvailableCreditForPool(borrower, poolName, provider) {
25
+ const creditConfig = await getCreditConfigV2(poolName, borrower, provider);
26
+ const creditRecord = await getCreditRecordV2(poolName, borrower, provider);
27
+ if (!creditConfig || !creditRecord) {
28
+ throw new Error('Could not find credit config or credit record');
29
+ }
30
+ return creditConfig.creditLimit.sub(creditRecord.unbilledPrincipal);
31
+ }
32
+ //# sourceMappingURL=CreditContractHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreditContractHelper.js","sourceRoot":"","sources":["../../../src/helpers/v2/CreditContractHelper.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,GAEtB,MAAM,sBAAsB,CAAA;AAG7B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,QAAmB,EACnB,QAAwC;IAExC,MAAM,YAAY,GAAG,MAAM,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAEpE,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;KACzD;IAED,OAAO,YAAY,CAAC,0BAA0B,EAAE,CAAA;AAClD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,QAAgB,EAChB,QAAmB,EACnB,QAAwC;IAExC,MAAM,YAAY,GAAG,MAAM,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAC1E,MAAM,YAAY,GAAG,MAAM,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAE1E,IAAI,CAAC,YAAY,IAAI,CAAC,YAAY,EAAE;QAClC,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;KACjE;IAED,OAAO,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAA;AACrE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { TransactionResponse } from '@ethersproject/providers';
2
- import { BigNumber, Overrides } from 'ethers';
2
+ import { BigNumber, BigNumberish, Overrides } from 'ethers';
3
3
  import { HumaContext } from './HumaContext';
4
4
  export declare class HumaReceivableHandler {
5
5
  #private;
@@ -7,4 +7,5 @@ export declare class HumaReceivableHandler {
7
7
  humaContext: HumaContext;
8
8
  });
9
9
  declarePayment(paymentAmount: BigNumber, referenceId?: string, gasOpts?: Overrides): Promise<TransactionResponse>;
10
+ burnReceivable(tokenId: BigNumberish, gasOpts?: Overrides): Promise<TransactionResponse>;
10
11
  }
@@ -23,6 +23,14 @@ export class HumaReceivableHandler {
23
23
  }
24
24
  return contract.declarePayment(tokenId, paymentAmount, gasOpts);
25
25
  }
26
+ async burnReceivable(tokenId, gasOpts = {}) {
27
+ const contract = await getReceivableContractV2(__classPrivateFieldGet(this, _HumaReceivableHandler_humaContext, "f").poolName, __classPrivateFieldGet(this, _HumaReceivableHandler_humaContext, "f").signer);
28
+ if (!contract) {
29
+ throw new Error('Could not find Receivable contract');
30
+ }
31
+ gasOpts = await getDefaultGasOptions(gasOpts, __classPrivateFieldGet(this, _HumaReceivableHandler_humaContext, "f").chainId);
32
+ return contract.burn(tokenId, gasOpts);
33
+ }
26
34
  }
27
35
  _HumaReceivableHandler_humaContext = new WeakMap();
28
36
  //# sourceMappingURL=HumaReceivableHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HumaReceivableHandler.js","sourceRoot":"","sources":["../../../src/services/v2/HumaReceivableHandler.ts"],"names":[],"mappings":";;AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAC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