@indigo-labs/indigo-sdk 0.5.5 → 0.5.7

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.
Files changed (208) hide show
  1. package/dist/index.d.mts +4 -2
  2. package/dist/index.d.ts +4 -2
  3. package/dist/index.js +6 -3
  4. package/dist/index.mjs +5 -3
  5. package/package.json +11 -1
  6. package/.claude/settings.local.json +0 -7
  7. package/.github/workflows/ci.yml +0 -66
  8. package/.husky/pre-commit +0 -1
  9. package/.nvmrc +0 -1
  10. package/.prettierignore +0 -1
  11. package/.prettierrc +0 -6
  12. package/eslint.config.mjs +0 -42
  13. package/scripts/bench.sh +0 -62
  14. package/scripts/run-repeat.sh +0 -22
  15. package/src/contracts/cdp/helpers.ts +0 -173
  16. package/src/contracts/cdp/scripts.ts +0 -70
  17. package/src/contracts/cdp/transactions.ts +0 -1584
  18. package/src/contracts/cdp/types-new.ts +0 -277
  19. package/src/contracts/cdp/types.ts +0 -43
  20. package/src/contracts/cdp-creator/queries.ts +0 -30
  21. package/src/contracts/cdp-creator/scripts.ts +0 -45
  22. package/src/contracts/cdp-creator/types-new.ts +0 -50
  23. package/src/contracts/cdp-creator/types.ts +0 -24
  24. package/src/contracts/collector/scripts.ts +0 -32
  25. package/src/contracts/collector/transactions.ts +0 -50
  26. package/src/contracts/collector/types-new.ts +0 -17
  27. package/src/contracts/execute/scripts.ts +0 -57
  28. package/src/contracts/execute/types-new.ts +0 -44
  29. package/src/contracts/execute/types.ts +0 -24
  30. package/src/contracts/gov/helpers.ts +0 -351
  31. package/src/contracts/gov/scripts.ts +0 -41
  32. package/src/contracts/gov/transactions.ts +0 -1607
  33. package/src/contracts/gov/types-new.ts +0 -268
  34. package/src/contracts/gov/types.ts +0 -22
  35. package/src/contracts/iasset/helpers.ts +0 -170
  36. package/src/contracts/iasset/queries.ts +0 -102
  37. package/src/contracts/iasset/scripts.ts +0 -38
  38. package/src/contracts/iasset/types.ts +0 -154
  39. package/src/contracts/initialize/actions.ts +0 -789
  40. package/src/contracts/initialize/helpers.ts +0 -616
  41. package/src/contracts/initialize/types.ts +0 -116
  42. package/src/contracts/interest-collection/helpers.ts +0 -19
  43. package/src/contracts/interest-collection/queries.ts +0 -66
  44. package/src/contracts/interest-collection/scripts.ts +0 -44
  45. package/src/contracts/interest-collection/transactions.ts +0 -433
  46. package/src/contracts/interest-collection/types-new.ts +0 -50
  47. package/src/contracts/interest-collection/types.ts +0 -26
  48. package/src/contracts/interest-oracle/helpers.ts +0 -61
  49. package/src/contracts/interest-oracle/scripts.ts +0 -18
  50. package/src/contracts/interest-oracle/transactions.ts +0 -151
  51. package/src/contracts/interest-oracle/types-new.ts +0 -32
  52. package/src/contracts/interest-oracle/types.ts +0 -16
  53. package/src/contracts/one-shot/scripts.ts +0 -12
  54. package/src/contracts/one-shot/transactions.ts +0 -66
  55. package/src/contracts/one-shot/types.ts +0 -22
  56. package/src/contracts/poll/helpers.ts +0 -37
  57. package/src/contracts/poll/scripts.ts +0 -71
  58. package/src/contracts/poll/types-poll-manager.ts +0 -20
  59. package/src/contracts/poll/types-poll-new.ts +0 -196
  60. package/src/contracts/poll/types-poll-shard.ts +0 -16
  61. package/src/contracts/price-oracle/helpers.ts +0 -30
  62. package/src/contracts/price-oracle/scripts.ts +0 -18
  63. package/src/contracts/price-oracle/transactions.ts +0 -115
  64. package/src/contracts/price-oracle/types-new.ts +0 -50
  65. package/src/contracts/price-oracle/types.ts +0 -16
  66. package/src/contracts/pyth-feed/helpers.ts +0 -82
  67. package/src/contracts/pyth-feed/scripts.ts +0 -15
  68. package/src/contracts/pyth-feed/types.ts +0 -181
  69. package/src/contracts/rob/helpers.ts +0 -666
  70. package/src/contracts/rob/scripts.ts +0 -35
  71. package/src/contracts/rob/transactions.ts +0 -423
  72. package/src/contracts/rob/types-new.ts +0 -128
  73. package/src/contracts/rob/types.ts +0 -16
  74. package/src/contracts/rob-leverage/helpers.ts +0 -422
  75. package/src/contracts/rob-leverage/transactions.ts +0 -368
  76. package/src/contracts/stability-pool/helpers.ts +0 -798
  77. package/src/contracts/stability-pool/queries.ts +0 -132
  78. package/src/contracts/stability-pool/scripts.ts +0 -51
  79. package/src/contracts/stability-pool/transactions.ts +0 -921
  80. package/src/contracts/stability-pool/types-new.ts +0 -385
  81. package/src/contracts/stability-pool/types.ts +0 -25
  82. package/src/contracts/stableswap/helpers.ts +0 -507
  83. package/src/contracts/stableswap/scripts.ts +0 -37
  84. package/src/contracts/stableswap/transactions.ts +0 -475
  85. package/src/contracts/stableswap/types-new.ts +0 -131
  86. package/src/contracts/stableswap/types.ts +0 -17
  87. package/src/contracts/staking/helpers.ts +0 -136
  88. package/src/contracts/staking/scripts.ts +0 -41
  89. package/src/contracts/staking/transactions.ts +0 -349
  90. package/src/contracts/staking/types-new.ts +0 -137
  91. package/src/contracts/staking/types.ts +0 -17
  92. package/src/contracts/treasury/helpers.ts +0 -21
  93. package/src/contracts/treasury/queries.ts +0 -100
  94. package/src/contracts/treasury/scripts.ts +0 -27
  95. package/src/contracts/treasury/transactions.ts +0 -334
  96. package/src/contracts/treasury/types-new.ts +0 -69
  97. package/src/contracts/treasury/types.ts +0 -14
  98. package/src/contracts/version-registry/scripts.ts +0 -29
  99. package/src/contracts/version-registry/types-new.ts +0 -18
  100. package/src/contracts/version-registry/types.ts +0 -17
  101. package/src/index.ts +0 -99
  102. package/src/scripts/always-fail-validator.ts +0 -7
  103. package/src/scripts/auth-token-policy.ts +0 -24
  104. package/src/scripts/iasset-policy.ts +0 -23
  105. package/src/types/evolution-schema-options.ts +0 -16
  106. package/src/types/generic.ts +0 -52
  107. package/src/types/multisig.ts +0 -48
  108. package/src/types/on-chain-decimal.ts +0 -57
  109. package/src/types/rational.ts +0 -76
  110. package/src/types/system-params.ts +0 -463
  111. package/src/utils/array-utils.ts +0 -108
  112. package/src/utils/bigint-utils.ts +0 -35
  113. package/src/utils/helper-txs.ts +0 -31
  114. package/src/utils/indigo-helpers.ts +0 -17
  115. package/src/utils/lucid-utils.ts +0 -125
  116. package/src/utils/oracle-helpers.ts +0 -62
  117. package/src/utils/pyth/decode.ts +0 -223
  118. package/src/utils/pyth/encode.ts +0 -262
  119. package/src/utils/pyth/index.ts +0 -14
  120. package/src/utils/pyth/types.ts +0 -87
  121. package/src/utils/time-helpers.ts +0 -4
  122. package/src/utils/utils.ts +0 -25
  123. package/src/validators/always-succeed-validator.ts +0 -6
  124. package/src/validators/cdp-creator-validator.ts +0 -7
  125. package/src/validators/cdp-redeem-validator.ts +0 -7
  126. package/src/validators/cdp-validator.ts +0 -7
  127. package/src/validators/collector-validator.ts +0 -7
  128. package/src/validators/execute-validator.ts +0 -7
  129. package/src/validators/governance-validator.ts +0 -7
  130. package/src/validators/iasset-validator.ts +0 -7
  131. package/src/validators/interest-collection-validator.ts +0 -7
  132. package/src/validators/interest-oracle-validator.ts +0 -7
  133. package/src/validators/one-shot-policy.ts +0 -7
  134. package/src/validators/poll-manager-validator.ts +0 -7
  135. package/src/validators/poll-shard-validator.ts +0 -7
  136. package/src/validators/price-oracle-validator.ts +0 -7
  137. package/src/validators/pyth-feed-validator.ts +0 -7
  138. package/src/validators/rob-validator.ts +0 -7
  139. package/src/validators/stability-pool-validator.ts +0 -7
  140. package/src/validators/stableswap-validator.ts +0 -7
  141. package/src/validators/staking-validator.ts +0 -7
  142. package/src/validators/treasury-validator.ts +0 -7
  143. package/src/validators/version-record-policy.ts +0 -7
  144. package/src/validators/version-registry-validator.ts +0 -7
  145. package/tests/always-succeed/script.ts +0 -7
  146. package/tests/array-utils.test.ts +0 -92
  147. package/tests/bigint-utils.test.ts +0 -41
  148. package/tests/cdp/actions.ts +0 -680
  149. package/tests/cdp/cdp-helpers.ts +0 -55
  150. package/tests/cdp/cdp-queries.ts +0 -423
  151. package/tests/cdp/cdp.test.ts +0 -6730
  152. package/tests/cdp/transactions-mutated.ts +0 -1733
  153. package/tests/data/system-params.json +0 -1155
  154. package/tests/datums.test.ts +0 -302
  155. package/tests/endpoints/initialize.ts +0 -78
  156. package/tests/endpoints/interest-collector.ts +0 -37
  157. package/tests/endpoints/treasury.ts +0 -70
  158. package/tests/gov/actions.ts +0 -381
  159. package/tests/gov/gov.test.ts +0 -5147
  160. package/tests/gov/governance-queries.ts +0 -37
  161. package/tests/hash-checks.test.ts +0 -112
  162. package/tests/indigo-test-helpers.ts +0 -99
  163. package/tests/initialize.test.ts +0 -79
  164. package/tests/interest-calculations.test.ts +0 -120
  165. package/tests/interest-collection/interest-collection.test.ts +0 -843
  166. package/tests/interest-collection/transactions-mutated.ts +0 -260
  167. package/tests/interest-oracle.test.ts +0 -93
  168. package/tests/mock/assets-mock.ts +0 -243
  169. package/tests/mock/protocol-params-mock.ts +0 -21
  170. package/tests/price-oracle/actions.ts +0 -161
  171. package/tests/price-oracle/price-oracle-queries.ts +0 -12
  172. package/tests/price-oracle/price-oracle.test.ts +0 -228
  173. package/tests/price-oracle/transactions-mutated.ts +0 -59
  174. package/tests/pyth/endpoints.ts +0 -96
  175. package/tests/pyth/helpers.ts +0 -37
  176. package/tests/pyth/pyth-encoding.test.ts +0 -376
  177. package/tests/pyth/pyth-feeds.test.ts +0 -943
  178. package/tests/pyth/pyth-indigo.test.ts +0 -505
  179. package/tests/pyth/pyth.test.ts +0 -299
  180. package/tests/queries/collector-queries.ts +0 -27
  181. package/tests/queries/execute-queries.ts +0 -47
  182. package/tests/queries/iasset-queries.ts +0 -149
  183. package/tests/queries/interest-oracle-queries.ts +0 -12
  184. package/tests/queries/poll-queries.ts +0 -97
  185. package/tests/queries/staking-queries.ts +0 -54
  186. package/tests/rob/actions.ts +0 -56
  187. package/tests/rob/rob-leverage.test.ts +0 -2555
  188. package/tests/rob/rob-queries.ts +0 -95
  189. package/tests/rob/rob.test.ts +0 -3677
  190. package/tests/rob/transactions-mutated.ts +0 -844
  191. package/tests/script-size.test.ts +0 -240
  192. package/tests/setup.ts +0 -135
  193. package/tests/stability-pool/actions.ts +0 -229
  194. package/tests/stability-pool.test.ts +0 -6491
  195. package/tests/stableswap/stableswap-actions.ts +0 -83
  196. package/tests/stableswap/stableswap-queries.ts +0 -98
  197. package/tests/stableswap/stableswap.test.ts +0 -4471
  198. package/tests/stableswap/transactions-mutated.ts +0 -348
  199. package/tests/staking.test.ts +0 -172
  200. package/tests/test-helpers.ts +0 -94
  201. package/tests/treasury/actions.ts +0 -67
  202. package/tests/treasury/treasury.test.ts +0 -320
  203. package/tests/utils/asserts.ts +0 -87
  204. package/tests/utils/benchmark-utils.ts +0 -130
  205. package/tests/utils/index.ts +0 -168
  206. package/tsconfig.build.json +0 -4
  207. package/tsconfig.json +0 -27
  208. package/vitest.config.ts +0 -11
