@indigo-labs/indigo-sdk 0.1.7 → 0.1.8
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 +62 -0
- package/.github/workflows/test.yml +44 -0
- package/.husky/pre-commit +1 -0
- package/.nvmrc +1 -0
- package/.prettierrc +6 -0
- package/dist/index.d.mts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +15 -0
- package/dist/index.mjs +14 -0
- package/eslint.config.mjs +36 -0
- package/package.json +2 -5
- package/src/contracts/cdp.ts +741 -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.ts +315 -0
- package/src/contracts/one-shot.ts +67 -0
- package/src/contracts/stability-pool.ts +684 -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/helpers/helper-txs.ts +30 -0
- package/src/helpers/helpers.ts +38 -0
- package/src/helpers/indigo-helpers.ts +19 -0
- package/src/helpers/interest-oracle.ts +57 -0
- package/src/helpers/lucid-utils.ts +70 -0
- package/src/helpers/price-oracle-helpers.ts +36 -0
- package/src/helpers/stability-pool-helpers.ts +207 -0
- package/src/helpers/staking-helpers.ts +94 -0
- package/src/helpers/time-helpers.ts +4 -0
- package/src/helpers/value-helpers.ts +27 -0
- package/src/index.ts +34 -0
- package/src/scripts/always-fail-validator.ts +7 -0
- package/src/scripts/auth-token-policy.ts +23 -0
- package/src/scripts/cdp-creator-validator.ts +53 -0
- package/src/scripts/cdp-validator.ts +9 -0
- package/src/scripts/collector-validator.ts +8 -0
- package/src/scripts/execute-validator.ts +52 -0
- package/src/scripts/gov-validator.ts +44 -0
- package/src/scripts/iasset-policy.ts +22 -0
- package/src/scripts/interest-oracle-validator.ts +23 -0
- package/src/scripts/lrp-validator.ts +40 -0
- package/src/scripts/one-shot-policy.ts +62 -0
- package/src/scripts/poll-manager-validator.ts +52 -0
- package/src/scripts/poll-shard-validator.ts +47 -0
- package/src/scripts/price-oracle-validator.ts +26 -0
- package/src/scripts/stability-pool-validator.ts +60 -0
- package/src/scripts/staking-validator.ts +8 -0
- package/src/scripts/treasury-validator.ts +8 -0
- package/src/scripts/version-record-policy.ts +26 -0
- package/src/scripts/version-registry.ts +15 -0
- package/src/types/generic.ts +106 -0
- package/src/types/indigo/cdp-creator.ts +46 -0
- 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/types/indigo/interest-oracle.ts +55 -0
- package/src/types/indigo/lrp.ts +59 -0
- package/src/types/indigo/poll-manager.ts +21 -0
- package/src/types/indigo/poll-shard.ts +16 -0
- package/src/types/indigo/price-oracle.ts +38 -0
- package/src/types/indigo/stability-pool.ts +233 -0
- package/src/types/indigo/staking.ts +99 -0
- package/src/types/indigo/version-record.ts +17 -0
- package/src/types/on-chain-decimal.ts +23 -0
- package/src/types/one-shot.ts +22 -0
- package/src/types/system-params.ts +256 -0
- package/tests/data/system-params.json +1012 -0
- package/tests/datums.test.ts +286 -0
- package/tests/endpoints/initialize.ts +1013 -0
- package/tests/hash-checks.test.ts +80 -0
- package/tests/indigo-test-helpers.ts +115 -0
- package/tests/initialize.test.ts +27 -0
- package/tests/interest-calculations.test.ts +120 -0
- package/tests/interest-oracle.test.ts +90 -0
- package/tests/lrp.test.ts +777 -0
- package/tests/queries/governance-queries.ts +31 -0
- package/tests/queries/iasset-queries.ts +39 -0
- package/tests/queries/interest-oracle-queries.ts +13 -0
- package/tests/queries/lrp-queries.ts +39 -0
- package/tests/queries/price-oracle-queries.ts +27 -0
- package/tests/queries/stability-pool-queries.ts +75 -0
- package/tests/queries/staking-queries.ts +43 -0
- package/tests/stability-pool.test.ts +364 -0
- package/tests/staking.test.ts +105 -0
- package/tests/test-helpers.ts +38 -0
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +17 -0
- package/vitest.config.ts +9 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint-and-build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup Node.js
|
|
18
|
+
uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version-file: '.nvmrc'
|
|
21
|
+
|
|
22
|
+
- name: Setup pnpm
|
|
23
|
+
uses: pnpm/action-setup@v4
|
|
24
|
+
with:
|
|
25
|
+
version: latest
|
|
26
|
+
|
|
27
|
+
- name: Get pnpm store directory
|
|
28
|
+
shell: bash
|
|
29
|
+
run: |
|
|
30
|
+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
31
|
+
|
|
32
|
+
- name: Setup pnpm cache
|
|
33
|
+
uses: actions/cache@v4
|
|
34
|
+
with:
|
|
35
|
+
path: ${{ env.STORE_PATH }}
|
|
36
|
+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
37
|
+
restore-keys: |
|
|
38
|
+
${{ runner.os }}-pnpm-store-
|
|
39
|
+
|
|
40
|
+
- name: Install dependencies
|
|
41
|
+
run: pnpm install --frozen-lockfile
|
|
42
|
+
|
|
43
|
+
- name: Check formatting
|
|
44
|
+
run: pnpm run format:check
|
|
45
|
+
|
|
46
|
+
- name: Check linting
|
|
47
|
+
run: pnpm run lint
|
|
48
|
+
|
|
49
|
+
- name: Build project
|
|
50
|
+
run: pnpm run build
|
|
51
|
+
|
|
52
|
+
- name: Verify build output
|
|
53
|
+
run: |
|
|
54
|
+
if [ ! -d "dist" ]; then
|
|
55
|
+
echo "Build failed: dist directory not found"
|
|
56
|
+
exit 1
|
|
57
|
+
fi
|
|
58
|
+
if [ ! -f "dist/index.js" ] || [ ! -f "dist/index.mjs" ] || [ ! -f "dist/index.d.ts" ]; then
|
|
59
|
+
echo "Build failed: expected output files not found"
|
|
60
|
+
exit 1
|
|
61
|
+
fi
|
|
62
|
+
echo "Build verification passed"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup Node.js
|
|
18
|
+
uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version-file: '.nvmrc'
|
|
21
|
+
|
|
22
|
+
- name: Setup pnpm
|
|
23
|
+
uses: pnpm/action-setup@v4
|
|
24
|
+
with:
|
|
25
|
+
version: latest
|
|
26
|
+
|
|
27
|
+
- name: Get pnpm store directory
|
|
28
|
+
shell: bash
|
|
29
|
+
run: |
|
|
30
|
+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
31
|
+
|
|
32
|
+
- name: Setup pnpm cache
|
|
33
|
+
uses: actions/cache@v4
|
|
34
|
+
with:
|
|
35
|
+
path: ${{ env.STORE_PATH }}
|
|
36
|
+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
37
|
+
restore-keys: |
|
|
38
|
+
${{ runner.os }}-pnpm-store-
|
|
39
|
+
|
|
40
|
+
- name: Install dependencies
|
|
41
|
+
run: pnpm install --frozen-lockfile
|
|
42
|
+
|
|
43
|
+
- name: Run tests
|
|
44
|
+
run: pnpm run test
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pnpm exec lint-staged
|
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v18.19.1
|
package/.prettierrc
ADDED
package/dist/index.d.mts
CHANGED
|
@@ -67,6 +67,7 @@ interface SystemParams {
|
|
|
67
67
|
scriptReferences: ScriptReferences;
|
|
68
68
|
pollShardParams: PollShardParamsSP;
|
|
69
69
|
pollManagerParams: PollManagerParamsSP;
|
|
70
|
+
lrpParams: LrpParamsSP;
|
|
70
71
|
indyToken: AssetClassSP;
|
|
71
72
|
govParams: GovParamsSP;
|
|
72
73
|
executeParams: ExecuteParamsSP;
|
|
@@ -82,6 +83,7 @@ type ValidatorHashes = {
|
|
|
82
83
|
stabilityPoolHash: string;
|
|
83
84
|
pollShardHash: string;
|
|
84
85
|
pollManagerHash: string;
|
|
86
|
+
lrpHash: string;
|
|
85
87
|
govHash: string;
|
|
86
88
|
executeHash: string;
|
|
87
89
|
collectorHash: string;
|
|
@@ -145,6 +147,7 @@ interface ScriptReferences {
|
|
|
145
147
|
stabilityPoolValidatorRef: ScriptReference;
|
|
146
148
|
pollShardValidatorRef: ScriptReference;
|
|
147
149
|
pollManagerValidatorRef: ScriptReference;
|
|
150
|
+
lrpValidatorRef: ScriptReference;
|
|
148
151
|
liquidityValidatorRef: ScriptReference;
|
|
149
152
|
iAssetTokenPolicyRef: ScriptReference;
|
|
150
153
|
governanceValidatorRef: ScriptReference;
|
|
@@ -197,6 +200,12 @@ interface AuthTokenPolicies {
|
|
|
197
200
|
cdpAuthTokenRef: ScriptReference;
|
|
198
201
|
accountTokenRef: ScriptReference;
|
|
199
202
|
}
|
|
203
|
+
interface LrpParamsSP {
|
|
204
|
+
versionRecordToken: AssetClassSP;
|
|
205
|
+
iassetNft: AssetClassSP;
|
|
206
|
+
iassetPolicyId: CurrencySymbol;
|
|
207
|
+
minRedemptionLovelacesAmt: bigint;
|
|
208
|
+
}
|
|
200
209
|
interface PollShardParamsSP {
|
|
201
210
|
stakingValHash: string;
|
|
202
211
|
stakingToken: AssetClassSP;
|
|
@@ -1296,6 +1305,7 @@ lovelacesAdjustAmt: bigint, lrpRefScriptOutRef: OutRef, lrpParams: LRPParams): P
|
|
|
1296
1305
|
declare function claimLrp(lucid: LucidEvolution, lrpOutRef: OutRef, lrpRefScriptOutRef: OutRef, lrpParams: LRPParams): Promise<TxBuilder>;
|
|
1297
1306
|
|
|
1298
1307
|
declare const mkLrpValidator: (params: LRPParams) => SpendingValidator;
|
|
1308
|
+
declare const mkLrpValidatorFromSP: (params: LrpParamsSP) => SpendingValidator;
|
|
1299
1309
|
|
|
1300
1310
|
/**
|
|
1301
1311
|
* Uses an always fail validator for the destination address.
|
|
@@ -1317,4 +1327,4 @@ type OneShotParams = Data.Static<typeof OneShotParamsSchema>;
|
|
|
1317
1327
|
declare function oneShotMintTx(lucid: LucidEvolution, params: OneShotParams): Promise<[TxBuilder, PolicyId]>;
|
|
1318
1328
|
declare function runOneShotMintTx(lucid: LucidEvolution, params: OneShotParams): Promise<PolicyId>;
|
|
1319
1329
|
|
|
1320
|
-
export { AccountAction, AccountActionSchema, AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, Address, type AddressCredential, type AddressCredentialOrDatum, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPContract, type CDPCreatorParamsSP, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CdpParams, CollectorContract, type CollectorParams, Credential, CredentialSchema, type CurrencySymbol, type DistributionParams, EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, GovContract, type GovDatum, GovParams, type GovParamsSP, type IAssetContent, IAssetContentSchema, IAssetHelpers, type IAssetOutput, type Input, InterestOracleContract, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type LRPDatum, LRPDatumSchema, type LRPParams, LRPParamsSchema, type LRPRedeemer, LRPRedeemerSchema, ONE_SECOND, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, PollManagerParams, type PollManagerParamsSP, PollShardParams, type PollShardParamsSP, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PubKeyHash, SPInteger, SPIntegerSchema, type ScriptCredential, type ScriptOutput, type ScriptRef, type ScriptReference, type ScriptReferences, SnapshotEpochToScaleToSumContent, SnapshotEpochToScaleToSumContentSchema, StabilityPoolContent, StabilityPoolContentSchema, StabilityPoolContract, StabilityPoolDatum, StabilityPoolDatumSchema, StabilityPoolParams, type StabilityPoolParamsSP, StabilityPoolRedeemer, StabilityPoolRedeemerSchema, StabilityPoolSnapshot, StakingContract, type StakingParams, type StartTime, type SystemParams, type TokenName, TreasuryContract, type TreasuryParams, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, _cdpValidator, _collectorValidator, _treasuryValidator, addrDetails, addressFromBech32, addressToBech32, adjustLrp, balance, calculateFeeFromPercentage, cancelLrp, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, cdpCreatorValidator, claimLrp, createScriptAddress, fromSPInteger, fromSystemParamsAsset, getInlineDatumOrThrow, getRandomElement, loadSystemParamsFromFile, loadSystemParamsFromUrl, matchSingle, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkInterestOracleValidator, mkLrpValidator, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkSPInteger, oneDay, oneHour, oneShotMintTx, oneYear, openLrp, parseAccountDatum, parseCDPDatum, parseGovDatum, parseIAssetDatum, parseInterestOracleDatum, parseLrpDatum, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, redeemLrp, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePriceOracleDatum, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, spAdd, spDiv, spMul, spSub, toSystemParamsAsset };
|
|
1330
|
+
export { AccountAction, AccountActionSchema, AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, Address, type AddressCredential, type AddressCredentialOrDatum, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPContract, type CDPCreatorParamsSP, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CdpParams, CollectorContract, type CollectorParams, Credential, CredentialSchema, type CurrencySymbol, type DistributionParams, EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, GovContract, type GovDatum, GovParams, type GovParamsSP, type IAssetContent, IAssetContentSchema, IAssetHelpers, type IAssetOutput, type Input, InterestOracleContract, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type LRPDatum, LRPDatumSchema, type LRPParams, LRPParamsSchema, type LRPRedeemer, LRPRedeemerSchema, type LrpParamsSP, ONE_SECOND, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, PollManagerParams, type PollManagerParamsSP, PollShardParams, type PollShardParamsSP, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PubKeyHash, SPInteger, SPIntegerSchema, type ScriptCredential, type ScriptOutput, type ScriptRef, type ScriptReference, type ScriptReferences, SnapshotEpochToScaleToSumContent, SnapshotEpochToScaleToSumContentSchema, StabilityPoolContent, StabilityPoolContentSchema, StabilityPoolContract, StabilityPoolDatum, StabilityPoolDatumSchema, StabilityPoolParams, type StabilityPoolParamsSP, StabilityPoolRedeemer, StabilityPoolRedeemerSchema, StabilityPoolSnapshot, StakingContract, type StakingParams, type StartTime, type SystemParams, type TokenName, TreasuryContract, type TreasuryParams, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, _cdpValidator, _collectorValidator, _treasuryValidator, addrDetails, addressFromBech32, addressToBech32, adjustLrp, balance, calculateFeeFromPercentage, cancelLrp, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, cdpCreatorValidator, claimLrp, createScriptAddress, fromSPInteger, fromSystemParamsAsset, getInlineDatumOrThrow, getRandomElement, loadSystemParamsFromFile, loadSystemParamsFromUrl, matchSingle, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkInterestOracleValidator, mkLrpValidator, mkLrpValidatorFromSP, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkSPInteger, oneDay, oneHour, oneShotMintTx, oneYear, openLrp, parseAccountDatum, parseCDPDatum, parseGovDatum, parseIAssetDatum, parseInterestOracleDatum, parseLrpDatum, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, redeemLrp, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePriceOracleDatum, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, spAdd, spDiv, spMul, spSub, toSystemParamsAsset };
|
package/dist/index.d.ts
CHANGED
|
@@ -67,6 +67,7 @@ interface SystemParams {
|
|
|
67
67
|
scriptReferences: ScriptReferences;
|
|
68
68
|
pollShardParams: PollShardParamsSP;
|
|
69
69
|
pollManagerParams: PollManagerParamsSP;
|
|
70
|
+
lrpParams: LrpParamsSP;
|
|
70
71
|
indyToken: AssetClassSP;
|
|
71
72
|
govParams: GovParamsSP;
|
|
72
73
|
executeParams: ExecuteParamsSP;
|
|
@@ -82,6 +83,7 @@ type ValidatorHashes = {
|
|
|
82
83
|
stabilityPoolHash: string;
|
|
83
84
|
pollShardHash: string;
|
|
84
85
|
pollManagerHash: string;
|
|
86
|
+
lrpHash: string;
|
|
85
87
|
govHash: string;
|
|
86
88
|
executeHash: string;
|
|
87
89
|
collectorHash: string;
|
|
@@ -145,6 +147,7 @@ interface ScriptReferences {
|
|
|
145
147
|
stabilityPoolValidatorRef: ScriptReference;
|
|
146
148
|
pollShardValidatorRef: ScriptReference;
|
|
147
149
|
pollManagerValidatorRef: ScriptReference;
|
|
150
|
+
lrpValidatorRef: ScriptReference;
|
|
148
151
|
liquidityValidatorRef: ScriptReference;
|
|
149
152
|
iAssetTokenPolicyRef: ScriptReference;
|
|
150
153
|
governanceValidatorRef: ScriptReference;
|
|
@@ -197,6 +200,12 @@ interface AuthTokenPolicies {
|
|
|
197
200
|
cdpAuthTokenRef: ScriptReference;
|
|
198
201
|
accountTokenRef: ScriptReference;
|
|
199
202
|
}
|
|
203
|
+
interface LrpParamsSP {
|
|
204
|
+
versionRecordToken: AssetClassSP;
|
|
205
|
+
iassetNft: AssetClassSP;
|
|
206
|
+
iassetPolicyId: CurrencySymbol;
|
|
207
|
+
minRedemptionLovelacesAmt: bigint;
|
|
208
|
+
}
|
|
200
209
|
interface PollShardParamsSP {
|
|
201
210
|
stakingValHash: string;
|
|
202
211
|
stakingToken: AssetClassSP;
|
|
@@ -1296,6 +1305,7 @@ lovelacesAdjustAmt: bigint, lrpRefScriptOutRef: OutRef, lrpParams: LRPParams): P
|
|
|
1296
1305
|
declare function claimLrp(lucid: LucidEvolution, lrpOutRef: OutRef, lrpRefScriptOutRef: OutRef, lrpParams: LRPParams): Promise<TxBuilder>;
|
|
1297
1306
|
|
|
1298
1307
|
declare const mkLrpValidator: (params: LRPParams) => SpendingValidator;
|
|
1308
|
+
declare const mkLrpValidatorFromSP: (params: LrpParamsSP) => SpendingValidator;
|
|
1299
1309
|
|
|
1300
1310
|
/**
|
|
1301
1311
|
* Uses an always fail validator for the destination address.
|
|
@@ -1317,4 +1327,4 @@ type OneShotParams = Data.Static<typeof OneShotParamsSchema>;
|
|
|
1317
1327
|
declare function oneShotMintTx(lucid: LucidEvolution, params: OneShotParams): Promise<[TxBuilder, PolicyId]>;
|
|
1318
1328
|
declare function runOneShotMintTx(lucid: LucidEvolution, params: OneShotParams): Promise<PolicyId>;
|
|
1319
1329
|
|
|
1320
|
-
export { AccountAction, AccountActionSchema, AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, Address, type AddressCredential, type AddressCredentialOrDatum, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPContract, type CDPCreatorParamsSP, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CdpParams, CollectorContract, type CollectorParams, Credential, CredentialSchema, type CurrencySymbol, type DistributionParams, EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, GovContract, type GovDatum, GovParams, type GovParamsSP, type IAssetContent, IAssetContentSchema, IAssetHelpers, type IAssetOutput, type Input, InterestOracleContract, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type LRPDatum, LRPDatumSchema, type LRPParams, LRPParamsSchema, type LRPRedeemer, LRPRedeemerSchema, ONE_SECOND, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, PollManagerParams, type PollManagerParamsSP, PollShardParams, type PollShardParamsSP, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PubKeyHash, SPInteger, SPIntegerSchema, type ScriptCredential, type ScriptOutput, type ScriptRef, type ScriptReference, type ScriptReferences, SnapshotEpochToScaleToSumContent, SnapshotEpochToScaleToSumContentSchema, StabilityPoolContent, StabilityPoolContentSchema, StabilityPoolContract, StabilityPoolDatum, StabilityPoolDatumSchema, StabilityPoolParams, type StabilityPoolParamsSP, StabilityPoolRedeemer, StabilityPoolRedeemerSchema, StabilityPoolSnapshot, StakingContract, type StakingParams, type StartTime, type SystemParams, type TokenName, TreasuryContract, type TreasuryParams, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, _cdpValidator, _collectorValidator, _treasuryValidator, addrDetails, addressFromBech32, addressToBech32, adjustLrp, balance, calculateFeeFromPercentage, cancelLrp, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, cdpCreatorValidator, claimLrp, createScriptAddress, fromSPInteger, fromSystemParamsAsset, getInlineDatumOrThrow, getRandomElement, loadSystemParamsFromFile, loadSystemParamsFromUrl, matchSingle, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkInterestOracleValidator, mkLrpValidator, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkSPInteger, oneDay, oneHour, oneShotMintTx, oneYear, openLrp, parseAccountDatum, parseCDPDatum, parseGovDatum, parseIAssetDatum, parseInterestOracleDatum, parseLrpDatum, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, redeemLrp, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePriceOracleDatum, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, spAdd, spDiv, spMul, spSub, toSystemParamsAsset };
|
|
1330
|
+
export { AccountAction, AccountActionSchema, AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, Address, type AddressCredential, type AddressCredentialOrDatum, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPContract, type CDPCreatorParamsSP, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CdpParams, CollectorContract, type CollectorParams, Credential, CredentialSchema, type CurrencySymbol, type DistributionParams, EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, GovContract, type GovDatum, GovParams, type GovParamsSP, type IAssetContent, IAssetContentSchema, IAssetHelpers, type IAssetOutput, type Input, InterestOracleContract, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type LRPDatum, LRPDatumSchema, type LRPParams, LRPParamsSchema, type LRPRedeemer, LRPRedeemerSchema, type LrpParamsSP, ONE_SECOND, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, PollManagerParams, type PollManagerParamsSP, PollShardParams, type PollShardParamsSP, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PubKeyHash, SPInteger, SPIntegerSchema, type ScriptCredential, type ScriptOutput, type ScriptRef, type ScriptReference, type ScriptReferences, SnapshotEpochToScaleToSumContent, SnapshotEpochToScaleToSumContentSchema, StabilityPoolContent, StabilityPoolContentSchema, StabilityPoolContract, StabilityPoolDatum, StabilityPoolDatumSchema, StabilityPoolParams, type StabilityPoolParamsSP, StabilityPoolRedeemer, StabilityPoolRedeemerSchema, StabilityPoolSnapshot, StakingContract, type StakingParams, type StartTime, type SystemParams, type TokenName, TreasuryContract, type TreasuryParams, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, _cdpValidator, _collectorValidator, _treasuryValidator, addrDetails, addressFromBech32, addressToBech32, adjustLrp, balance, calculateFeeFromPercentage, cancelLrp, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, cdpCreatorValidator, claimLrp, createScriptAddress, fromSPInteger, fromSystemParamsAsset, getInlineDatumOrThrow, getRandomElement, loadSystemParamsFromFile, loadSystemParamsFromUrl, matchSingle, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkInterestOracleValidator, mkLrpValidator, mkLrpValidatorFromSP, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkSPInteger, oneDay, oneHour, oneShotMintTx, oneYear, openLrp, parseAccountDatum, parseCDPDatum, parseGovDatum, parseIAssetDatum, parseInterestOracleDatum, parseLrpDatum, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, redeemLrp, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePriceOracleDatum, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, spAdd, spDiv, spMul, spSub, toSystemParamsAsset };
|
package/dist/index.js
CHANGED
|
@@ -114,6 +114,7 @@ __export(index_exports, {
|
|
|
114
114
|
mkCDPCreatorValidatorFromSP: () => mkCDPCreatorValidatorFromSP,
|
|
115
115
|
mkInterestOracleValidator: () => mkInterestOracleValidator,
|
|
116
116
|
mkLrpValidator: () => mkLrpValidator,
|
|
117
|
+
mkLrpValidatorFromSP: () => mkLrpValidatorFromSP,
|
|
117
118
|
mkPollManagerValidator: () => mkPollManagerValidator,
|
|
118
119
|
mkPollManagerValidatorFromSP: () => mkPollManagerValidatorFromSP,
|
|
119
120
|
mkPollShardValidator: () => mkPollShardValidator,
|
|
@@ -2986,6 +2987,19 @@ var mkLrpValidator = (params) => {
|
|
|
2986
2987
|
])
|
|
2987
2988
|
};
|
|
2988
2989
|
};
|
|
2990
|
+
var mkLrpValidatorFromSP = (params) => {
|
|
2991
|
+
return {
|
|
2992
|
+
type: lrpValidatorData.type,
|
|
2993
|
+
script: (0, import_lucid35.applyParamsToScript)(lrpValidatorData.cborHex, [
|
|
2994
|
+
castLrpParams({
|
|
2995
|
+
versionRecordToken: fromSystemParamsAsset(params.versionRecordToken),
|
|
2996
|
+
iassetNft: fromSystemParamsAsset(params.iassetNft),
|
|
2997
|
+
minRedemptionLovelacesAmt: BigInt(params.minRedemptionLovelacesAmt),
|
|
2998
|
+
iassetPolicyId: params.iassetPolicyId.unCurrencySymbol
|
|
2999
|
+
})
|
|
3000
|
+
])
|
|
3001
|
+
};
|
|
3002
|
+
};
|
|
2989
3003
|
|
|
2990
3004
|
// src/helpers/helper-txs.ts
|
|
2991
3005
|
var import_lucid36 = require("@lucid-evolution/lucid");
|
|
@@ -3090,6 +3104,7 @@ async function runCreateScriptRefTx(lucid, scriptRefValidator, network) {
|
|
|
3090
3104
|
mkCDPCreatorValidatorFromSP,
|
|
3091
3105
|
mkInterestOracleValidator,
|
|
3092
3106
|
mkLrpValidator,
|
|
3107
|
+
mkLrpValidatorFromSP,
|
|
3093
3108
|
mkPollManagerValidator,
|
|
3094
3109
|
mkPollManagerValidatorFromSP,
|
|
3095
3110
|
mkPollShardValidator,
|
package/dist/index.mjs
CHANGED
|
@@ -2901,6 +2901,19 @@ var mkLrpValidator = (params) => {
|
|
|
2901
2901
|
])
|
|
2902
2902
|
};
|
|
2903
2903
|
};
|
|
2904
|
+
var mkLrpValidatorFromSP = (params) => {
|
|
2905
|
+
return {
|
|
2906
|
+
type: lrpValidatorData.type,
|
|
2907
|
+
script: applyParamsToScript11(lrpValidatorData.cborHex, [
|
|
2908
|
+
castLrpParams({
|
|
2909
|
+
versionRecordToken: fromSystemParamsAsset(params.versionRecordToken),
|
|
2910
|
+
iassetNft: fromSystemParamsAsset(params.iassetNft),
|
|
2911
|
+
minRedemptionLovelacesAmt: BigInt(params.minRedemptionLovelacesAmt),
|
|
2912
|
+
iassetPolicyId: params.iassetPolicyId.unCurrencySymbol
|
|
2913
|
+
})
|
|
2914
|
+
])
|
|
2915
|
+
};
|
|
2916
|
+
};
|
|
2904
2917
|
|
|
2905
2918
|
// src/helpers/helper-txs.ts
|
|
2906
2919
|
import {
|
|
@@ -3006,6 +3019,7 @@ export {
|
|
|
3006
3019
|
mkCDPCreatorValidatorFromSP,
|
|
3007
3020
|
mkInterestOracleValidator,
|
|
3008
3021
|
mkLrpValidator,
|
|
3022
|
+
mkLrpValidatorFromSP,
|
|
3009
3023
|
mkPollManagerValidator,
|
|
3010
3024
|
mkPollManagerValidatorFromSP,
|
|
3011
3025
|
mkPollShardValidator,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import eslint from '@eslint/js';
|
|
2
|
+
import tseslint from 'typescript-eslint';
|
|
3
|
+
|
|
4
|
+
export default tseslint.config(
|
|
5
|
+
{
|
|
6
|
+
ignores: ['**/dist/*', '**/node_modules/*'],
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
files: ['**/*.ts'],
|
|
10
|
+
extends: [
|
|
11
|
+
eslint.configs.recommended,
|
|
12
|
+
tseslint.configs.recommendedTypeChecked,
|
|
13
|
+
{
|
|
14
|
+
languageOptions: {
|
|
15
|
+
parserOptions: {
|
|
16
|
+
projectService: true,
|
|
17
|
+
tsconfigRootDir: import.meta.dirname,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
rules: {
|
|
23
|
+
'no-unreachable': 'warn',
|
|
24
|
+
'no-use-before-define': 'error',
|
|
25
|
+
'@typescript-eslint/no-unused-vars': [
|
|
26
|
+
'error',
|
|
27
|
+
{
|
|
28
|
+
args: 'all',
|
|
29
|
+
argsIgnorePattern: '^_',
|
|
30
|
+
varsIgnorePattern: '^_',
|
|
31
|
+
caughtErrorsIgnorePattern: '^_',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
);
|
package/package.json
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indigo-labs/indigo-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
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",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist"
|
|
10
|
-
],
|
|
11
8
|
"scripts": {
|
|
12
9
|
"build": "tsup src/index.ts --format esm,cjs --dts --clean --tsconfig tsconfig.build.json",
|
|
13
10
|
"lint": "npx eslint .",
|
|
@@ -53,7 +50,7 @@
|
|
|
53
50
|
"@babel/preset-env": "^7.21.4",
|
|
54
51
|
"@babel/preset-typescript": "^7.21.4",
|
|
55
52
|
"@eslint/js": "^9.32.0",
|
|
56
|
-
"@types/node": "^
|
|
53
|
+
"@types/node": "^24.3.0",
|
|
57
54
|
"eslint": "^9.32.0",
|
|
58
55
|
"husky": "^9.1.7",
|
|
59
56
|
"lint-staged": "^16.1.5",
|