@indigo-labs/indigo-sdk 0.1.27 → 0.1.28
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/index.js +8 -2
- package/dist/index.mjs +8 -2
- package/package.json +1 -1
- package/src/contracts/cdp.ts +11 -4
package/dist/index.js
CHANGED
|
@@ -940,10 +940,12 @@ var CDPContract = class _CDPContract {
|
|
|
940
940
|
const cdpDatum = parseCDPDatum(cdp.datum);
|
|
941
941
|
console.log("cdpDatum.iasset", cdpDatum.iasset);
|
|
942
942
|
const iAsset = await (assetRef ? IAssetHelpers.findIAssetByRef(assetRef, lucid) : IAssetHelpers.findIAssetByName(cdpDatum.iasset, params, lucid));
|
|
943
|
+
console.log("iasset output", iAsset.utxo.txHash, iAsset.utxo.outputIndex);
|
|
943
944
|
const gov = govRef ? (await lucid.utxosByOutRef([govRef]))[0] : await lucid.utxoByUnit(
|
|
944
945
|
params.govParams.govNFT[0].unCurrencySymbol + (0, import_lucid13.fromText)(params.govParams.govNFT[1].unTokenName)
|
|
945
946
|
);
|
|
946
947
|
if (!gov.datum) throw new Error("Unable to find Gov Datum");
|
|
948
|
+
console.log("gov output", gov.txHash, gov.outputIndex);
|
|
947
949
|
const govData = parseGovDatum(gov.datum);
|
|
948
950
|
const cdpScriptRefUtxo = await _CDPContract.scriptRef(
|
|
949
951
|
params.scriptReferences,
|
|
@@ -952,6 +954,7 @@ var CDPContract = class _CDPContract {
|
|
|
952
954
|
const cdpAssets = Object.assign({}, cdp.assets);
|
|
953
955
|
cdpAssets["lovelace"] = cdp.assets["lovelace"] + collateralAmount;
|
|
954
956
|
const interestOracleAsset = iAsset.datum.interestOracleNft;
|
|
957
|
+
console.log("interestOracleAsset", interestOracleAsset.currencySymbol + interestOracleAsset.tokenName);
|
|
955
958
|
const interestOracleOut = interestOracleRef ? (await lucid.utxosByOutRef([interestOracleRef]))[0] : await lucid.utxoByUnit(
|
|
956
959
|
interestOracleAsset.currencySymbol + interestOracleAsset.tokenName
|
|
957
960
|
);
|
|
@@ -993,8 +996,9 @@ var CDPContract = class _CDPContract {
|
|
|
993
996
|
const oracleAsset = iAsset.datum.price;
|
|
994
997
|
if (!("Oracle" in oracleAsset)) throw new Error("Invalid oracle asset");
|
|
995
998
|
const oracleRefInput = priceOracleRef ? (await lucid.utxosByOutRef([priceOracleRef]))[0] : await lucid.utxoByUnit(
|
|
996
|
-
oracleAsset.Oracle.oracleNft.asset.currencySymbol +
|
|
999
|
+
oracleAsset.Oracle.oracleNft.asset.currencySymbol + oracleAsset.Oracle.oracleNft.asset.tokenName
|
|
997
1000
|
);
|
|
1001
|
+
console.log("oracleRefInput", oracleRefInput.txHash, oracleRefInput.outputIndex);
|
|
998
1002
|
if (!oracleRefInput.datum)
|
|
999
1003
|
return Promise.reject(new Error("Invalid oracle input"));
|
|
1000
1004
|
const od = parsePriceOracleDatum(oracleRefInput.datum);
|
|
@@ -1077,6 +1081,7 @@ var CDPContract = class _CDPContract {
|
|
|
1077
1081
|
lucid
|
|
1078
1082
|
);
|
|
1079
1083
|
const interestOracleAsset = iAsset.datum.interestOracleNft;
|
|
1084
|
+
console.log("interestOracleAsset", interestOracleAsset.currencySymbol + interestOracleAsset.tokenName);
|
|
1080
1085
|
const interestOracleOut = interestOracleRef ? (await lucid.utxosByOutRef([interestOracleRef]))[0] : await lucid.utxoByUnit(
|
|
1081
1086
|
interestOracleAsset.currencySymbol + interestOracleAsset.tokenName
|
|
1082
1087
|
);
|
|
@@ -1094,8 +1099,9 @@ var CDPContract = class _CDPContract {
|
|
|
1094
1099
|
throw new Error("iAsset is delisted");
|
|
1095
1100
|
const oracleAsset = iAsset.datum.price.Oracle.oracleNft.asset;
|
|
1096
1101
|
const oracleRefInput = priceOracleRef ? (await lucid.utxosByOutRef([priceOracleRef]))[0] : await lucid.utxoByUnit(
|
|
1097
|
-
oracleAsset.currencySymbol +
|
|
1102
|
+
oracleAsset.currencySymbol + oracleAsset.tokenName
|
|
1098
1103
|
);
|
|
1104
|
+
console.log("oracleRefInput", oracleRefInput.txHash, oracleRefInput.outputIndex);
|
|
1099
1105
|
if (!oracleRefInput.datum)
|
|
1100
1106
|
return Promise.reject(new Error("Invalid oracle input"));
|
|
1101
1107
|
const od = parsePriceOracleDatum(oracleRefInput.datum);
|
package/dist/index.mjs
CHANGED
|
@@ -811,10 +811,12 @@ var CDPContract = class _CDPContract {
|
|
|
811
811
|
const cdpDatum = parseCDPDatum(cdp.datum);
|
|
812
812
|
console.log("cdpDatum.iasset", cdpDatum.iasset);
|
|
813
813
|
const iAsset = await (assetRef ? IAssetHelpers.findIAssetByRef(assetRef, lucid) : IAssetHelpers.findIAssetByName(cdpDatum.iasset, params, lucid));
|
|
814
|
+
console.log("iasset output", iAsset.utxo.txHash, iAsset.utxo.outputIndex);
|
|
814
815
|
const gov = govRef ? (await lucid.utxosByOutRef([govRef]))[0] : await lucid.utxoByUnit(
|
|
815
816
|
params.govParams.govNFT[0].unCurrencySymbol + fromText4(params.govParams.govNFT[1].unTokenName)
|
|
816
817
|
);
|
|
817
818
|
if (!gov.datum) throw new Error("Unable to find Gov Datum");
|
|
819
|
+
console.log("gov output", gov.txHash, gov.outputIndex);
|
|
818
820
|
const govData = parseGovDatum(gov.datum);
|
|
819
821
|
const cdpScriptRefUtxo = await _CDPContract.scriptRef(
|
|
820
822
|
params.scriptReferences,
|
|
@@ -823,6 +825,7 @@ var CDPContract = class _CDPContract {
|
|
|
823
825
|
const cdpAssets = Object.assign({}, cdp.assets);
|
|
824
826
|
cdpAssets["lovelace"] = cdp.assets["lovelace"] + collateralAmount;
|
|
825
827
|
const interestOracleAsset = iAsset.datum.interestOracleNft;
|
|
828
|
+
console.log("interestOracleAsset", interestOracleAsset.currencySymbol + interestOracleAsset.tokenName);
|
|
826
829
|
const interestOracleOut = interestOracleRef ? (await lucid.utxosByOutRef([interestOracleRef]))[0] : await lucid.utxoByUnit(
|
|
827
830
|
interestOracleAsset.currencySymbol + interestOracleAsset.tokenName
|
|
828
831
|
);
|
|
@@ -864,8 +867,9 @@ var CDPContract = class _CDPContract {
|
|
|
864
867
|
const oracleAsset = iAsset.datum.price;
|
|
865
868
|
if (!("Oracle" in oracleAsset)) throw new Error("Invalid oracle asset");
|
|
866
869
|
const oracleRefInput = priceOracleRef ? (await lucid.utxosByOutRef([priceOracleRef]))[0] : await lucid.utxoByUnit(
|
|
867
|
-
oracleAsset.Oracle.oracleNft.asset.currencySymbol +
|
|
870
|
+
oracleAsset.Oracle.oracleNft.asset.currencySymbol + oracleAsset.Oracle.oracleNft.asset.tokenName
|
|
868
871
|
);
|
|
872
|
+
console.log("oracleRefInput", oracleRefInput.txHash, oracleRefInput.outputIndex);
|
|
869
873
|
if (!oracleRefInput.datum)
|
|
870
874
|
return Promise.reject(new Error("Invalid oracle input"));
|
|
871
875
|
const od = parsePriceOracleDatum(oracleRefInput.datum);
|
|
@@ -948,6 +952,7 @@ var CDPContract = class _CDPContract {
|
|
|
948
952
|
lucid
|
|
949
953
|
);
|
|
950
954
|
const interestOracleAsset = iAsset.datum.interestOracleNft;
|
|
955
|
+
console.log("interestOracleAsset", interestOracleAsset.currencySymbol + interestOracleAsset.tokenName);
|
|
951
956
|
const interestOracleOut = interestOracleRef ? (await lucid.utxosByOutRef([interestOracleRef]))[0] : await lucid.utxoByUnit(
|
|
952
957
|
interestOracleAsset.currencySymbol + interestOracleAsset.tokenName
|
|
953
958
|
);
|
|
@@ -965,8 +970,9 @@ var CDPContract = class _CDPContract {
|
|
|
965
970
|
throw new Error("iAsset is delisted");
|
|
966
971
|
const oracleAsset = iAsset.datum.price.Oracle.oracleNft.asset;
|
|
967
972
|
const oracleRefInput = priceOracleRef ? (await lucid.utxosByOutRef([priceOracleRef]))[0] : await lucid.utxoByUnit(
|
|
968
|
-
oracleAsset.currencySymbol +
|
|
973
|
+
oracleAsset.currencySymbol + oracleAsset.tokenName
|
|
969
974
|
);
|
|
975
|
+
console.log("oracleRefInput", oracleRefInput.txHash, oracleRefInput.outputIndex);
|
|
970
976
|
if (!oracleRefInput.datum)
|
|
971
977
|
return Promise.reject(new Error("Invalid oracle input"));
|
|
972
978
|
const od = parsePriceOracleDatum(oracleRefInput.datum);
|
package/package.json
CHANGED
package/src/contracts/cdp.ts
CHANGED
|
@@ -352,6 +352,7 @@ export class CDPContract {
|
|
|
352
352
|
const iAsset = await (assetRef
|
|
353
353
|
? IAssetHelpers.findIAssetByRef(assetRef, lucid)
|
|
354
354
|
: IAssetHelpers.findIAssetByName(cdpDatum.iasset, params, lucid));
|
|
355
|
+
console.log('iasset output', iAsset.utxo.txHash, iAsset.utxo.outputIndex);
|
|
355
356
|
|
|
356
357
|
const gov = govRef
|
|
357
358
|
? (await lucid.utxosByOutRef([govRef]))[0]
|
|
@@ -360,6 +361,8 @@ export class CDPContract {
|
|
|
360
361
|
fromText(params.govParams.govNFT[1].unTokenName),
|
|
361
362
|
);
|
|
362
363
|
if (!gov.datum) throw new Error('Unable to find Gov Datum');
|
|
364
|
+
|
|
365
|
+
console.log('gov output', gov.txHash, gov.outputIndex);
|
|
363
366
|
const govData = parseGovDatum(gov.datum);
|
|
364
367
|
const cdpScriptRefUtxo = await CDPContract.scriptRef(
|
|
365
368
|
params.scriptReferences,
|
|
@@ -369,6 +372,7 @@ export class CDPContract {
|
|
|
369
372
|
cdpAssets['lovelace'] = cdp.assets['lovelace'] + collateralAmount;
|
|
370
373
|
|
|
371
374
|
const interestOracleAsset = iAsset.datum.interestOracleNft;
|
|
375
|
+
console.log('interestOracleAsset', interestOracleAsset.currencySymbol + interestOracleAsset.tokenName);
|
|
372
376
|
const interestOracleOut = interestOracleRef
|
|
373
377
|
? (await lucid.utxosByOutRef([interestOracleRef]))[0]
|
|
374
378
|
: await lucid.utxoByUnit(
|
|
@@ -426,10 +430,10 @@ export class CDPContract {
|
|
|
426
430
|
const oracleRefInput = priceOracleRef
|
|
427
431
|
? (await lucid.utxosByOutRef([priceOracleRef]))[0]
|
|
428
432
|
: await lucid.utxoByUnit(
|
|
429
|
-
oracleAsset.Oracle.oracleNft.asset.currencySymbol +
|
|
430
|
-
fromText(oracleAsset.Oracle.oracleNft.asset.tokenName),
|
|
433
|
+
oracleAsset.Oracle.oracleNft.asset.currencySymbol + oracleAsset.Oracle.oracleNft.asset.tokenName,
|
|
431
434
|
);
|
|
432
435
|
|
|
436
|
+
console.log('oracleRefInput', oracleRefInput.txHash, oracleRefInput.outputIndex);
|
|
433
437
|
// Fail if delisted asset
|
|
434
438
|
if (!oracleRefInput.datum)
|
|
435
439
|
return Promise.reject(new Error('Invalid oracle input'));
|
|
@@ -550,8 +554,9 @@ export class CDPContract {
|
|
|
550
554
|
params.scriptReferences,
|
|
551
555
|
lucid,
|
|
552
556
|
);
|
|
553
|
-
|
|
557
|
+
|
|
554
558
|
const interestOracleAsset = iAsset.datum.interestOracleNft;
|
|
559
|
+
console.log('interestOracleAsset', interestOracleAsset.currencySymbol + interestOracleAsset.tokenName);
|
|
555
560
|
const interestOracleOut = interestOracleRef
|
|
556
561
|
? (await lucid.utxosByOutRef([interestOracleRef]))[0]
|
|
557
562
|
: await lucid.utxoByUnit(
|
|
@@ -580,9 +585,11 @@ export class CDPContract {
|
|
|
580
585
|
const oracleRefInput = priceOracleRef
|
|
581
586
|
? (await lucid.utxosByOutRef([priceOracleRef]))[0]
|
|
582
587
|
: await lucid.utxoByUnit(
|
|
583
|
-
oracleAsset.currencySymbol +
|
|
588
|
+
oracleAsset.currencySymbol + oracleAsset.tokenName,
|
|
584
589
|
);
|
|
585
590
|
|
|
591
|
+
console.log('oracleRefInput', oracleRefInput.txHash, oracleRefInput.outputIndex);
|
|
592
|
+
|
|
586
593
|
// Fail if delisted asset
|
|
587
594
|
if (!oracleRefInput.datum)
|
|
588
595
|
return Promise.reject(new Error('Invalid oracle input'));
|