|
4 | 4 | OfferingBalanceStatus,
|
5 | 5 | OfferingSaleStatus,
|
6 | 6 | OfferingTimingStatus,
|
| 7 | + SignerKeyRingType, |
7 | 8 | VenueType,
|
8 | 9 | } from '@polymeshassociation/polymesh-sdk/types';
|
9 | 10 | import assert from 'node:assert';
|
@@ -123,6 +124,45 @@ export const createSto = async (
|
123 | 124 | await investTx.run();
|
124 | 125 | assert(investTx.isSuccess);
|
125 | 126 |
|
| 127 | + let offChainFundingDetails = await investableOffering.offChainFundingDetails(); |
| 128 | + assert(offChainFundingDetails.enabled === false, 'off chain funding should be disabled'); |
| 129 | + |
| 130 | + const enableOffChainFundingTx = await investableOffering.enableOffChainFunding({ |
| 131 | + offChainTicker: 'OFFCHAIN1234', |
| 132 | + }); |
| 133 | + await enableOffChainFundingTx.run(); |
| 134 | + assert(enableOffChainFundingTx.isSuccess); |
| 135 | + |
| 136 | + offChainFundingDetails = await investableOffering.offChainFundingDetails(); |
| 137 | + assert(offChainFundingDetails.enabled === true, 'off chain funding should be enabled'); |
| 138 | + assert( |
| 139 | + offChainFundingDetails.offChainTicker === 'OFFCHAIN1234', |
| 140 | + 'off chain funding should be enabled' |
| 141 | + ); |
| 142 | + |
| 143 | + const authChainFundingReceipt = await investableOffering.generateOffChainFundingReceipt({ |
| 144 | + uid: new BigNumber(1), |
| 145 | + offChainTicker: 'OFFCHAIN1234', |
| 146 | + amount: new BigNumber(100), |
| 147 | + sender: investor, |
| 148 | + metadata: 'Off chain metadata', |
| 149 | + signer: investorAccount, |
| 150 | + }); |
| 151 | + |
| 152 | + const offChainInvestTx = await investableOffering.invest( |
| 153 | + { |
| 154 | + offChainTicker: 'OFFCHAIN1234', |
| 155 | + offChainFundingReceipt: authChainFundingReceipt, |
| 156 | + purchasePortfolio: investorPortfolio, |
| 157 | + purchaseAmount: new BigNumber(10), |
| 158 | + maxPrice: new BigNumber(11), |
| 159 | + }, |
| 160 | + { signingAccount: investorAccount } |
| 161 | + ); |
| 162 | + |
| 163 | + await offChainInvestTx.run(); |
| 164 | + assert(offChainInvestTx.isSuccess); |
| 165 | + |
126 | 166 | // Freeze the offering
|
127 | 167 | const freezeTx = await offering.freeze();
|
128 | 168 | await freezeTx.run();
|
|
0 commit comments