@indigo-labs/indigo-sdk 0.2.42 → 0.3.1

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 (202) hide show
  1. package/.github/workflows/ci.yml +4 -2
  2. package/README.md +88 -15
  3. package/dist/index.d.mts +3012 -2194
  4. package/dist/index.d.ts +3012 -2194
  5. package/dist/index.js +9849 -6198
  6. package/dist/index.mjs +8733 -4933
  7. package/package.json +14 -3
  8. package/src/contracts/cdp/helpers.ts +68 -72
  9. package/src/contracts/cdp/scripts.ts +50 -13
  10. package/src/contracts/cdp/transactions.ts +841 -546
  11. package/src/contracts/cdp/types-new.ts +256 -0
  12. package/src/contracts/cdp/types.ts +26 -144
  13. package/src/contracts/cdp-creator/scripts.ts +15 -9
  14. package/src/contracts/cdp-creator/types-new.ts +50 -0
  15. package/src/contracts/cdp-creator/types.ts +5 -31
  16. package/src/contracts/collector/scripts.ts +1 -1
  17. package/src/contracts/collector/transactions.ts +23 -13
  18. package/src/contracts/collector/types-new.ts +17 -0
  19. package/src/contracts/execute/scripts.ts +19 -10
  20. package/src/contracts/execute/types-new.ts +44 -0
  21. package/src/contracts/execute/types.ts +5 -38
  22. package/src/contracts/gov/helpers.ts +187 -51
  23. package/src/contracts/gov/scripts.ts +17 -10
  24. package/src/contracts/gov/transactions.ts +599 -271
  25. package/src/contracts/gov/types-new.ts +253 -100
  26. package/src/contracts/gov/types.ts +4 -71
  27. package/src/contracts/iasset/helpers.ts +172 -0
  28. package/src/contracts/iasset/scripts.ts +38 -0
  29. package/src/contracts/iasset/types.ts +154 -0
  30. package/src/contracts/initialize/actions.ts +768 -0
  31. package/src/contracts/initialize/helpers.ts +611 -36
  32. package/src/contracts/initialize/types.ts +102 -28
  33. package/src/contracts/interest-collection/helpers.ts +19 -0
  34. package/src/contracts/interest-collection/scripts.ts +44 -0
  35. package/src/contracts/interest-collection/transactions.ts +436 -0
  36. package/src/contracts/interest-collection/types-new.ts +50 -0
  37. package/src/contracts/interest-collection/types.ts +26 -0
  38. package/src/contracts/interest-oracle/helpers.ts +2 -30
  39. package/src/contracts/interest-oracle/scripts.ts +1 -1
  40. package/src/contracts/interest-oracle/transactions.ts +21 -16
  41. package/src/contracts/interest-oracle/types-new.ts +32 -0
  42. package/src/contracts/interest-oracle/types.ts +1 -40
  43. package/src/contracts/one-shot/transactions.ts +1 -2
  44. package/src/contracts/poll/helpers.ts +5 -23
  45. package/src/contracts/poll/scripts.ts +12 -13
  46. package/src/contracts/poll/types-poll-manager.ts +1 -19
  47. package/src/contracts/poll/types-poll-new.ts +170 -0
  48. package/src/contracts/poll/types-poll-shard.ts +2 -24
  49. package/src/contracts/price-oracle/helpers.ts +1 -4
  50. package/src/contracts/price-oracle/scripts.ts +3 -8
  51. package/src/contracts/price-oracle/transactions.ts +32 -25
  52. package/src/contracts/price-oracle/types-new.ts +50 -0
  53. package/src/contracts/price-oracle/types.ts +2 -36
  54. package/src/contracts/pyth-feed/helpers.ts +58 -0
  55. package/src/contracts/pyth-feed/scripts.ts +15 -0
  56. package/src/contracts/pyth-feed/types.ts +181 -0
  57. package/src/contracts/rob/helpers.ts +405 -0
  58. package/src/contracts/rob/scripts.ts +35 -0
  59. package/src/contracts/rob/transactions.ts +410 -0
  60. package/src/contracts/rob/types-new.ts +128 -0
  61. package/src/contracts/rob/types.ts +16 -0
  62. package/src/contracts/rob-leverage/helpers.ts +424 -0
  63. package/src/contracts/{leverage → rob-leverage}/transactions.ts +68 -48
  64. package/src/contracts/stability-pool/helpers.ts +714 -230
  65. package/src/contracts/stability-pool/scripts.ts +20 -15
  66. package/src/contracts/stability-pool/transactions.ts +628 -496
  67. package/src/contracts/stability-pool/types-new.ts +247 -100
  68. package/src/contracts/stability-pool/types.ts +5 -22
  69. package/src/contracts/stableswap/helpers.ts +22 -0
  70. package/src/contracts/stableswap/scripts.ts +37 -0
  71. package/src/contracts/stableswap/transactions.ts +647 -0
  72. package/src/contracts/stableswap/types-new.ts +131 -0
  73. package/src/contracts/stableswap/types.ts +17 -0
  74. package/src/contracts/staking/helpers.ts +49 -34
  75. package/src/contracts/staking/scripts.ts +1 -1
  76. package/src/contracts/staking/transactions.ts +85 -130
  77. package/src/contracts/staking/types-new.ts +60 -28
  78. package/src/contracts/staking/types.ts +1 -28
  79. package/src/contracts/treasury/helpers.ts +21 -0
  80. package/src/contracts/treasury/scripts.ts +16 -26
  81. package/src/contracts/treasury/transactions.ts +256 -27
  82. package/src/contracts/treasury/types-new.ts +69 -0
  83. package/src/contracts/treasury/types.ts +2 -43
  84. package/src/contracts/version-registry/scripts.ts +2 -2
  85. package/src/contracts/version-registry/types-new.ts +6 -7
  86. package/src/index.ts +37 -20
  87. package/src/scripts/auth-token-policy.ts +3 -2
  88. package/src/scripts/iasset-policy.ts +3 -2
  89. package/src/types/evolution-schema-options.ts +3 -3
  90. package/src/types/generic.ts +17 -89
  91. package/src/types/multisig.ts +48 -0
  92. package/src/types/on-chain-decimal.ts +14 -7
  93. package/src/types/rational.ts +61 -0
  94. package/src/types/system-params.ts +237 -41
  95. package/src/utils/array-utils.ts +70 -1
  96. package/src/utils/bigint-utils.ts +12 -0
  97. package/src/utils/indigo-helpers.ts +8 -10
  98. package/src/utils/lucid-utils.ts +47 -40
  99. package/src/utils/oracle-helpers.ts +62 -0
  100. package/src/utils/pyth/decode.ts +223 -0
  101. package/src/utils/pyth/encode.ts +262 -0
  102. package/src/utils/pyth/index.ts +14 -0
  103. package/src/utils/pyth/types.ts +87 -0
  104. package/src/validators/always-succeed-validator.ts +6 -0
  105. package/src/validators/cdp-creator-validator.ts +2 -2
  106. package/src/validators/cdp-redeem-validator.ts +7 -0
  107. package/src/validators/cdp-validator.ts +2 -2
  108. package/src/validators/collector-validator.ts +2 -2
  109. package/src/validators/execute-validator.ts +2 -2
  110. package/src/validators/governance-validator.ts +2 -2
  111. package/src/validators/iasset-validator.ts +7 -0
  112. package/src/validators/interest-collection-validator.ts +7 -0
  113. package/src/validators/interest-oracle-validator.ts +2 -2
  114. package/src/validators/poll-manager-validator.ts +2 -2
  115. package/src/validators/poll-shard-validator.ts +2 -2
  116. package/src/validators/price-oracle-validator.ts +7 -0
  117. package/src/validators/pyth-feed-validator.ts +7 -0
  118. package/src/validators/rob-validator.ts +7 -0
  119. package/src/validators/stability-pool-validator.ts +2 -2
  120. package/src/validators/stableswap-validator.ts +7 -0
  121. package/src/validators/staking-validator.ts +2 -2
  122. package/src/validators/treasury-validator.ts +2 -2
  123. package/src/validators/version-record-policy.ts +2 -2
  124. package/src/validators/version-registry-validator.ts +2 -2
  125. package/tests/always-succeed/script.ts +7 -0
  126. package/tests/bigint-utils.test.ts +41 -0
  127. package/tests/cdp/actions.ts +610 -0
  128. package/tests/cdp/cdp-helpers.ts +55 -0
  129. package/tests/cdp/cdp-queries.ts +440 -0
  130. package/tests/cdp/cdp.test.ts +6087 -0
  131. package/tests/cdp/transactions-mutated.ts +1729 -0
  132. package/tests/data/system-params.json +177 -34
  133. package/tests/datums.test.ts +209 -210
  134. package/tests/endpoints/initialize.ts +68 -0
  135. package/tests/endpoints/interest-collector.ts +37 -0
  136. package/tests/endpoints/treasury.ts +70 -0
  137. package/tests/gov/actions.ts +406 -0
  138. package/tests/gov/gov.test.ts +4450 -0
  139. package/tests/{queries → gov}/governance-queries.ts +6 -3
  140. package/tests/hash-checks.test.ts +38 -11
  141. package/tests/indigo-test-helpers.ts +100 -0
  142. package/tests/initialize.test.ts +61 -9
  143. package/tests/interest-collection/interest-collection.test.ts +892 -0
  144. package/tests/interest-collection/interest-collector-queries.ts +49 -0
  145. package/tests/interest-collection/transactions-mutated.ts +260 -0
  146. package/tests/interest-oracle.test.ts +43 -35
  147. package/tests/mock/assets-mock.ts +234 -23
  148. package/tests/mock/protocol-params-mock.ts +21 -0
  149. package/tests/price-oracle/actions.ts +163 -0
  150. package/tests/price-oracle/price-oracle-queries.ts +12 -0
  151. package/tests/price-oracle/price-oracle.test.ts +240 -0
  152. package/tests/price-oracle/transactions-mutated.ts +62 -0
  153. package/tests/pyth/endpoints.ts +96 -0
  154. package/tests/pyth/helpers.ts +37 -0
  155. package/tests/pyth/pyth-encoding.test.ts +376 -0
  156. package/tests/pyth/pyth-indigo.test.ts +509 -0
  157. package/tests/pyth/pyth.test.ts +300 -0
  158. package/tests/queries/execute-queries.ts +6 -5
  159. package/tests/queries/iasset-queries.ts +175 -5
  160. package/tests/queries/interest-oracle-queries.ts +4 -2
  161. package/tests/queries/poll-queries.ts +8 -9
  162. package/tests/queries/stability-pool-queries.ts +95 -48
  163. package/tests/queries/staking-queries.ts +4 -2
  164. package/tests/queries/treasury-queries.ts +80 -5
  165. package/tests/rob/actions.ts +58 -0
  166. package/tests/{lrp-leverage.test.ts → rob/rob-leverage.test.ts} +393 -296
  167. package/tests/rob/rob-queries.ts +95 -0
  168. package/tests/rob/rob.test.ts +3762 -0
  169. package/tests/rob/transactions-mutated.ts +853 -0
  170. package/tests/script-size.test.ts +240 -0
  171. package/tests/setup.ts +135 -0
  172. package/tests/stability-pool/actions.ts +220 -0
  173. package/tests/stability-pool.test.ts +6121 -667
  174. package/tests/stableswap/stableswap-actions.ts +84 -0
  175. package/tests/stableswap/stableswap-queries.ts +89 -0
  176. package/tests/stableswap/stableswap.test.ts +3891 -0
  177. package/tests/stableswap/transactions-mutated.ts +348 -0
  178. package/tests/staking.test.ts +82 -99
  179. package/tests/test-helpers.ts +58 -11
  180. package/tests/treasury.test.ts +242 -0
  181. package/tests/utils/asserts.ts +74 -0
  182. package/tests/utils/benchmark-utils.ts +81 -0
  183. package/tests/utils/index.ts +122 -4
  184. package/tsconfig.json +9 -1
  185. package/vitest.config.ts +3 -1
  186. package/src/contracts/collector/types.ts +0 -16
  187. package/src/contracts/initialize/transactions.ts +0 -891
  188. package/src/contracts/leverage/helpers.ts +0 -424
  189. package/src/contracts/lrp/helpers.ts +0 -294
  190. package/src/contracts/lrp/scripts.ts +0 -27
  191. package/src/contracts/lrp/transactions.ts +0 -250
  192. package/src/contracts/lrp/types.ts +0 -131
  193. package/src/contracts/poll/types-poll.ts +0 -88
  194. package/src/contracts/vesting/helpers.ts +0 -218
  195. package/src/utils/value-helpers.ts +0 -37
  196. package/src/validators/lrp-validator.ts +0 -7
  197. package/tests/cdp.test.ts +0 -1528
  198. package/tests/gov.test.ts +0 -2011
  199. package/tests/lrp.test.ts +0 -673
  200. package/tests/queries/cdp-queries.ts +0 -220
  201. package/tests/queries/lrp-queries.ts +0 -76
  202. package/tests/queries/price-oracle-queries.ts +0 -10