package/src/index.ts DELETED
@@ -1,99 +0,0 @@
1
- // Reexports
2
- export * as Lucid from '@lucid-evolution/lucid';
3
- export * as OffchainCommon from '@3rd-eye-labs/cardano-offchain-common';
4
- export * as Evo from '@evolution-sdk/evolution';
5
-
6
- // SDK exports
7
- export * from './contracts/cdp/transactions';
8
- export * from './contracts/cdp/helpers';
9
- export * from './contracts/cdp/types';
10
- export * from './contracts/cdp/types-new';
11
- export * from './contracts/cdp/scripts';
12
- export * from './contracts/cdp-creator/types';
13
- export * from './contracts/cdp-creator/scripts';
14
- export * from './contracts/cdp-creator/queries';
15
- export * from './contracts/poll/scripts';
16
- export * from './contracts/collector/transactions';
17
- export * from './contracts/collector/types-new';
18
- export * from './contracts/gov/transactions';
19
- export * from './contracts/gov/types';
20
- export * from './contracts/gov/types-new';
21
- export * from './contracts/gov/scripts';
22
- export * from './contracts/staking/transactions';
23
- export * from './contracts/staking/helpers';
24
- export * from './contracts/staking/types-new';
25
- export * from './contracts/staking/types';
26
- export * from './contracts/staking/scripts';
27
- export * from './contracts/interest-oracle/transactions';
28
- export * from './contracts/interest-oracle/types';
29
- export * from './contracts/interest-oracle/types-new';
30
- export * from './contracts/interest-oracle/helpers';
31
- export * from './contracts/interest-collection/helpers';
32
- export * from './contracts/interest-collection/types';
33
- export * from './contracts/interest-collection/types-new';
34
- export * from './contracts/interest-collection/scripts';
35
- export * from './contracts/interest-collection/transactions';
36
- export * from './contracts/interest-collection/queries';
37
- export * from './contracts/interest-oracle/scripts';
38
- export * from './contracts/version-registry/types';
39
- export * from './contracts/version-registry/scripts';
40
- export * from './contracts/treasury/transactions';
41
- export * from './contracts/treasury/helpers';
42
- export * from './contracts/treasury/scripts';
43
- export * from './contracts/treasury/queries';
44
- export * from './utils/time-helpers';
45
- export * from './contracts/cdp/scripts';
46
- export * from './contracts/collector/scripts';
47
- export * from './contracts/execute/types';
48
- export * from './contracts/execute/types-new';
49
- export * from './contracts/execute/scripts';
50
- export * from './contracts/price-oracle/types';
51
- export * from './contracts/stability-pool/helpers';
52
- export * from './contracts/stability-pool/types';
53
- export * from './contracts/stability-pool/types-new';
54
- export * from './contracts/stability-pool/queries';
55
- export * from './contracts/stability-pool/transactions';
56
- export * from './contracts/stability-pool/scripts';
57
- export * from './contracts/poll/types-poll-shard';
58
- export * from './contracts/poll/types-poll-manager';
59
- export * from './contracts/poll/types-poll-new';
60
- export * from './types/generic';
61
- export * from './types/rational';
62
- export * from './types/system-params';
63
- export * from './contracts/rob/helpers';
64
- export * from './contracts/rob/types';
65
- export * from './contracts/rob/types-new';
66
- export * from './contracts/rob/transactions';
67
- export * from './contracts/rob/scripts';
68
- export * from './contracts/one-shot/scripts';
69
- export * from './contracts/one-shot/transactions';
70
- export * from './contracts/one-shot/types';
71
- export * from './contracts/rob-leverage/transactions';
72
- export * from './contracts/rob-leverage/helpers';
73
- export * from './contracts/price-oracle/transactions';
74
- export * from './contracts/price-oracle/types';
75
- export * from './contracts/price-oracle/types-new';
76
- export * from './contracts/price-oracle/scripts';
77
- export * from './utils/utils';
78
- export * from './utils/array-utils';
79
- export * from './utils/lucid-utils';
80
- export * from './utils/helper-txs';
81
- export * from './utils/bigint-utils';
82
- export * from './contracts/initialize/types';
83
- export * from './contracts/initialize/helpers';
84
- export * from './contracts/initialize/actions';
85
- export * from './utils/pyth';
86
- export * from './contracts/pyth-feed/types';
87
- export * from './contracts/pyth-feed/scripts';
88
- export * from './contracts/pyth-feed/helpers';
89
- export * from './contracts/iasset/types';
90
- export * from './contracts/iasset/scripts';
91
- export * from './contracts/iasset/helpers';
92
- export * from './contracts/iasset/queries';
93
- export * from './contracts/stableswap/helpers';
94
- export * from './contracts/stableswap/transactions';
95
- export * from './contracts/stableswap/types-new';
96
- export * from './contracts/stableswap/scripts';
97
- export * from './scripts/iasset-policy';
98
- export * from './scripts/auth-token-policy';
99
- 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;
@@ -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 };
@@ -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 };
@@ -1,76 +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
- }
62
-
63
- /**
64
- * This is a lossy conversion, the precision determines the number
65
- * of decimal places that will be retained. Additionally, use of floats
66
- * causes some additional imprecisions.
67
- */
68
- export function numberToRational(
69
- num: number,
70
- precision: number = 10 ** 12,
71
- ): Rational {
72
- return {
73
- numerator: BigInt(Math.floor(num * precision)),
74
- denominator: BigInt(precision),
75
- };
76
- }