@indigo-labs/indigo-sdk 0.5.4 → 0.5.6
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 +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +17 -0
- package/dist/index.mjs +15 -0
- package/package.json +11 -1
- package/.claude/settings.local.json +0 -7
- package/.github/workflows/ci.yml +0 -66
- package/.husky/pre-commit +0 -1
- package/.nvmrc +0 -1
- package/.prettierignore +0 -1
- package/.prettierrc +0 -6
- package/eslint.config.mjs +0 -42
- package/scripts/bench.sh +0 -62
- package/scripts/run-repeat.sh +0 -22
- package/src/contracts/cdp/helpers.ts +0 -173
- package/src/contracts/cdp/scripts.ts +0 -70
- package/src/contracts/cdp/transactions.ts +0 -1584
- package/src/contracts/cdp/types-new.ts +0 -277
- package/src/contracts/cdp/types.ts +0 -43
- package/src/contracts/cdp-creator/queries.ts +0 -30
- package/src/contracts/cdp-creator/scripts.ts +0 -45
- package/src/contracts/cdp-creator/types-new.ts +0 -50
- package/src/contracts/cdp-creator/types.ts +0 -24
- package/src/contracts/collector/scripts.ts +0 -32
- package/src/contracts/collector/transactions.ts +0 -50
- package/src/contracts/collector/types-new.ts +0 -17
- package/src/contracts/execute/scripts.ts +0 -57
- package/src/contracts/execute/types-new.ts +0 -44
- package/src/contracts/execute/types.ts +0 -24
- package/src/contracts/gov/helpers.ts +0 -351
- package/src/contracts/gov/scripts.ts +0 -41
- package/src/contracts/gov/transactions.ts +0 -1607
- package/src/contracts/gov/types-new.ts +0 -268
- package/src/contracts/gov/types.ts +0 -22
- package/src/contracts/iasset/helpers.ts +0 -170
- package/src/contracts/iasset/queries.ts +0 -102
- package/src/contracts/iasset/scripts.ts +0 -38
- package/src/contracts/iasset/types.ts +0 -154
- package/src/contracts/initialize/actions.ts +0 -789
- package/src/contracts/initialize/helpers.ts +0 -616
- package/src/contracts/initialize/types.ts +0 -116
- package/src/contracts/interest-collection/helpers.ts +0 -19
- package/src/contracts/interest-collection/queries.ts +0 -66
- package/src/contracts/interest-collection/scripts.ts +0 -44
- package/src/contracts/interest-collection/transactions.ts +0 -433
- package/src/contracts/interest-collection/types-new.ts +0 -50
- package/src/contracts/interest-collection/types.ts +0 -26
- package/src/contracts/interest-oracle/helpers.ts +0 -61
- package/src/contracts/interest-oracle/scripts.ts +0 -18
- package/src/contracts/interest-oracle/transactions.ts +0 -151
- package/src/contracts/interest-oracle/types-new.ts +0 -32
- package/src/contracts/interest-oracle/types.ts +0 -16
- package/src/contracts/one-shot/scripts.ts +0 -12
- package/src/contracts/one-shot/transactions.ts +0 -66
- package/src/contracts/one-shot/types.ts +0 -22
- package/src/contracts/poll/helpers.ts +0 -37
- package/src/contracts/poll/scripts.ts +0 -71
- package/src/contracts/poll/types-poll-manager.ts +0 -20
- package/src/contracts/poll/types-poll-new.ts +0 -196
- package/src/contracts/poll/types-poll-shard.ts +0 -16
- package/src/contracts/price-oracle/helpers.ts +0 -30
- package/src/contracts/price-oracle/scripts.ts +0 -18
- package/src/contracts/price-oracle/transactions.ts +0 -115
- package/src/contracts/price-oracle/types-new.ts +0 -50
- package/src/contracts/price-oracle/types.ts +0 -16
- package/src/contracts/pyth-feed/helpers.ts +0 -82
- package/src/contracts/pyth-feed/scripts.ts +0 -15
- package/src/contracts/pyth-feed/types.ts +0 -181
- package/src/contracts/rob/helpers.ts +0 -666
- package/src/contracts/rob/scripts.ts +0 -35
- package/src/contracts/rob/transactions.ts +0 -423
- package/src/contracts/rob/types-new.ts +0 -128
- package/src/contracts/rob/types.ts +0 -16
- package/src/contracts/rob-leverage/helpers.ts +0 -422
- package/src/contracts/rob-leverage/transactions.ts +0 -368
- package/src/contracts/stability-pool/helpers.ts +0 -798
- package/src/contracts/stability-pool/queries.ts +0 -132
- package/src/contracts/stability-pool/scripts.ts +0 -51
- package/src/contracts/stability-pool/transactions.ts +0 -921
- package/src/contracts/stability-pool/types-new.ts +0 -385
- package/src/contracts/stability-pool/types.ts +0 -25
- package/src/contracts/stableswap/helpers.ts +0 -507
- package/src/contracts/stableswap/scripts.ts +0 -37
- package/src/contracts/stableswap/transactions.ts +0 -475
- package/src/contracts/stableswap/types-new.ts +0 -131
- package/src/contracts/stableswap/types.ts +0 -17
- package/src/contracts/staking/helpers.ts +0 -136
- package/src/contracts/staking/scripts.ts +0 -41
- package/src/contracts/staking/transactions.ts +0 -349
- package/src/contracts/staking/types-new.ts +0 -137
- package/src/contracts/staking/types.ts +0 -17
- package/src/contracts/treasury/helpers.ts +0 -21
- package/src/contracts/treasury/queries.ts +0 -100
- package/src/contracts/treasury/scripts.ts +0 -27
- package/src/contracts/treasury/transactions.ts +0 -334
- package/src/contracts/treasury/types-new.ts +0 -69
- package/src/contracts/treasury/types.ts +0 -14
- package/src/contracts/version-registry/scripts.ts +0 -29
- package/src/contracts/version-registry/types-new.ts +0 -18
- package/src/contracts/version-registry/types.ts +0 -17
- package/src/index.ts +0 -93
- package/src/scripts/always-fail-validator.ts +0 -7
- package/src/scripts/auth-token-policy.ts +0 -24
- package/src/scripts/iasset-policy.ts +0 -23
- package/src/types/evolution-schema-options.ts +0 -16
- package/src/types/generic.ts +0 -52
- package/src/types/multisig.ts +0 -48
- package/src/types/on-chain-decimal.ts +0 -57
- package/src/types/rational.ts +0 -61
- package/src/types/system-params.ts +0 -463
- package/src/utils/array-utils.ts +0 -108
- package/src/utils/bigint-utils.ts +0 -35
- package/src/utils/helper-txs.ts +0 -31
- package/src/utils/indigo-helpers.ts +0 -17
- package/src/utils/lucid-utils.ts +0 -125
- package/src/utils/oracle-helpers.ts +0 -62
- package/src/utils/pyth/decode.ts +0 -223
- package/src/utils/pyth/encode.ts +0 -262
- package/src/utils/pyth/index.ts +0 -14
- package/src/utils/pyth/types.ts +0 -87
- package/src/utils/time-helpers.ts +0 -4
- package/src/utils/utils.ts +0 -25
- package/src/validators/always-succeed-validator.ts +0 -6
- package/src/validators/cdp-creator-validator.ts +0 -7
- package/src/validators/cdp-redeem-validator.ts +0 -7
- package/src/validators/cdp-validator.ts +0 -7
- package/src/validators/collector-validator.ts +0 -7
- package/src/validators/execute-validator.ts +0 -7
- package/src/validators/governance-validator.ts +0 -7
- package/src/validators/iasset-validator.ts +0 -7
- package/src/validators/interest-collection-validator.ts +0 -7
- package/src/validators/interest-oracle-validator.ts +0 -7
- package/src/validators/one-shot-policy.ts +0 -7
- package/src/validators/poll-manager-validator.ts +0 -7
- package/src/validators/poll-shard-validator.ts +0 -7
- package/src/validators/price-oracle-validator.ts +0 -7
- package/src/validators/pyth-feed-validator.ts +0 -7
- package/src/validators/rob-validator.ts +0 -7
- package/src/validators/stability-pool-validator.ts +0 -7
- package/src/validators/stableswap-validator.ts +0 -7
- package/src/validators/staking-validator.ts +0 -7
- package/src/validators/treasury-validator.ts +0 -7
- package/src/validators/version-record-policy.ts +0 -7
- package/src/validators/version-registry-validator.ts +0 -7
- package/tests/always-succeed/script.ts +0 -7
- package/tests/array-utils.test.ts +0 -92
- package/tests/bigint-utils.test.ts +0 -41
- package/tests/cdp/actions.ts +0 -680
- package/tests/cdp/cdp-helpers.ts +0 -55
- package/tests/cdp/cdp-queries.ts +0 -423
- package/tests/cdp/cdp.test.ts +0 -6730
- package/tests/cdp/transactions-mutated.ts +0 -1733
- package/tests/data/system-params.json +0 -1155
- package/tests/datums.test.ts +0 -302
- package/tests/endpoints/initialize.ts +0 -78
- package/tests/endpoints/interest-collector.ts +0 -37
- package/tests/endpoints/treasury.ts +0 -70
- package/tests/gov/actions.ts +0 -381
- package/tests/gov/gov.test.ts +0 -5147
- package/tests/gov/governance-queries.ts +0 -37
- package/tests/hash-checks.test.ts +0 -112
- package/tests/indigo-test-helpers.ts +0 -99
- package/tests/initialize.test.ts +0 -79
- package/tests/interest-calculations.test.ts +0 -120
- package/tests/interest-collection/interest-collection.test.ts +0 -843
- package/tests/interest-collection/transactions-mutated.ts +0 -260
- package/tests/interest-oracle.test.ts +0 -93
- package/tests/mock/assets-mock.ts +0 -243
- package/tests/mock/protocol-params-mock.ts +0 -21
- package/tests/price-oracle/actions.ts +0 -161
- package/tests/price-oracle/price-oracle-queries.ts +0 -12
- package/tests/price-oracle/price-oracle.test.ts +0 -228
- package/tests/price-oracle/transactions-mutated.ts +0 -59
- package/tests/pyth/endpoints.ts +0 -96
- package/tests/pyth/helpers.ts +0 -37
- package/tests/pyth/pyth-encoding.test.ts +0 -376
- package/tests/pyth/pyth-feeds.test.ts +0 -943
- package/tests/pyth/pyth-indigo.test.ts +0 -505
- package/tests/pyth/pyth.test.ts +0 -299
- package/tests/queries/collector-queries.ts +0 -27
- package/tests/queries/execute-queries.ts +0 -47
- package/tests/queries/iasset-queries.ts +0 -149
- package/tests/queries/interest-oracle-queries.ts +0 -12
- package/tests/queries/poll-queries.ts +0 -97
- package/tests/queries/staking-queries.ts +0 -54
- package/tests/rob/actions.ts +0 -56
- package/tests/rob/rob-leverage.test.ts +0 -2555
- package/tests/rob/rob-queries.ts +0 -95
- package/tests/rob/rob.test.ts +0 -3677
- package/tests/rob/transactions-mutated.ts +0 -844
- package/tests/script-size.test.ts +0 -240
- package/tests/setup.ts +0 -135
- package/tests/stability-pool/actions.ts +0 -229
- package/tests/stability-pool.test.ts +0 -6491
- package/tests/stableswap/stableswap-actions.ts +0 -83
- package/tests/stableswap/stableswap-queries.ts +0 -98
- package/tests/stableswap/stableswap.test.ts +0 -4471
- package/tests/stableswap/transactions-mutated.ts +0 -348
- package/tests/staking.test.ts +0 -172
- package/tests/test-helpers.ts +0 -94
- package/tests/treasury/actions.ts +0 -67
- package/tests/treasury/treasury.test.ts +0 -320
- package/tests/utils/asserts.ts +0 -87
- package/tests/utils/benchmark-utils.ts +0 -130
- package/tests/utils/index.ts +0 -168
- package/tsconfig.build.json +0 -4
- package/tsconfig.json +0 -27
- package/vitest.config.ts +0 -11
package/src/index.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
export * from './contracts/cdp/transactions';
|
|
2
|
-
export * from './contracts/cdp/helpers';
|
|
3
|
-
export * from './contracts/cdp/types';
|
|
4
|
-
export * from './contracts/cdp/types-new';
|
|
5
|
-
export * from './contracts/cdp/scripts';
|
|
6
|
-
export * from './contracts/cdp-creator/types';
|
|
7
|
-
export * from './contracts/cdp-creator/scripts';
|
|
8
|
-
export * from './contracts/cdp-creator/queries';
|
|
9
|
-
export * from './contracts/poll/scripts';
|
|
10
|
-
export * from './contracts/collector/transactions';
|
|
11
|
-
export * from './contracts/collector/types-new';
|
|
12
|
-
export * from './contracts/gov/transactions';
|
|
13
|
-
export * from './contracts/gov/types';
|
|
14
|
-
export * from './contracts/gov/types-new';
|
|
15
|
-
export * from './contracts/gov/scripts';
|
|
16
|
-
export * from './contracts/staking/transactions';
|
|
17
|
-
export * from './contracts/staking/helpers';
|
|
18
|
-
export * from './contracts/staking/types-new';
|
|
19
|
-
export * from './contracts/staking/types';
|
|
20
|
-
export * from './contracts/staking/scripts';
|
|
21
|
-
export * from './contracts/interest-oracle/transactions';
|
|
22
|
-
export * from './contracts/interest-oracle/types';
|
|
23
|
-
export * from './contracts/interest-oracle/types-new';
|
|
24
|
-
export * from './contracts/interest-oracle/helpers';
|
|
25
|
-
export * from './contracts/interest-collection/helpers';
|
|
26
|
-
export * from './contracts/interest-collection/types';
|
|
27
|
-
export * from './contracts/interest-collection/types-new';
|
|
28
|
-
export * from './contracts/interest-collection/scripts';
|
|
29
|
-
export * from './contracts/interest-collection/transactions';
|
|
30
|
-
export * from './contracts/interest-collection/queries';
|
|
31
|
-
export * from './contracts/interest-oracle/scripts';
|
|
32
|
-
export * from './contracts/version-registry/types';
|
|
33
|
-
export * from './contracts/version-registry/scripts';
|
|
34
|
-
export * from './contracts/treasury/transactions';
|
|
35
|
-
export * from './contracts/treasury/helpers';
|
|
36
|
-
export * from './contracts/treasury/scripts';
|
|
37
|
-
export * from './contracts/treasury/queries';
|
|
38
|
-
export * from './utils/time-helpers';
|
|
39
|
-
export * from './contracts/cdp/scripts';
|
|
40
|
-
export * from './contracts/collector/scripts';
|
|
41
|
-
export * from './contracts/execute/types';
|
|
42
|
-
export * from './contracts/execute/types-new';
|
|
43
|
-
export * from './contracts/execute/scripts';
|
|
44
|
-
export * from './contracts/price-oracle/types';
|
|
45
|
-
export * from './contracts/stability-pool/helpers';
|
|
46
|
-
export * from './contracts/stability-pool/types';
|
|
47
|
-
export * from './contracts/stability-pool/types-new';
|
|
48
|
-
export * from './contracts/stability-pool/queries';
|
|
49
|
-
export * from './contracts/stability-pool/transactions';
|
|
50
|
-
export * from './contracts/stability-pool/scripts';
|
|
51
|
-
export * from './contracts/poll/types-poll-shard';
|
|
52
|
-
export * from './contracts/poll/types-poll-manager';
|
|
53
|
-
export * from './contracts/poll/types-poll-new';
|
|
54
|
-
export * from './types/generic';
|
|
55
|
-
export * from './types/rational';
|
|
56
|
-
export * from './types/system-params';
|
|
57
|
-
export * from './contracts/rob/helpers';
|
|
58
|
-
export * from './contracts/rob/types';
|
|
59
|
-
export * from './contracts/rob/types-new';
|
|
60
|
-
export * from './contracts/rob/transactions';
|
|
61
|
-
export * from './contracts/rob/scripts';
|
|
62
|
-
export * from './contracts/one-shot/scripts';
|
|
63
|
-
export * from './contracts/one-shot/transactions';
|
|
64
|
-
export * from './contracts/one-shot/types';
|
|
65
|
-
export * from './contracts/rob-leverage/transactions';
|
|
66
|
-
export * from './contracts/rob-leverage/helpers';
|
|
67
|
-
export * from './contracts/price-oracle/transactions';
|
|
68
|
-
export * from './contracts/price-oracle/types';
|
|
69
|
-
export * from './contracts/price-oracle/types-new';
|
|
70
|
-
export * from './contracts/price-oracle/scripts';
|
|
71
|
-
export * from './utils/utils';
|
|
72
|
-
export * from './utils/array-utils';
|
|
73
|
-
export * from './utils/lucid-utils';
|
|
74
|
-
export * from './utils/helper-txs';
|
|
75
|
-
export * from './utils/bigint-utils';
|
|
76
|
-
export * from './contracts/initialize/types';
|
|
77
|
-
export * from './contracts/initialize/helpers';
|
|
78
|
-
export * from './contracts/initialize/actions';
|
|
79
|
-
export * from './utils/pyth';
|
|
80
|
-
export * from './contracts/pyth-feed/types';
|
|
81
|
-
export * from './contracts/pyth-feed/scripts';
|
|
82
|
-
export * from './contracts/pyth-feed/helpers';
|
|
83
|
-
export * from './contracts/iasset/types';
|
|
84
|
-
export * from './contracts/iasset/scripts';
|
|
85
|
-
export * from './contracts/iasset/helpers';
|
|
86
|
-
export * from './contracts/iasset/queries';
|
|
87
|
-
export * from './contracts/stableswap/helpers';
|
|
88
|
-
export * from './contracts/stableswap/transactions';
|
|
89
|
-
export * from './contracts/stableswap/types-new';
|
|
90
|
-
export * from './contracts/stableswap/scripts';
|
|
91
|
-
export * from './scripts/iasset-policy';
|
|
92
|
-
export * from './scripts/auth-token-policy';
|
|
93
|
-
export * from './scripts/always-fail-validator';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SpendingValidator } from '@lucid-evolution/lucid';
|
|
2
|
-
|
|
3
|
-
export const alwaysFailValidator: SpendingValidator = {
|
|
4
|
-
type: 'PlutusV2',
|
|
5
|
-
script:
|
|
6
|
-
'587f010000323232323232232253330044a029309b2b19299980199b874800000454ccc018c014dd50010a4c2c2a66600666e1d2002001132325333008300a002149858dd7180400098029baa002153330033370e900200089919299980418050010a4c2c6010002600a6ea800858c00cdd5000ab9a5573aaae7955cfaba157441',
|
|
7
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { AssetClass } from '@3rd-eye-labs/cardano-offchain-common';
|
|
2
|
-
import {
|
|
3
|
-
applyParamsToScript,
|
|
4
|
-
Constr,
|
|
5
|
-
MintingPolicy,
|
|
6
|
-
ScriptType,
|
|
7
|
-
toHex,
|
|
8
|
-
} from '@lucid-evolution/lucid';
|
|
9
|
-
|
|
10
|
-
const authPolicyData = {
|
|
11
|
-
type: 'PlutusV2' as ScriptType,
|
|
12
|
-
cborHex:
|
|
13
|
-
'5904d95904d60100003232323232323232323232323232323232323232323232323232223232223232323253355335533357346042660166018a00200e03026464666ae68cdc419806980728019980b9999aa999ab9a3370e90030008990911118020029aba1302400215333573466e1d20040011321222230020053574260480042a666ae68c08c0044c848888c004014d5d098120010a999ab9a30220011321222230030053574260480040424c40024c4c016900100a80d98120009baa3500201d01813357389213d4d75737420636f6e73756d65204e4654206f7220746f6b656e2070726576696f75736c79206d696e746564207573696e67207468697320706f6c6963790001301415335738920103505435001613253335734604060460022646464646464646464646464646464646464646464642466666666666600202e02a02602201e01a01601200e00a0060046ae84d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d118118011aba1302200101f37546a002036a666ae68c078c0840084c8c848cc00400c008d5d09aba2302100335742604000403aa666ae68c074c080dd500180880e1baa00153335734603260380022646601e6ae84004d5d09aba2001301b00101837540044464646603a4466a0029000111a801112999ab9a3375e0040102660464466a0029000111a801112999ab9a3375e00401a20022600c0060022600c0060086a00402a6a0020264666aa6020026660144466aa601c02a46a002446601e00466aa602203046a0024466024004666a0026e012000700466e0000520000013355300e015235001223300f00233350012335530120192350012233013002300e0010012233300a0090020012335530120192350012233013002301000100133300500400200100e232333008200133008200175a6aa666ae68c05cc0680044c8c8c8c8c8c848cccc00401c01400c008d5d09aba2002357420026ae88008d5d08009aba2301a00235742603200202c44440066ea8d400404ccc06488cccd55cf800900891919809a999ab9a3019301c001132321233001003002357426ae88c070008d5d0980d80080c18021aba200337546ae84008054dd61a80091111111111100611199ab9a3375e00400201c010444666aa601602601e66aa601802646a002446601a0046010002666aa6016026446a00444a66a666aa602802e6601c4466601402e004002601002c46a002446601400400a00c200626602600800601c00266aa601802646a002446601a0046603844a66a002260180064426a00444a66a6601800401022444660040140082600c00600800446600244a66a004018200200a4244460060084446602c446666aae7c00480388c8cc040cc02cc01cc064004c018c060004c010d5d10019aba1002012375600242444600200820142014442466002006004601c4422444a66a00220044426600a004666aa600e01e00a008002601a442244a66a00200a44266012600800466aa600c01a00800220022006442446600200800660124422444a66a00226a00600e442666a00a0106008004666aa600e01400a0080024400444002240022a66ae71241035054310016370e90001b874800955cf2ab9d2323001001223300330020020011',
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export function mkAuthTokenPolicy(ac: AssetClass, tn: string): MintingPolicy {
|
|
17
|
-
return {
|
|
18
|
-
type: authPolicyData.type,
|
|
19
|
-
script: applyParamsToScript(authPolicyData.cborHex, [
|
|
20
|
-
new Constr(0, [toHex(ac.currencySymbol), toHex(ac.tokenName)]),
|
|
21
|
-
tn,
|
|
22
|
-
]),
|
|
23
|
-
};
|
|
24
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { AssetClass } from '@3rd-eye-labs/cardano-offchain-common';
|
|
2
|
-
import {
|
|
3
|
-
applyParamsToScript,
|
|
4
|
-
Constr,
|
|
5
|
-
MintingPolicy,
|
|
6
|
-
ScriptType,
|
|
7
|
-
toHex,
|
|
8
|
-
} from '@lucid-evolution/lucid';
|
|
9
|
-
|
|
10
|
-
const iassetPolicyData = {
|
|
11
|
-
type: 'PlutusV2' as ScriptType,
|
|
12
|
-
cborHex:
|
|
13
|
-
'59047b590478010000323232323232323232323232323232323232323232323232323232323232330102223253353300453335734603e60426ea800c04c0794ccd5cd180f98108008991909198008018011aba13574460420046ae84c08000407804c54cd5ce248103505435001637540026602044464a66aa666ae68cdc419803199aa980d00e803919980810008079a98071a80080e9003998089192999ab9a30213023001132321233001003002357426ae88c08c008d5d098110008101baa00135500122222222222200c004480084ccd5cd19b8748008cc018ccd54c06807401c8ccc040800403cd4004801ccc044034d5400488888888888802801006004805c05c4cd5ce24910434450546f6b656e206d697373696e670001213253335734603e60420022646464646464646464646464646464646464646464642466666666666600202e02a02602201e01a01601200e00a0060046ae84d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d10011aba1001357440046ae84004d5d118108011aba1302000101e37546a002034464a666ae68c074c07c0044c8c848cc00400c008d5d09aba2301f00235742603c0020386ea800488800c88c8c8cc08088cd400520002235002225333573466ebc0080204cc09888cd400520002235002225333573466ebc00803440044c01800c0044c01800c010d4008064d400405ccc02488cd54c0440608d400488cc038008cd54c05006c8d400488cc044008ccd4004dc024000e008cdc0000a400000266aa602203046a002446601c004666a002466aa602a03846a0024466024004601a00200244666012010004002466aa602a03846a0024466024004601c00200266600800600400202244666ae68cdd7801000809006111199aa980780b80999aa980800b91a80091198068011804000999aa980780b911a80111299a999aa980c00d998071119980500d801000980400d11a8009119805001002803080189980b80200180900099aa980800b91a80091198068011980f91299a800898058019109a80111299a9980600100408911198010050020980300180200111980091299a80100808008049091118018021091118008021192999ab9a301430160011323232323232123333001007005003002357426ae88008d5d08009aba2002357420026ae88c058008d5d0980a8008099baa00133001200175a4446602c446666aae7c004803c8c8cc044cc020c01cc064004c018c060004c010d5d10019aba100201337560024424660020060044466026446666aae7c00480308cc034c014d5d080118019aba200201037580022014201444460066004002601a4422444a66a00220044426600a004666aa600e01e00a0080026018442244a66a00200a44266012600800466aa600c01a00800220022006442446600200800660104422444a66a00226a00600e442666a00a0106008004666aa600e01400a0080024400444002240022a66ae71241035054310016370e90002ab9e5573a4646002002446600660040040021',
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export function mkIAssetTokenPolicy(ac: AssetClass): MintingPolicy {
|
|
17
|
-
return {
|
|
18
|
-
type: iassetPolicyData.type,
|
|
19
|
-
script: applyParamsToScript(iassetPolicyData.cborHex, [
|
|
20
|
-
new Constr(0, [toHex(ac.currencySymbol), toHex(ac.tokenName)]),
|
|
21
|
-
]),
|
|
22
|
-
};
|
|
23
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { CBOR } from '@evolution-sdk/evolution';
|
|
2
|
-
|
|
3
|
-
/**`
|
|
4
|
-
* This is related to our on-chain codebase for aiken v1.0.26-alpha
|
|
5
|
-
*/
|
|
6
|
-
export const DEFAULT_SCHEMA_OPTIONS = {
|
|
7
|
-
mode: 'custom',
|
|
8
|
-
useIndefiniteArrays: true,
|
|
9
|
-
// This is important to match aiken's Map encoding.
|
|
10
|
-
useIndefiniteMaps: false,
|
|
11
|
-
useDefiniteForEmpty: true,
|
|
12
|
-
sortMapKeys: false,
|
|
13
|
-
useMinimalEncoding: true,
|
|
14
|
-
mapsAsObjects: false,
|
|
15
|
-
encodeMapAsPairs: false,
|
|
16
|
-
} as const satisfies CBOR.CodecOptions;
|
package/src/types/generic.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { AssetClass } from '@3rd-eye-labs/cardano-offchain-common';
|
|
2
|
-
import { Data, fromHex, toHex, UTxO } from '@lucid-evolution/lucid';
|
|
3
|
-
|
|
4
|
-
export const AssetClassSchema = Data.Object({
|
|
5
|
-
currencySymbol: Data.Bytes(),
|
|
6
|
-
/** Use the HEX encoding */
|
|
7
|
-
tokenName: Data.Bytes(),
|
|
8
|
-
});
|
|
9
|
-
export type AssetClassD = Data.Static<typeof AssetClassSchema>;
|
|
10
|
-
|
|
11
|
-
export function toAssetClassFromLucid(asset: AssetClassD): AssetClass {
|
|
12
|
-
return {
|
|
13
|
-
currencySymbol: fromHex(asset.currencySymbol),
|
|
14
|
-
tokenName: fromHex(asset.tokenName),
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function getAssetClassComparisonStr(asset: AssetClass): string {
|
|
19
|
-
return `${toHex(asset.currencySymbol)}${toHex(asset.tokenName)}`;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const VerificationKeyHashSchema = Data.Bytes();
|
|
23
|
-
|
|
24
|
-
export const CredentialSchema = Data.Enum([
|
|
25
|
-
Data.Object({
|
|
26
|
-
PublicKeyCredential: Data.Tuple([VerificationKeyHashSchema]),
|
|
27
|
-
}),
|
|
28
|
-
Data.Object({
|
|
29
|
-
ScriptCredential: Data.Tuple([Data.Bytes()]),
|
|
30
|
-
}),
|
|
31
|
-
]);
|
|
32
|
-
export type CredentialD = Data.Static<typeof CredentialSchema>;
|
|
33
|
-
export const CredentialD = CredentialSchema as unknown as CredentialD;
|
|
34
|
-
|
|
35
|
-
export const StakeCredentialSchema = Data.Enum([
|
|
36
|
-
Data.Object({ Inline: Data.Tuple([CredentialSchema]) }),
|
|
37
|
-
Data.Object({
|
|
38
|
-
Pointer: Data.Tuple([
|
|
39
|
-
Data.Object({
|
|
40
|
-
slotNumber: Data.Integer(),
|
|
41
|
-
transactionIndex: Data.Integer(),
|
|
42
|
-
certificateIndex: Data.Integer(),
|
|
43
|
-
}),
|
|
44
|
-
]),
|
|
45
|
-
}),
|
|
46
|
-
]);
|
|
47
|
-
|
|
48
|
-
export type StakeCredential = Data.Static<typeof StakeCredentialSchema>;
|
|
49
|
-
export const StakeCredential =
|
|
50
|
-
StakeCredentialSchema as unknown as StakeCredential;
|
|
51
|
-
|
|
52
|
-
export type ParsedOutput<T> = { utxo: UTxO; datum: T };
|
package/src/types/multisig.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { TSchema, Data } from '@evolution-sdk/evolution';
|
|
2
|
-
import { Schema } from 'effect';
|
|
3
|
-
|
|
4
|
-
const OpaqueData = Schema.typeSchema(Data.DataSchema);
|
|
5
|
-
|
|
6
|
-
export const MultisigSchema = TSchema.Union(
|
|
7
|
-
TSchema.Struct(
|
|
8
|
-
{
|
|
9
|
-
Signature: TSchema.Struct(
|
|
10
|
-
{
|
|
11
|
-
keyHash: TSchema.ByteArray,
|
|
12
|
-
},
|
|
13
|
-
{ flatFields: true },
|
|
14
|
-
),
|
|
15
|
-
},
|
|
16
|
-
{ flatInUnion: true },
|
|
17
|
-
),
|
|
18
|
-
TSchema.Struct(
|
|
19
|
-
{
|
|
20
|
-
AtLeast: TSchema.Struct(
|
|
21
|
-
{
|
|
22
|
-
required: TSchema.Integer,
|
|
23
|
-
authSignatories: TSchema.Array(OpaqueData),
|
|
24
|
-
},
|
|
25
|
-
{ flatFields: true },
|
|
26
|
-
),
|
|
27
|
-
},
|
|
28
|
-
{ flatInUnion: true },
|
|
29
|
-
),
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
export type Multisig = typeof MultisigSchema.Type;
|
|
33
|
-
|
|
34
|
-
export function parseMultisig(datum: string): Multisig {
|
|
35
|
-
return Data.withSchema(MultisigSchema).fromCBORHex(datum);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function fromDataMultisig(data: Data.Data): Multisig {
|
|
39
|
-
return Data.withSchema(MultisigSchema).fromCBORHex(Data.toCBORHex(data));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function toDataMultisig(data: Multisig): Data.Data {
|
|
43
|
-
return Data.withSchema(MultisigSchema).toData(data);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function serialiseMultisig(datum: Multisig): string {
|
|
47
|
-
return Data.withSchema(MultisigSchema).toCBORHex(datum);
|
|
48
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { TSchema } from '@evolution-sdk/evolution';
|
|
2
|
-
import { divideOnChainCompatible } from '../utils/bigint-utils';
|
|
3
|
-
|
|
4
|
-
export const OCD_DECIMAL_UNIT: bigint = 1_000_000n;
|
|
5
|
-
|
|
6
|
-
export const OnChainDecimalSchema = TSchema.Struct({
|
|
7
|
-
getOnChainInt: TSchema.Integer,
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export type OnChainDecimal = typeof OnChainDecimalSchema.Type;
|
|
11
|
-
|
|
12
|
-
export function ocdCeil(a: OnChainDecimal): bigint {
|
|
13
|
-
const whole = a.getOnChainInt / OCD_DECIMAL_UNIT;
|
|
14
|
-
|
|
15
|
-
return a.getOnChainInt > whole * OCD_DECIMAL_UNIT ? whole + 1n : whole;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function ocdFloor(a: OnChainDecimal): bigint {
|
|
19
|
-
return a.getOnChainInt / OCD_DECIMAL_UNIT;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function ocdNegate(a: OnChainDecimal): OnChainDecimal {
|
|
23
|
-
return { getOnChainInt: -a.getOnChainInt };
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function ocdMul(a: OnChainDecimal, b: OnChainDecimal): OnChainDecimal {
|
|
27
|
-
return {
|
|
28
|
-
getOnChainInt: divideOnChainCompatible(
|
|
29
|
-
a.getOnChainInt * b.getOnChainInt,
|
|
30
|
-
OCD_DECIMAL_UNIT,
|
|
31
|
-
),
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function ocdDiv(a: OnChainDecimal, b: OnChainDecimal): OnChainDecimal {
|
|
36
|
-
return {
|
|
37
|
-
getOnChainInt: divideOnChainCompatible(
|
|
38
|
-
a.getOnChainInt * OCD_DECIMAL_UNIT,
|
|
39
|
-
b.getOnChainInt,
|
|
40
|
-
),
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function ocdAdd(a: OnChainDecimal, b: OnChainDecimal): OnChainDecimal {
|
|
45
|
-
return {
|
|
46
|
-
getOnChainInt: a.getOnChainInt + b.getOnChainInt,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function ocdSub(a: OnChainDecimal, b: OnChainDecimal): OnChainDecimal {
|
|
51
|
-
return {
|
|
52
|
-
getOnChainInt: a.getOnChainInt - b.getOnChainInt,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export const OCD_ONE: OnChainDecimal = { getOnChainInt: 1_000_000n };
|
|
57
|
-
export const OCD_ZERO: OnChainDecimal = { getOnChainInt: 0n };
|
package/src/types/rational.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { TSchema } from '@evolution-sdk/evolution';
|
|
2
|
-
import { divideOnChainCompatible } from '../utils/bigint-utils';
|
|
3
|
-
|
|
4
|
-
export const RationalSchema = TSchema.Struct({
|
|
5
|
-
numerator: TSchema.Integer,
|
|
6
|
-
denominator: TSchema.Integer,
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export type Rational = typeof RationalSchema.Type;
|
|
10
|
-
|
|
11
|
-
export const rationalZero: Rational = { numerator: 0n, denominator: 1n };
|
|
12
|
-
|
|
13
|
-
export function rationalFromInt(a: bigint): Rational {
|
|
14
|
-
return { numerator: a, denominator: 1n };
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function rationalFloor(a: Rational): bigint {
|
|
18
|
-
return divideOnChainCompatible(a.numerator, a.denominator);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function rationalCeil(a: Rational): bigint {
|
|
22
|
-
const intDiv = a.numerator / a.denominator;
|
|
23
|
-
return a.numerator % a.denominator > 0n ? intDiv + 1n : intDiv;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function rationalNegate(a: Rational): Rational {
|
|
27
|
-
return { numerator: -a.numerator, denominator: a.denominator };
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function rationalAdd(a: Rational, b: Rational): Rational {
|
|
31
|
-
return {
|
|
32
|
-
numerator: a.numerator * b.denominator + b.numerator * a.denominator,
|
|
33
|
-
denominator: a.denominator * b.denominator,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function rationalSub(a: Rational, b: Rational): Rational {
|
|
38
|
-
return {
|
|
39
|
-
numerator: a.numerator * b.denominator - b.numerator * a.denominator,
|
|
40
|
-
denominator: a.denominator * b.denominator,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function rationalMul(a: Rational, b: Rational): Rational {
|
|
45
|
-
return {
|
|
46
|
-
numerator: a.numerator * b.numerator,
|
|
47
|
-
denominator: a.denominator * b.denominator,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function rationalDiv(a: Rational, b: Rational): Rational {
|
|
52
|
-
if (b.numerator === 0n) throw new Error('Cannot divide by zero.');
|
|
53
|
-
return {
|
|
54
|
-
numerator: a.numerator * b.denominator,
|
|
55
|
-
denominator: a.denominator * b.numerator,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function rationalToFloat(a: Rational): number {
|
|
60
|
-
return Number(a.numerator) / Number(a.denominator);
|
|
61
|
-
}
|