@indigo-labs/indigo-sdk 0.4.3 → 0.5.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/.claude/settings.local.json +7 -0
- package/dist/index.d.mts +992 -905
- package/dist/index.d.ts +992 -905
- package/dist/index.js +2346 -2155
- package/dist/index.mjs +1925 -1750
- package/package.json +13 -21
- package/scripts/bench.sh +0 -0
- package/src/contracts/cdp/helpers.ts +7 -6
- package/src/contracts/cdp/transactions.ts +8 -29
- package/src/contracts/gov/transactions.ts +15 -17
- package/src/contracts/iasset/helpers.ts +2 -7
- package/src/contracts/initialize/actions.ts +0 -2
- package/src/contracts/initialize/helpers.ts +0 -4
- package/src/contracts/interest-collection/transactions.ts +2 -5
- package/src/contracts/interest-oracle/helpers.ts +4 -0
- package/src/contracts/interest-oracle/transactions.ts +1 -4
- package/src/contracts/price-oracle/helpers.ts +5 -11
- package/src/contracts/price-oracle/transactions.ts +2 -7
- package/src/contracts/rob/transactions.ts +0 -2
- package/src/contracts/rob-leverage/transactions.ts +1 -4
- package/{tests/queries/stability-pool-queries.ts → src/contracts/stability-pool/queries.ts} +22 -14
- package/src/contracts/stability-pool/transactions.ts +2 -8
- package/src/contracts/stableswap/helpers.ts +369 -1
- package/src/contracts/stableswap/transactions.ts +43 -191
- package/src/contracts/staking/transactions.ts +2 -7
- package/src/index.ts +4 -3
- package/tests/cdp/actions.ts +0 -11
- package/tests/cdp/cdp-helpers.ts +2 -2
- package/tests/cdp/cdp-queries.ts +8 -5
- package/tests/cdp/cdp.test.ts +409 -620
- package/tests/cdp/transactions-mutated.ts +30 -25
- package/tests/endpoints/initialize.ts +0 -2
- package/tests/gov/actions.ts +7 -32
- package/tests/gov/gov.test.ts +169 -401
- package/tests/indigo-test-helpers.ts +0 -1
- package/tests/initialize.test.ts +15 -20
- package/tests/interest-collection/interest-collection.test.ts +0 -4
- package/tests/interest-oracle.test.ts +1 -8
- package/tests/price-oracle/actions.ts +6 -8
- package/tests/price-oracle/price-oracle.test.ts +1 -13
- package/tests/price-oracle/transactions-mutated.ts +1 -4
- package/tests/pyth/pyth-feeds.test.ts +943 -0
- package/tests/pyth/pyth-indigo.test.ts +8 -12
- package/tests/pyth/pyth.test.ts +1 -2
- package/tests/rob/actions.ts +0 -2
- package/tests/rob/rob-leverage.test.ts +164 -220
- package/tests/rob/rob.test.ts +158 -263
- package/tests/rob/transactions-mutated.ts +7 -18
- package/tests/stability-pool/actions.ts +31 -22
- package/tests/stability-pool.test.ts +226 -319
- package/tests/stableswap/stableswap-actions.ts +0 -1
- package/tests/stableswap/stableswap.test.ts +226 -4
- package/tests/staking.test.ts +2 -13
- package/tests/treasury/treasury.test.ts +6 -30
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
generateEmulatorAccount,
|
|
15
15
|
generateEmulatorAccountFromPrivateKey,
|
|
16
16
|
Lucid,
|
|
17
|
-
slotToUnixTime,
|
|
18
17
|
toHex,
|
|
19
18
|
} from '@lucid-evolution/lucid';
|
|
20
19
|
import {
|
|
@@ -89,7 +88,6 @@ describe('Pyth > Indigo', () => {
|
|
|
89
88
|
const [systemParams, assetConfigs] = await init(
|
|
90
89
|
context.lucid,
|
|
91
90
|
[],
|
|
92
|
-
context.emulator.slot,
|
|
93
91
|
(pythStateNft: AssetClass) => [
|
|
94
92
|
iusdInitialAssetCfgWithPyth(pythStateNft, (pythStatePolicyId) => [
|
|
95
93
|
mkBaseCollateralAsset(
|
|
@@ -142,7 +140,7 @@ describe('Pyth > Indigo', () => {
|
|
|
142
140
|
|
|
143
141
|
test('Open CDP - Direct Price Value (ada collateral)', async (context: IndigoTestContext) => {
|
|
144
142
|
const currentTime = BigInt(
|
|
145
|
-
|
|
143
|
+
context.lucid.slotToUnixTime(context.lucid.currentSlot()),
|
|
146
144
|
);
|
|
147
145
|
|
|
148
146
|
const iUsdFeed: ParsedFeedPayload = {
|
|
@@ -170,7 +168,7 @@ describe('Pyth > Indigo', () => {
|
|
|
170
168
|
|
|
171
169
|
test('Open CDP - Direct Price Value (non-ADA collateral)', async (context: IndigoTestContext) => {
|
|
172
170
|
const currentTime = BigInt(
|
|
173
|
-
|
|
171
|
+
context.lucid.slotToUnixTime(context.lucid.currentSlot()),
|
|
174
172
|
);
|
|
175
173
|
|
|
176
174
|
const iEthFeed: ParsedFeedPayload = {
|
|
@@ -199,7 +197,7 @@ describe('Pyth > Indigo', () => {
|
|
|
199
197
|
|
|
200
198
|
test('Open CDP - Divide Price Value', async (context: IndigoTestContext) => {
|
|
201
199
|
const currentTime = BigInt(
|
|
202
|
-
|
|
200
|
+
context.lucid.slotToUnixTime(context.lucid.currentSlot()),
|
|
203
201
|
);
|
|
204
202
|
|
|
205
203
|
const feed1: ParsedFeedPayload = {
|
|
@@ -235,7 +233,7 @@ describe('Pyth > Indigo', () => {
|
|
|
235
233
|
|
|
236
234
|
test('Open CDP - Fails if missing feed price', async (context: IndigoTestContext) => {
|
|
237
235
|
const currentTime = BigInt(
|
|
238
|
-
|
|
236
|
+
context.lucid.slotToUnixTime(context.lucid.currentSlot()),
|
|
239
237
|
);
|
|
240
238
|
|
|
241
239
|
// This feed doesn't include a price for feedId 2, which is used by the iBTC asset
|
|
@@ -261,7 +259,7 @@ describe('Pyth > Indigo', () => {
|
|
|
261
259
|
|
|
262
260
|
test('Withdraw CDP - Direct Price Value', async (context: IndigoTestContext) => {
|
|
263
261
|
const currentTime = BigInt(
|
|
264
|
-
|
|
262
|
+
context.lucid.slotToUnixTime(context.lucid.currentSlot()),
|
|
265
263
|
);
|
|
266
264
|
|
|
267
265
|
const iUsdFeed: ParsedFeedPayload = {
|
|
@@ -302,7 +300,7 @@ describe('Pyth > Indigo', () => {
|
|
|
302
300
|
|
|
303
301
|
test('Freeze CDP - Direct Price Value', async (context: IndigoTestContext) => {
|
|
304
302
|
const currentTime = BigInt(
|
|
305
|
-
|
|
303
|
+
context.lucid.slotToUnixTime(context.lucid.currentSlot()),
|
|
306
304
|
);
|
|
307
305
|
{
|
|
308
306
|
const iUsdFeed: ParsedFeedPayload = {
|
|
@@ -355,7 +353,7 @@ describe('Pyth > Indigo', () => {
|
|
|
355
353
|
const [ownPkh, _] = await addrDetails(context.lucid);
|
|
356
354
|
|
|
357
355
|
const currentTime = BigInt(
|
|
358
|
-
|
|
356
|
+
context.lucid.slotToUnixTime(context.lucid.currentSlot()),
|
|
359
357
|
);
|
|
360
358
|
const iUsdFeed: ParsedFeedPayload = {
|
|
361
359
|
priceFeedId: 1,
|
|
@@ -413,7 +411,6 @@ describe('Pyth > Indigo', () => {
|
|
|
413
411
|
[[robUtxo, redemptionIAssetAmt]],
|
|
414
412
|
'iUSD',
|
|
415
413
|
adaAssetClass,
|
|
416
|
-
context.emulator.slot,
|
|
417
414
|
toHex(message),
|
|
418
415
|
),
|
|
419
416
|
context.lucid,
|
|
@@ -425,7 +422,7 @@ describe('Pyth > Indigo', () => {
|
|
|
425
422
|
const [ownPkh, _] = await addrDetails(context.lucid);
|
|
426
423
|
|
|
427
424
|
const currentTime = BigInt(
|
|
428
|
-
|
|
425
|
+
context.lucid.slotToUnixTime(context.lucid.currentSlot()),
|
|
429
426
|
);
|
|
430
427
|
const iUsdFeed: ParsedFeedPayload = {
|
|
431
428
|
priceFeedId: 1,
|
|
@@ -499,7 +496,6 @@ describe('Pyth > Indigo', () => {
|
|
|
499
496
|
[[robUtxo, payoutCollateralAmt]],
|
|
500
497
|
'iUSD',
|
|
501
498
|
adaAssetClass,
|
|
502
|
-
context.emulator.slot,
|
|
503
499
|
toHex(message),
|
|
504
500
|
),
|
|
505
501
|
context.lucid,
|
package/tests/pyth/pyth.test.ts
CHANGED
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
generateEmulatorAccount,
|
|
8
8
|
Lucid,
|
|
9
9
|
scriptHashToCredential,
|
|
10
|
-
slotToUnixTime,
|
|
11
10
|
toHex,
|
|
12
11
|
validatorToScriptHash,
|
|
13
12
|
} from '@lucid-evolution/lucid';
|
|
@@ -140,7 +139,7 @@ describe('Pyth > Initialization', () => {
|
|
|
140
139
|
);
|
|
141
140
|
|
|
142
141
|
const currentTime = BigInt(
|
|
143
|
-
|
|
142
|
+
context.lucid.slotToUnixTime(context.lucid.currentSlot()),
|
|
144
143
|
);
|
|
145
144
|
|
|
146
145
|
// This is to test the transaction validity when using a timestamp different than the
|
package/tests/rob/actions.ts
CHANGED
|
@@ -12,7 +12,6 @@ export async function runRedeemRob(
|
|
|
12
12
|
redemptionRobsData: [RobOutput, bigint][],
|
|
13
13
|
iasset: string,
|
|
14
14
|
collateralAsset: AssetClass,
|
|
15
|
-
currentSlot: number,
|
|
16
15
|
pythMessage?: string,
|
|
17
16
|
): Promise<TxBuilder> {
|
|
18
17
|
if (redemptionRobsData.length === 0) throw new Error('No ROBs to redeem');
|
|
@@ -51,7 +50,6 @@ export async function runRedeemRob(
|
|
|
51
50
|
collateral.utxo,
|
|
52
51
|
context.lucid,
|
|
53
52
|
sysParams,
|
|
54
|
-
currentSlot,
|
|
55
53
|
pythMessage,
|
|
56
54
|
pythStateOutRef,
|
|
57
55
|
);
|