@@ -2,12 +2,14 @@ name: CI
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [main, develop]
5
+ branches:
6
+ - main
7
+ - v3
6
8
  pull_request:
7
9
 
8
10
  jobs:
9
11
  lint-and-build:
10
- runs-on: ubuntu-latest
12
+ runs-on: self-hosted
11
13
 
12
14
  steps:
13
15
  - name: Checkout code
package/README.md CHANGED
@@ -49,18 +49,91 @@ Instructions:
49
49
  2. Run `pnpm install`
50
50
  3. Run `pnpm run test`
51
51
 
52
- ## Endpoints
53
-
54
- - **Open CDP**
55
- - **Close CDP**
56
- - **Deposit Collateral to CDP**
57
- - **Withdraw Collateral from CDP**
58
- - **Mint against CDP**
59
- - **Burn against CDP**
60
- - **Pay CDP Interest**
61
- - **Open a Staking Position**
62
- - **Adjust a Staking Position**
63
- - **Close a Staking Position**
64
- - **Open a Stability Pool Account**
65
- - **Adjust a Stability Pool Account**
66
- - **Close a Stability Pool Account**
52
+ ## Transaction endpoints
53
+
54
+ The SDK exposes **transaction builders** (mostly async functions that return a Lucid `TxBuilder`, or attach to an existing builder). They are grouped below by on-chain contract module under `src/contracts/`.
55
+
56
+ ### CDP (`cdp`)
57
+
58
+ | Function | Summary |
59
+ | -------------- | -------------------------------------------------------------------------------- |
60
+ | `openCdp` | Open a new CDP: deposit collateral, mint iAsset. |
61
+ | `depositCdp` | Add collateral to an existing CDP. |
62
+ | `withdrawCdp` | Withdraw collateral from an existing CDP |
63
+ | `mintCdp` | Mint additional iAsset debt with an existing CDP. |
64
+ | `burnCdp` | Burn iAsset to pay down existing CDP's debt. |
65
+ | `closeCdp` | Close a CDP, burn remaining debt and withdraw collateral. |
66
+ | `redeemCdp` | Redeem iAsset for collateral (burning CDP debt and withdrawing collateral). |
67
+ | `freezeCdp` | Freeze a CDP marking it for liquidation. |
68
+ | `liquidateCdp` | Liquidate a frozen CDP via the stability pool: absorb debt, move collateral. |
69
+ | `mergeCdps` | Merge several frozen CDPs for the same iAsset into a single combined frozen CDP. |
70
+
71
+ ### Collector (`collector`)
72
+
73
+ | Function | Summary |
74
+ | ---------------- | ----------------------------------------------------------- |
75
+ | `collectorFeeTx` | Attach a collector fee payment to an in-flight transaction. |
76
+
77
+ ### Governance (`gov`)
78
+
79
+ | Function | Summary |
80
+ | -------------------- | ------------------------------------------ |
81
+ | `createProposal` | Create a governance proposal. |
82
+ | `createShardsChunks` | Create poll shards for voting. |
83
+ | `vote` | Vote on a poll shard. |
84
+ | `mergeShards` | Merge poll shards to a poll manager. |
85
+ | `endProposal` | End the poll and prepare it for execution. |
86
+ | `executeProposal` | Execute a passed proposal. |
87
+
88
+ ### Stability pool (`stability-pool`)
89
+
90
+ | Function | Summary |
91
+ | ---------------------------- | ----------------------------------------------------- |
92
+ | `requestSpAccountCreation` | Create request for Stability pool account creation. |
93
+ | `requestSpAccountAdjustment` | Create request for Stability pool account adjustment. |
94
+ | `requestSpAccountClosure` | Create request for Stability pool account closure. |
95
+ | `processSpRequest` | Process a request against a Stability pool. |
96
+ | `createE2s2sSnapshots` | Record new epoch–scale–sum snapshot. |
97
+
98
+ ### Staking (`staking`)
99
+
100
+ | Function | Summary |
101
+ | ----------------------- | -------------------------------------------------------- |
102
+ | `openStakingPosition` | Create INDY staking position. |
103
+ | `adjustStakingPosition` | Adjust the stake in your INDY staking position. |
104
+ | `closeStakingPosition` | Close your staking position and withdraw your stake. |
105
+ | `distributeAda` | Distribute ADA from collector to INDY stakers as reward. |
106
+
107
+ ### Interest oracle (`interest-oracle`)
108
+
109
+ | Function | Summary |
110
+ | --------------------- | -------------------------------------------------------- |
111
+ | `startInterestOracle` | Bootstrap an interest oracle UTxO. |
112
+ | `feedInterestOracle` | Update the oracle’s interest rate and last-updated time. |
113
+
114
+ ### Interest collection (`interest-collection`)
115
+
116
+ | Function | Summary |
117
+ | ---------------------- | ------------------------------------------------------------------------------------------- |
118
+ | `batchCollectInterest` | Settle and collect interest for multiple CDPs in a single Tx. |
119
+ | `distributeInterest` | Distribute funds held by interest collector UTxOs according to the interest admin multisig. |
120
+ | `updatePermissions` | Update interest admin permissions. |
121
+
122
+ ### Treasury (`treasury`)
123
+
124
+ | Function | Summary |
125
+ | --------------------------- | ---------------------------------------------------------------------------- |
126
+ | `treasuryFeeTx` | Attach a treasury fee payment to an in-flight transaction. |
127
+ | `treasuryMerge` | Merge multiple treasury UTxOs into one. |
128
+ | `treasurySplit` | Split one treasury UTxO into separate outputs per asset. |
129
+ | `treasuryPrepareWithdrawal` | Prepare treasury UTXO tied to a proposal execution and requested withdrawal. |
130
+
131
+ ### ROB — Indigo order book (`rob`)
132
+
133
+ | Function | Summary |
134
+ | ----------- | ------------------------------------------------------------------------------------- |
135
+ | `openRob` | Create a buy-iAsset or sell-iAsset order. |
136
+ | `cancelRob` | Cancel an open order and recover the deposit. |
137
+ | `redeemRob` | Fill market order using current oracle price. |
138
+ | `adjustRob` | Adjust deposit on an order, update limit price and claim proceeds from order filling. |
139
+ | `claimRob` | Claim proceeds from a filled or partially filled order. |