@indigo-labs/indigo-sdk 0.3.9 → 0.3.11
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.d.mts +337 -772
- package/dist/index.d.ts +337 -772
- package/dist/index.js +1194 -557
- package/dist/index.mjs +1091 -451
- package/package.json +1 -1
- package/src/contracts/cdp/helpers.ts +12 -0
- package/src/contracts/cdp/transactions.ts +32 -8
- package/src/contracts/gov/helpers.ts +58 -0
- package/src/contracts/gov/transactions.ts +35 -14
- package/src/contracts/iasset/helpers.ts +3 -0
- package/src/contracts/price-oracle/types-new.ts +1 -1
- package/src/contracts/rob/helpers.ts +274 -196
- package/src/contracts/rob/transactions.ts +11 -5
- package/src/contracts/rob-leverage/helpers.ts +379 -371
- package/src/contracts/rob-leverage/transactions.ts +176 -104
- package/src/contracts/staking/transactions.ts +3 -0
- package/src/contracts/treasury/transactions.ts +58 -36
- package/src/contracts/treasury/types-new.ts +1 -1
- package/src/index.ts +0 -2
- package/src/utils/utils.ts +0 -3
- package/src/validators/cdp-creator-validator.ts +1 -1
- package/src/validators/cdp-redeem-validator.ts +1 -1
- package/src/validators/cdp-validator.ts +1 -1
- package/src/validators/collector-validator.ts +1 -1
- package/src/validators/execute-validator.ts +1 -1
- package/src/validators/governance-validator.ts +1 -1
- package/src/validators/interest-collection-validator.ts +1 -1
- package/src/validators/interest-oracle-validator.ts +1 -1
- package/src/validators/poll-manager-validator.ts +1 -1
- package/src/validators/poll-shard-validator.ts +1 -1
- package/src/validators/stability-pool-validator.ts +1 -1
- package/src/validators/stableswap-validator.ts +1 -1
- package/src/validators/staking-validator.ts +1 -1
- package/src/validators/treasury-validator.ts +1 -1
- package/tests/cdp/actions.ts +87 -6
- package/tests/cdp/cdp-queries.ts +1 -1
- package/tests/cdp/cdp.test.ts +949 -94
- package/tests/endpoints/initialize.ts +14 -2
- package/tests/gov/gov.test.ts +864 -1
- package/tests/interest-collection/interest-collector-queries.ts +2 -1
- package/tests/queries/collector-queries.ts +2 -1
- package/tests/queries/poll-queries.ts +2 -1
- package/tests/queries/treasury-queries.ts +8 -2
- package/tests/rob/rob-leverage.test.ts +1646 -612
- package/tests/rob/rob.test.ts +35 -19
- package/tests/rob/transactions-mutated.ts +6 -4
- package/tests/stability-pool.test.ts +251 -25
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { LucidEvolution, UTxO } from '@lucid-evolution/lucid';
|
|
2
|
-
import { createScriptAddress
|
|
2
|
+
import { createScriptAddress } from '../../src';
|
|
3
3
|
import { option as O, function as F } from 'fp-ts';
|
|
4
4
|
import {
|
|
5
5
|
AssetClass,
|
|
6
6
|
assetClassToUnit,
|
|
7
7
|
assetClassValueOf,
|
|
8
|
+
getRandomElement,
|
|
8
9
|
matchSingle,
|
|
9
10
|
} from '@3rd-eye-labs/cardano-offchain-common';
|
|
10
11
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LucidEvolution, UTxO } from '@lucid-evolution/lucid';
|
|
2
|
-
import { createScriptAddress
|
|
2
|
+
import { createScriptAddress } from '../../src';
|
|
3
3
|
import { option as O, function as F } from 'fp-ts';
|
|
4
|
+
import { getRandomElement } from '@3rd-eye-labs/cardano-offchain-common';
|
|
4
5
|
|
|
5
6
|
export async function findAllCollectors(
|
|
6
7
|
lucid: LucidEvolution,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { LucidEvolution, ScriptHash, UTxO } from '@lucid-evolution/lucid';
|
|
2
2
|
|
|
3
|
-
import { matchSingle, createScriptAddress
|
|
3
|
+
import { matchSingle, createScriptAddress } from '../../src';
|
|
4
4
|
import { option as O, array as A, function as F } from 'fp-ts';
|
|
5
5
|
import {
|
|
6
6
|
AssetClass,
|
|
7
7
|
assetClassToUnit,
|
|
8
|
+
getRandomElement,
|
|
8
9
|
} from '@3rd-eye-labs/cardano-offchain-common';
|
|
9
10
|
import {
|
|
10
11
|
parsePollManager,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { LucidEvolution, UTxO } from '@lucid-evolution/lucid';
|
|
2
|
-
import {
|
|
2
|
+
import { SystemParams } from '../../src';
|
|
3
3
|
import { option as O, function as F } from 'fp-ts';
|
|
4
4
|
import {
|
|
5
5
|
AssetClass,
|
|
6
6
|
assetClassToUnit,
|
|
7
|
+
getRandomElement,
|
|
7
8
|
} from '@3rd-eye-labs/cardano-offchain-common';
|
|
8
9
|
|
|
9
10
|
export async function findRandomTreasuryUtxo(
|
|
@@ -50,6 +51,7 @@ export async function findRandomTreasuryUtxoWithAsset(
|
|
|
50
51
|
lucid: LucidEvolution,
|
|
51
52
|
sysParams: SystemParams,
|
|
52
53
|
asset: AssetClass,
|
|
54
|
+
max_number_of_assets: bigint = 2n,
|
|
53
55
|
): Promise<UTxO> {
|
|
54
56
|
// We need to consider both with staking credential and without.
|
|
55
57
|
const treasuryUtxos = await lucid.utxosAtWithUnit(
|
|
@@ -57,8 +59,12 @@ export async function findRandomTreasuryUtxoWithAsset(
|
|
|
57
59
|
assetClassToUnit(asset),
|
|
58
60
|
);
|
|
59
61
|
|
|
62
|
+
const validTreasuryUtxos = treasuryUtxos.filter(
|
|
63
|
+
(utxo) => Object.keys(utxo.assets).length <= max_number_of_assets,
|
|
64
|
+
);
|
|
65
|
+
|
|
60
66
|
return F.pipe(
|
|
61
|
-
O.fromNullable(getRandomElement(
|
|
67
|
+
O.fromNullable(getRandomElement(validTreasuryUtxos)),
|
|
62
68
|
O.match(() => {
|
|
63
69
|
throw new Error('Expected some treasury UTXOs.');
|
|
64
70
|
}, F.identity),
|