@indigo-labs/indigo-sdk 0.3.28 → 0.4.0
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 +25 -11
- package/dist/index.mjs +25 -11
- package/package.json +3 -3
- package/src/contracts/initialize/actions.ts +31 -15
package/dist/index.js
CHANGED
|
@@ -10504,15 +10504,22 @@ async function initPythConfig(lucid, initialAssets, pythStateAsset) {
|
|
|
10504
10504
|
lucid,
|
|
10505
10505
|
pythFeedValidator
|
|
10506
10506
|
);
|
|
10507
|
-
|
|
10508
|
-
|
|
10509
|
-
|
|
10510
|
-
|
|
10511
|
-
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
|
-
|
|
10515
|
-
|
|
10507
|
+
try {
|
|
10508
|
+
await runAndAwaitTxBuilder(
|
|
10509
|
+
lucid,
|
|
10510
|
+
lucid.newTx().register.Stake(
|
|
10511
|
+
(0, import_lucid65.credentialToRewardAddress)(lucid.config().network, {
|
|
10512
|
+
hash: (0, import_lucid65.validatorToScriptHash)(pythFeedValidator),
|
|
10513
|
+
type: "Script"
|
|
10514
|
+
})
|
|
10515
|
+
)
|
|
10516
|
+
);
|
|
10517
|
+
} catch (error) {
|
|
10518
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
10519
|
+
if (!message.includes("StakeKeyRegisteredDELEG") && !message.includes("Trying to re-register some already known credentials.")) {
|
|
10520
|
+
throw error;
|
|
10521
|
+
}
|
|
10522
|
+
}
|
|
10516
10523
|
const key = `${asset.name}/${(0, import_lucid65.toHex)(collateral.collateralAsset.currencySymbol)}.${(0, import_lucid65.toHex)(collateral.collateralAsset.tokenName)}`;
|
|
10517
10524
|
return {
|
|
10518
10525
|
[key]: {
|
|
@@ -10702,7 +10709,14 @@ async function init(lucid, defaultInitialAssets, currentSlot, mkPythBasedAssets
|
|
|
10702
10709
|
lucid.config().network,
|
|
10703
10710
|
(0, import_lucid65.scriptHashToCredential)(cdpRedeemValHash)
|
|
10704
10711
|
);
|
|
10705
|
-
|
|
10712
|
+
try {
|
|
10713
|
+
await runAndAwaitTxBuilder(lucid, lucid.newTx().register.Stake(cdpRedeemRewardAddr));
|
|
10714
|
+
} catch (error) {
|
|
10715
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
10716
|
+
if (!message.includes("StakeKeyRegisteredDELEG") && !message.includes("Trying to re-register some already known credentials.")) {
|
|
10717
|
+
throw error;
|
|
10718
|
+
}
|
|
10719
|
+
}
|
|
10706
10720
|
const cdpParams = {
|
|
10707
10721
|
cdpAuthToken: toSystemParamsAsset(cdpToken),
|
|
10708
10722
|
cdpAssetSymbol: { unCurrencySymbol: assetSymbol },
|
|
@@ -10886,7 +10900,7 @@ async function init(lucid, defaultInitialAssets, currentSlot, mkPythBasedAssets
|
|
|
10886
10900
|
lucid,
|
|
10887
10901
|
govParams,
|
|
10888
10902
|
govNftAsset,
|
|
10889
|
-
|
|
10903
|
+
initialAssets,
|
|
10890
10904
|
protocolParams
|
|
10891
10905
|
);
|
|
10892
10906
|
const robParams = {
|
package/dist/index.mjs
CHANGED
|
@@ -10401,15 +10401,22 @@ async function initPythConfig(lucid, initialAssets, pythStateAsset) {
|
|
|
10401
10401
|
lucid,
|
|
10402
10402
|
pythFeedValidator
|
|
10403
10403
|
);
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10404
|
+
try {
|
|
10405
|
+
await runAndAwaitTxBuilder(
|
|
10406
|
+
lucid,
|
|
10407
|
+
lucid.newTx().register.Stake(
|
|
10408
|
+
credentialToRewardAddress4(lucid.config().network, {
|
|
10409
|
+
hash: validatorToScriptHash5(pythFeedValidator),
|
|
10410
|
+
type: "Script"
|
|
10411
|
+
})
|
|
10412
|
+
)
|
|
10413
|
+
);
|
|
10414
|
+
} catch (error) {
|
|
10415
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
10416
|
+
if (!message.includes("StakeKeyRegisteredDELEG") && !message.includes("Trying to re-register some already known credentials.")) {
|
|
10417
|
+
throw error;
|
|
10418
|
+
}
|
|
10419
|
+
}
|
|
10413
10420
|
const key = `${asset.name}/${toHex16(collateral.collateralAsset.currencySymbol)}.${toHex16(collateral.collateralAsset.tokenName)}`;
|
|
10414
10421
|
return {
|
|
10415
10422
|
[key]: {
|
|
@@ -10599,7 +10606,14 @@ async function init(lucid, defaultInitialAssets, currentSlot, mkPythBasedAssets
|
|
|
10599
10606
|
lucid.config().network,
|
|
10600
10607
|
scriptHashToCredential4(cdpRedeemValHash)
|
|
10601
10608
|
);
|
|
10602
|
-
|
|
10609
|
+
try {
|
|
10610
|
+
await runAndAwaitTxBuilder(lucid, lucid.newTx().register.Stake(cdpRedeemRewardAddr));
|
|
10611
|
+
} catch (error) {
|
|
10612
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
10613
|
+
if (!message.includes("StakeKeyRegisteredDELEG") && !message.includes("Trying to re-register some already known credentials.")) {
|
|
10614
|
+
throw error;
|
|
10615
|
+
}
|
|
10616
|
+
}
|
|
10603
10617
|
const cdpParams = {
|
|
10604
10618
|
cdpAuthToken: toSystemParamsAsset(cdpToken),
|
|
10605
10619
|
cdpAssetSymbol: { unCurrencySymbol: assetSymbol },
|
|
@@ -10783,7 +10797,7 @@ async function init(lucid, defaultInitialAssets, currentSlot, mkPythBasedAssets
|
|
|
10783
10797
|
lucid,
|
|
10784
10798
|
govParams,
|
|
10785
10799
|
govNftAsset,
|
|
10786
|
-
|
|
10800
|
+
initialAssets,
|
|
10787
10801
|
protocolParams
|
|
10788
10802
|
);
|
|
10789
10803
|
const robParams = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indigo-labs/indigo-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Indigo SDK for interacting with Indigo endpoints via lucid-evolution",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"packageManager": "pnpm@10.33.4",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@3rd-eye-labs/cardano-offchain-common": "1.
|
|
44
|
+
"@3rd-eye-labs/cardano-offchain-common": "1.4.7",
|
|
45
45
|
"@evolution-sdk/evolution": "^0.3.22",
|
|
46
46
|
"@harmoniclabs/crypto": "^0.3.0",
|
|
47
|
-
"@lucid-evolution/lucid": "
|
|
47
|
+
"@lucid-evolution/lucid": "0.5.5",
|
|
48
48
|
"@noble/ed25519": "^3.0.0",
|
|
49
49
|
"@pythnetwork/pyth-lazer-sdk": "^6.0.0",
|
|
50
50
|
"decimal.js": "^10.6.0",
|
|
@@ -69,7 +69,6 @@ import { mkStabilityPoolValidatorFromSP } from '../stability-pool/scripts';
|
|
|
69
69
|
import { mkTreasuryValidatorFromSP } from '../treasury/scripts';
|
|
70
70
|
import { mkCDPCreatorValidatorFromSP } from '../cdp-creator/scripts';
|
|
71
71
|
import { mkGovValidatorFromSP } from '../gov/scripts';
|
|
72
|
-
import { submitTx } from '../../utils/lucid-utils';
|
|
73
72
|
import {
|
|
74
73
|
deriveAuthToken,
|
|
75
74
|
initScriptRef,
|
|
@@ -121,17 +120,26 @@ export async function initPythConfig(
|
|
|
121
120
|
pythFeedValidator,
|
|
122
121
|
);
|
|
123
122
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
123
|
+
try {
|
|
124
|
+
// Register the stake key for pyth feed validator.
|
|
125
|
+
await runAndAwaitTxBuilder(
|
|
126
|
+
lucid,
|
|
127
|
+
lucid.newTx().register.Stake(
|
|
128
|
+
credentialToRewardAddress(lucid.config().network!, {
|
|
129
|
+
hash: validatorToScriptHash(pythFeedValidator),
|
|
130
|
+
type: 'Script',
|
|
131
|
+
}),
|
|
132
|
+
),
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
} catch (error) {
|
|
136
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
137
|
+
if (
|
|
138
|
+
!message.includes('StakeKeyRegisteredDELEG') && !message.includes('Trying to re-register some already known credentials.')
|
|
139
|
+
) {
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
135
143
|
const key = `${asset.name}/${toHex(collateral.collateralAsset.currencySymbol)}.${toHex(collateral.collateralAsset.tokenName)}`;
|
|
136
144
|
|
|
137
145
|
return {
|
|
@@ -368,8 +376,16 @@ export async function init(
|
|
|
368
376
|
scriptHashToCredential(cdpRedeemValHash),
|
|
369
377
|
);
|
|
370
378
|
|
|
371
|
-
|
|
372
|
-
|
|
379
|
+
try {
|
|
380
|
+
await runAndAwaitTxBuilder(lucid, lucid.newTx().register.Stake(cdpRedeemRewardAddr));
|
|
381
|
+
} catch (error) {
|
|
382
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
383
|
+
if (
|
|
384
|
+
!message.includes('StakeKeyRegisteredDELEG') && !message.includes('Trying to re-register some already known credentials.')
|
|
385
|
+
) {
|
|
386
|
+
throw error;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
373
389
|
const cdpParams: CdpParamsSP = {
|
|
374
390
|
cdpAuthToken: toSystemParamsAsset(cdpToken),
|
|
375
391
|
cdpAssetSymbol: { unCurrencySymbol: assetSymbol },
|
|
@@ -578,7 +594,7 @@ export async function init(
|
|
|
578
594
|
lucid,
|
|
579
595
|
govParams,
|
|
580
596
|
govNftAsset,
|
|
581
|
-
|
|
597
|
+
initialAssets,
|
|
582
598
|
protocolParams,
|
|
583
599
|
);
|
|
584
600
|
|