@indigo-labs/indigo-sdk 0.1.20 → 0.1.22
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/.github/workflows/ci.yml +3 -8
- package/.github/workflows/test.yml +44 -0
- package/dist/index.d.mts +678 -1001
- package/dist/index.d.ts +678 -1001
- package/dist/index.js +2272 -4670
- package/dist/index.mjs +2234 -4618
- package/eslint.config.mjs +1 -7
- package/package.json +4 -9
- package/src/contracts/cdp.ts +746 -0
- package/src/contracts/collector.ts +98 -0
- package/src/contracts/gov.ts +1 -0
- package/src/contracts/interest-oracle.ts +149 -0
- package/src/contracts/{lrp/transactions.ts → lrp.ts} +14 -14
- package/src/contracts/{one-shot/transactions.ts → one-shot.ts} +3 -3
- package/src/contracts/stability-pool.ts +690 -0
- package/src/contracts/staking.ts +348 -0
- package/src/contracts/treasury.ts +112 -0
- package/src/helpers/asset-helpers.ts +57 -0
- package/src/{utils → helpers}/helper-txs.ts +0 -1
- package/src/{utils/utils.ts → helpers/helpers.ts} +10 -0
- package/src/{contracts/interest-oracle/helpers.ts → helpers/interest-oracle.ts} +9 -37
- package/src/{contracts/stability-pool/helpers.ts → helpers/stability-pool-helpers.ts} +6 -110
- package/src/helpers/staking-helpers.ts +94 -0
- package/src/helpers/time-helpers.ts +4 -0
- package/src/{utils → helpers}/value-helpers.ts +0 -10
- package/src/index.ts +33 -37
- package/src/{validators → scripts}/cdp-creator-validator.ts +50 -4
- package/src/{validators → scripts}/cdp-validator.ts +5 -3
- package/src/{validators → scripts}/collector-validator.ts +3 -2
- package/src/scripts/execute-validator.ts +52 -0
- package/src/{validators/governance-validator.ts → scripts/gov-validator.ts} +40 -3
- package/src/{validators → scripts}/interest-oracle-validator.ts +20 -4
- package/src/scripts/lrp-validator.ts +40 -0
- package/src/{contracts/one-shot/scripts.ts → scripts/one-shot-policy.ts} +1 -1
- package/src/scripts/poll-manager-validator.ts +52 -0
- package/src/{validators → scripts}/poll-shard-validator.ts +43 -3
- package/src/{contracts/price-oracle/scripts.ts → scripts/price-oracle-validator.ts} +4 -1
- package/src/{validators → scripts}/stability-pool-validator.ts +57 -4
- package/src/{validators → scripts}/staking-validator.ts +3 -2
- package/src/{validators → scripts}/treasury-validator.ts +3 -2
- package/src/{validators → scripts}/version-record-policy.ts +23 -4
- package/src/{validators/execute-validator.ts → scripts/version-registry.ts} +11 -3
- package/src/types/generic.ts +60 -78
- package/src/{contracts/cdp-creator/types.ts → types/indigo/cdp-creator.ts} +4 -6
- package/src/types/indigo/cdp.ts +88 -0
- package/src/types/indigo/execute.ts +21 -0
- package/src/types/indigo/gov.ts +51 -0
- package/src/{contracts/interest-oracle/types.ts → types/indigo/interest-oracle.ts} +1 -1
- package/src/{contracts/lrp/types.ts → types/indigo/lrp.ts} +2 -2
- package/src/types/indigo/poll-manager.ts +21 -0
- package/src/types/indigo/poll-shard.ts +16 -0
- package/src/{contracts/price-oracle/types.ts → types/indigo/price-oracle.ts} +4 -16
- package/src/types/indigo/stability-pool.ts +233 -0
- package/src/types/indigo/staking.ts +99 -0
- package/src/{contracts/version-registry/types.ts → types/indigo/version-record.ts} +1 -1
- package/src/types/on-chain-decimal.ts +0 -22
- package/src/types/system-params.ts +11 -22
- package/tests/datums.test.ts +108 -125
- package/tests/endpoints/initialize.ts +338 -240
- package/tests/hash-checks.test.ts +21 -26
- package/tests/indigo-test-helpers.ts +55 -1
- package/tests/initialize.test.ts +5 -10
- package/tests/interest-calculations.test.ts +18 -18
- package/tests/interest-oracle.test.ts +18 -20
- package/tests/lrp.test.ts +65 -191
- package/tests/queries/governance-queries.ts +16 -19
- package/tests/queries/iasset-queries.ts +23 -46
- package/tests/queries/interest-oracle-queries.ts +6 -3
- package/tests/queries/lrp-queries.ts +2 -2
- package/tests/queries/price-oracle-queries.ts +22 -5
- package/tests/queries/stability-pool-queries.ts +8 -10
- package/tests/queries/staking-queries.ts +19 -28
- package/tests/stability-pool.test.ts +71 -186
- package/tests/staking.test.ts +23 -30
- package/tests/test-helpers.ts +2 -11
- package/tsconfig.json +1 -3
- package/vitest.config.ts +1 -1
- package/src/contracts/cdp/helpers.ts +0 -167
- package/src/contracts/cdp/scripts.ts +0 -33
- package/src/contracts/cdp/transactions.ts +0 -1310
- package/src/contracts/cdp/types.ts +0 -161
- package/src/contracts/cdp-creator/scripts.ts +0 -39
- package/src/contracts/collector/scripts.ts +0 -32
- package/src/contracts/collector/transactions.ts +0 -44
- package/src/contracts/execute/scripts.ts +0 -48
- package/src/contracts/execute/types.ts +0 -57
- package/src/contracts/gov/helpers.ts +0 -157
- package/src/contracts/gov/scripts.ts +0 -34
- package/src/contracts/gov/transactions.ts +0 -1224
- package/src/contracts/gov/types-new.ts +0 -115
- package/src/contracts/gov/types.ts +0 -89
- package/src/contracts/interest-oracle/scripts.ts +0 -18
- package/src/contracts/interest-oracle/transactions.ts +0 -149
- package/src/contracts/lrp/scripts.ts +0 -27
- package/src/contracts/poll/helpers.ts +0 -55
- package/src/contracts/poll/scripts.ts +0 -72
- package/src/contracts/poll/types-poll-manager.ts +0 -38
- package/src/contracts/poll/types-poll-shard.ts +0 -38
- package/src/contracts/poll/types-poll.ts +0 -88
- package/src/contracts/price-oracle/transactions.ts +0 -112
- package/src/contracts/stability-pool/scripts.ts +0 -46
- package/src/contracts/stability-pool/transactions.ts +0 -660
- package/src/contracts/stability-pool/types-new.ts +0 -208
- package/src/contracts/stability-pool/types.ts +0 -42
- package/src/contracts/staking/helpers.ts +0 -116
- package/src/contracts/staking/scripts.ts +0 -41
- package/src/contracts/staking/transactions.ts +0 -268
- package/src/contracts/staking/types-new.ts +0 -81
- package/src/contracts/staking/types.ts +0 -41
- package/src/contracts/treasury/scripts.ts +0 -37
- package/src/contracts/treasury/transactions.ts +0 -44
- package/src/contracts/treasury/types.ts +0 -55
- package/src/contracts/version-registry/scripts.ts +0 -29
- package/src/contracts/version-registry/types-new.ts +0 -19
- package/src/contracts/vesting/helpers.ts +0 -267
- package/src/types/evolution-schema-options.ts +0 -16
- package/src/utils/bigint-utils.ts +0 -7
- package/src/utils/time-helpers.ts +0 -4
- package/src/validators/lrp-validator.ts +0 -7
- package/src/validators/poll-manager-validator.ts +0 -7
- package/src/validators/version-registry-validator.ts +0 -7
- package/tests/cdp.test.ts +0 -1565
- package/tests/gov.test.ts +0 -1874
- package/tests/mock/assets-mock.ts +0 -59
- package/tests/queries/cdp-queries.ts +0 -144
- package/tests/queries/collector-queries.ts +0 -26
- package/tests/queries/execute-queries.ts +0 -46
- package/tests/queries/poll-queries.ts +0 -97
- package/tests/queries/treasury-queries.ts +0 -19
- package/tests/utils/asserts.ts +0 -13
- package/tests/utils/index.ts +0 -50
- /package/src/{utils → helpers}/indigo-helpers.ts +0 -0
- /package/src/{utils → helpers}/lucid-utils.ts +0 -0
- /package/src/{contracts/price-oracle/helpers.ts → helpers/price-oracle-helpers.ts} +0 -0
- /package/src/{contracts/one-shot/types.ts → types/one-shot.ts} +0 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Address,
|
|
3
|
+
applyParamsToScript,
|
|
4
|
+
Constr,
|
|
5
|
+
Data,
|
|
6
|
+
fromText,
|
|
7
|
+
LucidEvolution,
|
|
8
|
+
OutRef,
|
|
9
|
+
SpendingValidator,
|
|
10
|
+
TxBuilder,
|
|
11
|
+
UTxO,
|
|
12
|
+
validatorToAddress,
|
|
13
|
+
validatorToScriptHash,
|
|
14
|
+
} from '@lucid-evolution/lucid';
|
|
15
|
+
import { _collectorValidator } from '../scripts/collector-validator';
|
|
16
|
+
import {
|
|
17
|
+
CollectorParams,
|
|
18
|
+
ScriptReferences,
|
|
19
|
+
SystemParams,
|
|
20
|
+
} from '../types/system-params';
|
|
21
|
+
import { scriptRef } from '../helpers/lucid-utils';
|
|
22
|
+
import { getRandomElement } from '../helpers/helpers';
|
|
23
|
+
|
|
24
|
+
export class CollectorContract {
|
|
25
|
+
static async feeTx(
|
|
26
|
+
fee: bigint,
|
|
27
|
+
lucid: LucidEvolution,
|
|
28
|
+
params: SystemParams,
|
|
29
|
+
tx: TxBuilder,
|
|
30
|
+
collectorRef?: OutRef,
|
|
31
|
+
): Promise<void> {
|
|
32
|
+
const collectorUtxo: UTxO = collectorRef
|
|
33
|
+
? getRandomElement(await lucid.utxosByOutRef([collectorRef]))
|
|
34
|
+
: getRandomElement(
|
|
35
|
+
await lucid.utxosAt(
|
|
36
|
+
CollectorContract.address(params.collectorParams, lucid),
|
|
37
|
+
),
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const collectorScriptRefUtxo = await CollectorContract.scriptRef(
|
|
41
|
+
params.scriptReferences,
|
|
42
|
+
lucid,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
tx.collectFrom([collectorUtxo], Data.to(new Constr(0, [])))
|
|
46
|
+
.pay.ToContract(
|
|
47
|
+
collectorUtxo.address,
|
|
48
|
+
{ kind: 'inline', value: Data.to(new Constr(0, [])) },
|
|
49
|
+
{
|
|
50
|
+
...collectorUtxo.assets,
|
|
51
|
+
lovelace: collectorUtxo.assets.lovelace + fee,
|
|
52
|
+
},
|
|
53
|
+
)
|
|
54
|
+
.readFrom([collectorScriptRefUtxo]);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Collector Validator
|
|
58
|
+
static validator(params: CollectorParams): SpendingValidator {
|
|
59
|
+
return {
|
|
60
|
+
type: 'PlutusV2',
|
|
61
|
+
script: applyParamsToScript(_collectorValidator.cborHex, [
|
|
62
|
+
new Constr(0, [
|
|
63
|
+
new Constr(0, [
|
|
64
|
+
params.stakingManagerNFT[0].unCurrencySymbol,
|
|
65
|
+
fromText(params.stakingManagerNFT[1].unTokenName),
|
|
66
|
+
]),
|
|
67
|
+
new Constr(0, [
|
|
68
|
+
params.stakingToken[0].unCurrencySymbol,
|
|
69
|
+
fromText(params.stakingToken[1].unTokenName),
|
|
70
|
+
]),
|
|
71
|
+
new Constr(0, [
|
|
72
|
+
params.versionRecordToken[0].unCurrencySymbol,
|
|
73
|
+
fromText(params.versionRecordToken[1].unTokenName),
|
|
74
|
+
]),
|
|
75
|
+
]),
|
|
76
|
+
]),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static validatorHash(params: CollectorParams): string {
|
|
81
|
+
return validatorToScriptHash(CollectorContract.validator(params));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static address(params: CollectorParams, lucid: LucidEvolution): Address {
|
|
85
|
+
const network = lucid.config().network;
|
|
86
|
+
if (!network) {
|
|
87
|
+
throw new Error('Network configuration is undefined');
|
|
88
|
+
}
|
|
89
|
+
return validatorToAddress(network, CollectorContract.validator(params));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
static async scriptRef(
|
|
93
|
+
params: ScriptReferences,
|
|
94
|
+
lucid: LucidEvolution,
|
|
95
|
+
): Promise<UTxO> {
|
|
96
|
+
return scriptRef(params.collectorValidatorRef, lucid);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export class GovContract {}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fromText,
|
|
3
|
+
LucidEvolution,
|
|
4
|
+
OutRef,
|
|
5
|
+
toUnit,
|
|
6
|
+
TxBuilder,
|
|
7
|
+
UTxO,
|
|
8
|
+
validatorToAddress,
|
|
9
|
+
} from '@lucid-evolution/lucid';
|
|
10
|
+
import { AssetClass } from '../types/generic';
|
|
11
|
+
import {
|
|
12
|
+
InterestOracleParams,
|
|
13
|
+
parseInterestOracleDatum,
|
|
14
|
+
serialiseFeedInterestOracleRedeemer,
|
|
15
|
+
serialiseInterestOracleDatum,
|
|
16
|
+
} from '../types/indigo/interest-oracle';
|
|
17
|
+
import { oneShotMintTx } from './one-shot';
|
|
18
|
+
import { mkInterestOracleValidator } from '../scripts/interest-oracle-validator';
|
|
19
|
+
import { findInterestOracle } from '../../tests/queries/interest-oracle-queries';
|
|
20
|
+
import { ONE_SECOND } from '../helpers/time-helpers';
|
|
21
|
+
import { calculateUnitaryInterestSinceOracleLastUpdated } from '../helpers/interest-oracle';
|
|
22
|
+
|
|
23
|
+
export class InterestOracleContract {
|
|
24
|
+
static async startInterestOracle(
|
|
25
|
+
initialUnitaryInterest: bigint,
|
|
26
|
+
initialInterestRate: bigint,
|
|
27
|
+
initialLastInterestUpdate: bigint,
|
|
28
|
+
oracleParams: InterestOracleParams,
|
|
29
|
+
lucid: LucidEvolution,
|
|
30
|
+
withScriptRef: boolean = false,
|
|
31
|
+
refOutRef?: OutRef,
|
|
32
|
+
interestTokenName?: string,
|
|
33
|
+
): Promise<[TxBuilder, AssetClass]> {
|
|
34
|
+
const tokenName = interestTokenName ?? 'INTEREST_ORACLE';
|
|
35
|
+
if (!refOutRef) {
|
|
36
|
+
refOutRef = (await lucid.wallet().getUtxos())[0];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const [tx, policyId] = await oneShotMintTx(lucid, {
|
|
40
|
+
referenceOutRef: {
|
|
41
|
+
txHash: refOutRef.txHash,
|
|
42
|
+
outputIdx: BigInt(refOutRef.outputIndex),
|
|
43
|
+
},
|
|
44
|
+
mintAmounts: [
|
|
45
|
+
{
|
|
46
|
+
tokenName: fromText(tokenName),
|
|
47
|
+
amount: 1n,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const validator = mkInterestOracleValidator(oracleParams);
|
|
53
|
+
|
|
54
|
+
tx.pay.ToContract(
|
|
55
|
+
validatorToAddress(lucid.config().network, validator),
|
|
56
|
+
{
|
|
57
|
+
kind: 'inline',
|
|
58
|
+
value: serialiseInterestOracleDatum({
|
|
59
|
+
unitaryInterest: initialUnitaryInterest,
|
|
60
|
+
interestRate: {
|
|
61
|
+
getOnChainInt: initialInterestRate,
|
|
62
|
+
},
|
|
63
|
+
lastUpdated: initialLastInterestUpdate,
|
|
64
|
+
}),
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
lovelace: 2_500_000n,
|
|
68
|
+
[toUnit(policyId, fromText(tokenName))]: 1n,
|
|
69
|
+
},
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
if (withScriptRef) {
|
|
73
|
+
tx.pay.ToAddressWithData(
|
|
74
|
+
validatorToAddress(lucid.config().network, validator),
|
|
75
|
+
undefined,
|
|
76
|
+
undefined,
|
|
77
|
+
validator,
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return [
|
|
82
|
+
tx,
|
|
83
|
+
{
|
|
84
|
+
currencySymbol: policyId,
|
|
85
|
+
tokenName: fromText(tokenName),
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static async feedInterestOracle(
|
|
91
|
+
params: InterestOracleParams,
|
|
92
|
+
newInterestRate: bigint,
|
|
93
|
+
lucid: LucidEvolution,
|
|
94
|
+
assetClass?: AssetClass,
|
|
95
|
+
utxo?: UTxO,
|
|
96
|
+
scriptRef?: UTxO,
|
|
97
|
+
): Promise<TxBuilder> {
|
|
98
|
+
if (!assetClass && !utxo)
|
|
99
|
+
throw new Error('Either interest oracle nft or utxo must be provided');
|
|
100
|
+
if (assetClass && !utxo) {
|
|
101
|
+
const [ioUtxo, _datum] = await findInterestOracle(lucid, assetClass);
|
|
102
|
+
utxo = ioUtxo;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const now = BigInt(Date.now());
|
|
106
|
+
const tx = lucid.newTx();
|
|
107
|
+
const datum = parseInterestOracleDatum(utxo.datum);
|
|
108
|
+
|
|
109
|
+
if (scriptRef) {
|
|
110
|
+
tx.readFrom([scriptRef]);
|
|
111
|
+
} else {
|
|
112
|
+
tx.attach.Script(mkInterestOracleValidator(params));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
tx.collectFrom(
|
|
116
|
+
[utxo],
|
|
117
|
+
serialiseFeedInterestOracleRedeemer({
|
|
118
|
+
newInterestRate: {
|
|
119
|
+
getOnChainInt: newInterestRate,
|
|
120
|
+
},
|
|
121
|
+
currentTime: now,
|
|
122
|
+
}),
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
tx.pay.ToContract(
|
|
126
|
+
utxo.address,
|
|
127
|
+
{
|
|
128
|
+
kind: 'inline',
|
|
129
|
+
value: serialiseInterestOracleDatum({
|
|
130
|
+
unitaryInterest:
|
|
131
|
+
datum.unitaryInterest +
|
|
132
|
+
calculateUnitaryInterestSinceOracleLastUpdated(now, datum),
|
|
133
|
+
interestRate: {
|
|
134
|
+
getOnChainInt: newInterestRate,
|
|
135
|
+
},
|
|
136
|
+
lastUpdated: now,
|
|
137
|
+
}),
|
|
138
|
+
},
|
|
139
|
+
utxo.assets,
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
tx.validFrom(Number(now) - ONE_SECOND);
|
|
143
|
+
tx.validTo(Number(now + params.biasTime) - ONE_SECOND);
|
|
144
|
+
|
|
145
|
+
tx.addSignerKey(params.owner);
|
|
146
|
+
|
|
147
|
+
return tx;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
addrDetails,
|
|
15
15
|
createScriptAddress,
|
|
16
16
|
getInlineDatumOrThrow,
|
|
17
|
-
} from '
|
|
17
|
+
} from '../helpers/lucid-utils';
|
|
18
18
|
import { match, P } from 'ts-pattern';
|
|
19
19
|
import { unzip, zip } from 'fp-ts/lib/Array';
|
|
20
20
|
import { reduceWithIndex } from 'fp-ts/lib/Array';
|
|
@@ -24,18 +24,18 @@ import {
|
|
|
24
24
|
parseLrpDatum,
|
|
25
25
|
serialiseLrpDatum,
|
|
26
26
|
serialiseLrpRedeemer,
|
|
27
|
-
} from '
|
|
28
|
-
import { parsePriceOracleDatum } from '../price-oracle
|
|
29
|
-
import { ocdMul, OnChainDecimal } from '
|
|
30
|
-
import {
|
|
27
|
+
} from '../types/indigo/lrp';
|
|
28
|
+
import { parsePriceOracleDatum } from '../types/indigo/price-oracle';
|
|
29
|
+
import { ocdMul, OnChainDecimal } from '../types/on-chain-decimal';
|
|
30
|
+
import { parseIAssetDatum } from '../types/indigo/cdp';
|
|
31
31
|
import {
|
|
32
32
|
assetClassValueOf,
|
|
33
33
|
mkAssetsOf,
|
|
34
34
|
mkLovelacesOf,
|
|
35
|
-
} from '
|
|
36
|
-
import { calculateFeeFromPercentage } from '
|
|
37
|
-
import { matchSingle } from '
|
|
38
|
-
import { AssetClass } from '
|
|
35
|
+
} from '../helpers/value-helpers';
|
|
36
|
+
import { calculateFeeFromPercentage } from '../helpers/indigo-helpers';
|
|
37
|
+
import { matchSingle } from '../helpers/helpers';
|
|
38
|
+
import { AssetClass } from '../types/generic';
|
|
39
39
|
|
|
40
40
|
const MIN_UTXO_COLLATERAL_AMT = 2_000_000n;
|
|
41
41
|
|
|
@@ -116,9 +116,7 @@ export async function redeemLrp(
|
|
|
116
116
|
(_) => new Error('Expected a single IAsset UTXO'),
|
|
117
117
|
);
|
|
118
118
|
|
|
119
|
-
const iassetDatum =
|
|
120
|
-
getInlineDatumOrThrow(iassetUtxo),
|
|
121
|
-
);
|
|
119
|
+
const iassetDatum = parseIAssetDatum(getInlineDatumOrThrow(iassetUtxo));
|
|
122
120
|
|
|
123
121
|
const [lrpsToRedeemOutRefs, lrpRedemptionIAssetAmt] =
|
|
124
122
|
unzip(redemptionLrpsData);
|
|
@@ -194,7 +192,7 @@ export async function redeemLrp(
|
|
|
194
192
|
},
|
|
195
193
|
addAssets(
|
|
196
194
|
lrpUtxo.assets,
|
|
197
|
-
mkLovelacesOf(-lovelacesForRedemption
|
|
195
|
+
mkLovelacesOf(-(lovelacesForRedemption - reimburstmentLovelaces)),
|
|
198
196
|
mkAssetsOf(
|
|
199
197
|
{
|
|
200
198
|
currencySymbol: lrpParams.iassetPolicyId,
|
|
@@ -238,6 +236,8 @@ export async function adjustLrp(
|
|
|
238
236
|
lrpRefScriptOutRef: OutRef,
|
|
239
237
|
lrpParams: LRPParams,
|
|
240
238
|
): Promise<TxBuilder> {
|
|
239
|
+
const ownAddr = await lucid.wallet().address();
|
|
240
|
+
|
|
241
241
|
const lrpScriptRefUtxo = matchSingle(
|
|
242
242
|
await lucid.utxosByOutRef([lrpRefScriptOutRef]),
|
|
243
243
|
(_) => new Error('Expected a single LRP Ref Script UTXO'),
|
|
@@ -292,7 +292,7 @@ export async function adjustLrp(
|
|
|
292
292
|
mkLovelacesOf(lovelacesAdjustAmt),
|
|
293
293
|
),
|
|
294
294
|
)
|
|
295
|
-
.
|
|
295
|
+
.addSigner(ownAddr);
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
/**
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
toUnit,
|
|
10
10
|
TxBuilder,
|
|
11
11
|
} from '@lucid-evolution/lucid';
|
|
12
|
-
import { OneShotParams } from '
|
|
13
|
-
import { matchSingle } from '
|
|
14
|
-
import { mkOneShotPolicy } from '
|
|
12
|
+
import { OneShotParams } from '../types/one-shot';
|
|
13
|
+
import { matchSingle } from '../helpers/helpers';
|
|
14
|
+
import { mkOneShotPolicy } from '../scripts/one-shot-policy';
|
|
15
15
|
import { reduce } from 'fp-ts/lib/Array';
|
|
16
16
|
|
|
17
17
|
export async function oneShotMintTx(
|