@argonprotocol/mainchain 1.4.11 → 1.4.12-dev.2bc449e2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@argonprotocol/mainchain",
3
- "version": "1.4.11",
3
+ "version": "1.4.12-dev.2bc449e2",
4
4
  "description": "A client for accessing the Argon mainchain apis.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,11 +14,14 @@
14
14
  "homepage": "https://github.com/argonprotocol/mainchain#readme",
15
15
  "scripts": {
16
16
  "build": "yarn generate:defs && yarn generate:meta && node clean-build.js && yarn tsc",
17
+ "generate:contract-declarations": "tsc -p tsconfig.contracts.json",
17
18
  "generate:defs": "polkadot-types-from-defs --endpoint metadata.json --input ./src/interfaces --package @argonprotocol/mainchain/interfaces",
18
19
  "generate:meta": "polkadot-types-from-chain --endpoint metadata.json --output ./src/interfaces --package @argonprotocol/mainchain/interfaces --strict",
19
20
  "test": "vitest --run --config vitest.config.ts",
20
- "tsc": "yarn workspace @argonprotocol/ethereum-contracts build && tsup",
21
- "watch": "tsup --watch",
21
+ "tsc": "yarn workspace @argonprotocol/ethereum-contracts build && yarn generate:contract-declarations && tsup && yarn validate:package",
22
+ "tsup": "yarn tsc",
23
+ "validate:package": "tsx src/scripts/validatePackage.ts",
24
+ "watch": "yarn generate:contract-declarations && tsup --watch",
22
25
  "typecheck": "tsc --noEmit -p tsconfig.test.json"
23
26
  },
24
27
  "files": [
@@ -59,13 +62,12 @@
59
62
  "@polkadot/util": "^14.0.3",
60
63
  "@polkadot/util-crypto": "^14.0.3",
61
64
  "bignumber.js": "^9.3.1",
62
- "bs58check": "^4.0.0",
63
65
  "camelcase-keys": "^9.1.3",
64
66
  "viem": "^2.38.5"
65
67
  },
66
68
  "devDependencies": {
67
69
  "@argonprotocol/ethereum-contracts": "workspace:*",
68
- "@argonprotocol/testing": "1.4.11",
70
+ "@argonprotocol/testing": "1.4.12-dev.2bc449e2",
69
71
  "@polkadot/typegen": "^16.5.6",
70
72
  "@substrate/ss58-registry": "^1.51.0",
71
73
  "@types/node": "^20",
@@ -73,7 +75,7 @@
73
75
  "tsup": "^8.5.0",
74
76
  "tsx": "^4.20.4",
75
77
  "typescript": "^5.9.2",
76
- "vitest": "^4.0.5"
78
+ "vitest": "^5.0.0"
77
79
  },
78
80
  "packageManager": "yarn@4.1.0"
79
81
  }
@@ -1,5 +1,4 @@
1
1
  // Auto-generated via `yarn polkadot-types-from-chain`, do not edit
2
- /* eslint-disable */
3
2
 
4
3
  // import type lookup before we augment - in some environments
5
4
  // this is required to allow for ambient/previous definitions
@@ -51,6 +50,16 @@ declare module '@polkadot/api-base/types/consts' {
51
50
  **/
52
51
  maxReserves: u32 & AugmentedConst<ApiType>;
53
52
  };
53
+ bitcoinFissions: {
54
+ /**
55
+ * Maximum number of active Fissions that may allocate satoshis from one Lock.
56
+ **/
57
+ maxFissionsPerLock: u32 & AugmentedConst<ApiType>;
58
+ /**
59
+ * Minimum percentage change required to ratchet a Fission.
60
+ **/
61
+ minimumRatchetPercent: Percent & AugmentedConst<ApiType>;
62
+ };
54
63
  bitcoinLocks: {
55
64
  /**
56
65
  * Argon tick per day
@@ -82,11 +91,19 @@ declare module '@polkadot/api-base/types/consts' {
82
91
  * Maximum releasing utxos at a time
83
92
  **/
84
93
  maxConcurrentlyReleasingLocks: u32 & AugmentedConst<ApiType>;
94
+ /**
95
+ * Maximum number of confirmed Bitcoin outputs that may fund one Lock.
96
+ **/
97
+ maxUtxosPerLock: u32 & AugmentedConst<ApiType>;
85
98
  /**
86
99
  * Number of frames orphaned UTXO release entries are retained after a lock lifecycle
87
100
  * transition before being cleaned up.
88
101
  **/
89
102
  orphanedUtxoReleaseExpiryFrames: u64 & AugmentedConst<ApiType>;
103
+ /**
104
+ * Number of Bitcoin blocks to reserve securitization that has not yet been activated.
105
+ **/
106
+ securitizationHoldBlocks: u64 & AugmentedConst<ApiType>;
90
107
  /**
91
108
  * Number of ticks per bitcoin block
92
109
  **/
@@ -94,26 +111,9 @@ declare module '@polkadot/api-base/types/consts' {
94
111
  };
95
112
  bitcoinUtxos: {
96
113
  /**
97
- * Maximum number of candidate UTXOs stored per lock
98
- **/
99
- maxCandidateUtxosPerLock: u32 & AugmentedConst<ApiType>;
100
- /**
101
- * Maximum number of satoshi difference allowed from expected to consider a UTXO as
102
- * "confirmed"
103
- **/
104
- maximumSatoshiThresholdFromExpected: u64 & AugmentedConst<ApiType>;
105
- /**
106
- * Maximum bitcoin blocks to watch a Utxo for confirmation before canceling
114
+ * Maximum number of outputs tracked for a single Lock address.
107
115
  **/
108
- maxPendingConfirmationBlocks: u64 & AugmentedConst<ApiType>;
109
- /**
110
- * The maximum number of UTXOs that can be watched in a block and/or expiring at same block
111
- **/
112
- maxPendingConfirmationUtxos: u32 & AugmentedConst<ApiType>;
113
- /**
114
- * The maximum number of expired pending funding entries cleaned up in a block
115
- **/
116
- maxPendingFundingExpirationsPerBlock: u32 & AugmentedConst<ApiType>;
116
+ maxUtxosPerLock: u32 & AugmentedConst<ApiType>;
117
117
  };
118
118
  blockRewards: {
119
119
  /**
@@ -375,6 +375,10 @@ declare module '@polkadot/api-base/types/consts' {
375
375
  * becomes operational.
376
376
  **/
377
377
  bitcoinLockSizeForAccessCode: u128 & AugmentedConst<ApiType>;
378
+ /**
379
+ * Maximum number of accrued access codes awarded at one frame boundary.
380
+ **/
381
+ maxAccessCodeAwardsPerFrame: u32 & AugmentedConst<ApiType>;
378
382
  /**
379
383
  * Maximum number of available access codes allowed at once.
380
384
  **/
@@ -646,11 +650,6 @@ declare module '@polkadot/api-base/types/consts' {
646
650
  batchedCallsLimit: u32 & AugmentedConst<ApiType>;
647
651
  };
648
652
  vaults: {
649
- /**
650
- * One no-fee stale `initialize_for` failure is allowed for each this-many units of lost
651
- * `available_for_lock`.
652
- **/
653
- capacityDropAttemptUnit: u128 & AugmentedConst<ApiType>;
654
653
  /**
655
654
  * Max concurrent cosigns pending per vault
656
655
  **/
@@ -659,10 +658,6 @@ declare module '@polkadot/api-base/types/consts' {
659
658
  * The max pending vault term changes per block
660
659
  **/
661
660
  maxPendingTermModificationsPerTick: u32 & AugmentedConst<ApiType>;
662
- /**
663
- * Maximum number of recent `available_for_lock` drops retained per vault.
664
- **/
665
- maxRecentCapacityDropsPerVault: u32 & AugmentedConst<ApiType>;
666
661
  /**
667
662
  * The max number of vaults that can be created
668
663
  **/
@@ -675,10 +670,6 @@ declare module '@polkadot/api-base/types/consts' {
675
670
  * Minimum vault securitization required while the operational floor lock is active.
676
671
  **/
677
672
  operationalMinimumVaultSecuritization: u128 & AugmentedConst<ApiType>;
678
- /**
679
- * Number of Argon blocks to keep recent `available_for_lock` drops for stale init checks.
680
- **/
681
- recentCapacityDropBlockWindow: u32 & AugmentedConst<ApiType>;
682
673
  /**
683
674
  * The number of frames within which revenue must be collected
684
675
  **/
@@ -61,6 +61,88 @@ declare module '@polkadot/api-base/types/errors' {
61
61
  **/
62
62
  VestingBalance: AugmentedError<ApiType>;
63
63
  };
64
+ bitcoinFissions: {
65
+ /**
66
+ * A Fission already exists under this owner and Fission ID.
67
+ **/
68
+ FissionAlreadyExists: AugmentedError<ApiType>;
69
+ /**
70
+ * A Fission must allocate at least one satoshi.
71
+ **/
72
+ FissionHasNoSatoshis: AugmentedError<ApiType>;
73
+ /**
74
+ * The submitted Fission ID is below the owner's current minimum.
75
+ **/
76
+ FissionIdBelowMinimum: AugmentedError<ApiType>;
77
+ /**
78
+ * The owner's Fission ID counter cannot be incremented.
79
+ **/
80
+ FissionIdOverflow: AugmentedError<ApiType>;
81
+ /**
82
+ * No Fission exists under this owner and Fission ID.
83
+ **/
84
+ FissionNotFound: AugmentedError<ApiType>;
85
+ /**
86
+ * The requested target-normalized BTC value is not present in recent price history.
87
+ **/
88
+ IneligibleMicrogonsAtTargetPerBtc: AugmentedError<ApiType>;
89
+ /**
90
+ * A source Lock has fewer active Fission satoshis than the Fission being closed.
91
+ **/
92
+ InsufficientFissionedSatoshis: AugmentedError<ApiType>;
93
+ /**
94
+ * A requested source Lock does not have enough unallocated funded satoshis.
95
+ **/
96
+ InsufficientFundedSatoshis: AugmentedError<ApiType>;
97
+ /**
98
+ * The Fission owner cannot burn the complete redemption amount.
99
+ **/
100
+ InsufficientFunds: AugmentedError<ApiType>;
101
+ /**
102
+ * A source Lock's securitization does not cover the requested allocation and liability.
103
+ **/
104
+ InsufficientSecuritization: AugmentedError<ApiType>;
105
+ /**
106
+ * The requested source Lock does not exist.
107
+ **/
108
+ LockNotFound: AugmentedError<ApiType>;
109
+ /**
110
+ * A requested source Lock has no confirmed funding satoshis.
111
+ **/
112
+ LockNotFunded: AugmentedError<ApiType>;
113
+ /**
114
+ * A requested source Lock is already in the release process.
115
+ **/
116
+ LockReleasePending: AugmentedError<ApiType>;
117
+ /**
118
+ * The requested price-history entry predates the Fission or Lock coverage floor.
119
+ **/
120
+ MicrogonsAtTargetPerBtcTickOlderThanCurrent: AugmentedError<ApiType>;
121
+ /**
122
+ * No current Bitcoin price is available to calculate the redemption amount.
123
+ **/
124
+ NoBitcoinPricesAvailable: AugmentedError<ApiType>;
125
+ /**
126
+ * The caller does not own a requested source Lock.
127
+ **/
128
+ NoPermissions: AugmentedError<ApiType>;
129
+ /**
130
+ * The Fission did not meet both the minimum change and Lock coverage requirements.
131
+ **/
132
+ NoRatchetingAvailable: AugmentedError<ApiType>;
133
+ /**
134
+ * A Fission allocation, liability, or identifier overflowed.
135
+ **/
136
+ Overflow: AugmentedError<ApiType>;
137
+ /**
138
+ * The Fission's ratchet counter cannot be incremented.
139
+ **/
140
+ RatchetNumberOverflow: AugmentedError<ApiType>;
141
+ /**
142
+ * The source Lock already has the maximum number of active Fissions.
143
+ **/
144
+ TooManyFissionsForLock: AugmentedError<ApiType>;
145
+ };
64
146
  bitcoinLocks: {
65
147
  /**
66
148
  * The proposed transaction would take the account below the minimum (existential) balance
@@ -78,6 +160,14 @@ declare module '@polkadot/api-base/types/errors' {
78
160
  * This bitcoin pubkey couldn't be decoded for release
79
161
  **/
80
162
  BitcoinPubkeyUnableToBeDecoded: AugmentedError<ApiType>;
163
+ /**
164
+ * A partial release would leave less than the minimum watched Lock amount.
165
+ **/
166
+ BitcoinReleaseChangeBelowMinimum: AugmentedError<ApiType>;
167
+ /**
168
+ * The release destination cannot be the Lock's own script.
169
+ **/
170
+ BitcoinReleaseDestinationIsLockScript: AugmentedError<ApiType>;
81
171
  /**
82
172
  * The bitcoin has passed the deadline to release it
83
173
  **/
@@ -98,6 +188,18 @@ declare module '@polkadot/api-base/types/errors' {
98
188
  * An overflow occurred recording a lock expiration
99
189
  **/
100
190
  ExpirationAtBlockOverflow: AugmentedError<ApiType>;
191
+ /**
192
+ * The fee coupon nonce is not the next unconsumed nonce.
193
+ **/
194
+ FeeCouponAlreadyUsed: AugmentedError<ApiType>;
195
+ /**
196
+ * The fee coupon is past its expiration frame.
197
+ **/
198
+ FeeCouponExpired: AugmentedError<ApiType>;
199
+ /**
200
+ * The Lock records fissioned satoshis without matching active Fission requirements.
201
+ **/
202
+ FissionStateMismatch: AugmentedError<ApiType>;
101
203
  /**
102
204
  * Cannot request an orphaned release for the funding UTXO
103
205
  **/
@@ -111,25 +213,41 @@ declare module '@polkadot/api-base/types/errors' {
111
213
  **/
112
214
  HoldUnexpectedlyModified: AugmentedError<ApiType>;
113
215
  /**
114
- * An ineligible microgon rate per btc was requested
216
+ * The requested target-normalized BTC value is not present in recent price history.
115
217
  **/
116
- IneligibleMicrogonRateRequested: AugmentedError<ApiType>;
218
+ IneligibleMicrogonsAtTargetPerBtcRequested: AugmentedError<ApiType>;
117
219
  InsufficientFunds: AugmentedError<ApiType>;
118
220
  /**
119
- * The minimum number of satoshis was not met
221
+ * The requested Lock securitization has fewer satoshis than its active Fissions.
120
222
  **/
121
- InsufficientSatoshisLocked: AugmentedError<ApiType>;
223
+ InsufficientSatoshisForFissions: AugmentedError<ApiType>;
224
+ /**
225
+ * The requested Lock securitization does not cover its active Fission liabilities.
226
+ **/
227
+ InsufficientSecuritizationForFissions: AugmentedError<ApiType>;
122
228
  InsufficientVaultFunds: AugmentedError<ApiType>;
229
+ /**
230
+ * The external destination amount must be nonzero and fit with the network fee.
231
+ **/
232
+ InvalidBitcoinReleaseAmount: AugmentedError<ApiType>;
123
233
  /**
124
234
  * The bitcoin script to lock this bitcoin has errors
125
235
  **/
126
236
  InvalidBitcoinScript: AugmentedError<ApiType>;
237
+ /**
238
+ * The fee coupon was not signed by the vault delegate.
239
+ **/
240
+ InvalidFeeCouponSignature: AugmentedError<ApiType>;
127
241
  /**
128
242
  * Funding would result in an overflow of the balance type
129
243
  **/
130
244
  InvalidVaultAmount: AugmentedError<ApiType>;
131
245
  /**
132
- * A lock in process of release cannot be ratcheted
246
+ * The Lock cannot be released while it has active Fissions.
247
+ **/
248
+ LockHasActiveFissions: AugmentedError<ApiType>;
249
+ /**
250
+ * A Lock in the release process cannot be resecuritized.
133
251
  **/
134
252
  LockInProcessOfRelease: AugmentedError<ApiType>;
135
253
  /**
@@ -139,11 +257,23 @@ declare module '@polkadot/api-base/types/errors' {
139
257
  /**
140
258
  * The lock funding has not been confirmed on bitcoin
141
259
  **/
142
- LockPendingFunding: AugmentedError<ApiType>;
260
+ LockNotFunded: AugmentedError<ApiType>;
143
261
  /**
144
262
  * Too many orphaned utxo release requests for a lock
145
263
  **/
146
264
  MaxOrphanedUtxoReleaseRequestsExceeded: AugmentedError<ApiType>;
265
+ /**
266
+ * Too many confirmed Bitcoin outputs were assigned to one Lock.
267
+ **/
268
+ MaxUtxosPerLockExceeded: AugmentedError<ApiType>;
269
+ /**
270
+ * The requested price-history entry predates the Lock's current securitization.
271
+ **/
272
+ MicrogonsAtTargetPerBtcTickOlderThanCurrent: AugmentedError<ApiType>;
273
+ /**
274
+ * The minimum cannot increase while a release is pending.
275
+ **/
276
+ MinimumSatoshisIncreaseBlockedByPendingRelease: AugmentedError<ApiType>;
147
277
  /**
148
278
  * The price provider has no bitcoin prices available. This is a temporary error
149
279
  **/
@@ -153,9 +283,9 @@ declare module '@polkadot/api-base/types/errors' {
153
283
  **/
154
284
  NoPermissions: AugmentedError<ApiType>;
155
285
  /**
156
- * Nothing to ratchet
286
+ * The requested securitization matches the Lock's current securitization.
157
287
  **/
158
- NoRatchetingAvailable: AugmentedError<ApiType>;
288
+ NoResecuritizationChange: AugmentedError<ApiType>;
159
289
  /**
160
290
  * No Vault public keys are available
161
291
  **/
@@ -203,9 +333,9 @@ declare module '@polkadot/api-base/types/errors' {
203
333
  **/
204
334
  BitcoinHeightNotConfirmed: AugmentedError<ApiType>;
205
335
  /**
206
- * Duplicated UtxoId. Already in use
336
+ * Duplicated BitcoinLockId. Already in use
207
337
  **/
208
- DuplicateUtxoId: AugmentedError<ApiType>;
338
+ DuplicateLockId: AugmentedError<ApiType>;
209
339
  /**
210
340
  * Insufficient bitcoin amount
211
341
  **/
@@ -218,14 +348,6 @@ declare module '@polkadot/api-base/types/errors' {
218
348
  * Invalid bitcoin sync height attempted
219
349
  **/
220
350
  InvalidBitcoinSyncHeight: AugmentedError<ApiType>;
221
- /**
222
- * This Lock already has an attached funding UTXO
223
- **/
224
- LockAlreadyFunded: AugmentedError<ApiType>;
225
- /**
226
- * Too many candidate UTXOs are being stored for this lock
227
- **/
228
- MaxCandidateUtxosExceeded: AugmentedError<ApiType>;
229
351
  /**
230
352
  * Too many UTXOs are being watched
231
353
  **/
@@ -251,11 +373,7 @@ declare module '@polkadot/api-base/types/errors' {
251
373
  **/
252
374
  ScriptPubkeyConflict: AugmentedError<ApiType>;
253
375
  /**
254
- * The UTXO reference does not map to a candidate entry
255
- **/
256
- UtxoNotCandidate: AugmentedError<ApiType>;
257
- /**
258
- * Locked Utxo Not Found
376
+ * Watched Lock or attached UTXO not found.
259
377
  **/
260
378
  UtxoNotLocked: AugmentedError<ApiType>;
261
379
  };
@@ -1012,6 +1130,11 @@ declare module '@polkadot/api-base/types/errors' {
1012
1130
  * One of the linked account ownership proofs is invalid.
1013
1131
  **/
1014
1132
  InvalidAccountProof: AugmentedError<ApiType>;
1133
+ /**
1134
+ * Profile names must start with an uppercase ASCII letter and otherwise be ASCII
1135
+ * alphanumeric.
1136
+ **/
1137
+ InvalidName: AugmentedError<ApiType>;
1015
1138
  /**
1016
1139
  * The caller is not one of the accounts included in the registration.
1017
1140
  **/
@@ -1239,17 +1362,13 @@ declare module '@polkadot/api-base/types/errors' {
1239
1362
  **/
1240
1363
  BondLotAlreadyReleasing: AugmentedError<ApiType>;
1241
1364
  /**
1242
- * Only an active vault bond owned by its operator can be used as backfill.
1365
+ * Only an active vault bond owned by its operator can be used as flexible.
1243
1366
  **/
1244
- BondLotNotEligibleForBackfill: AugmentedError<ApiType>;
1367
+ BondLotCannotBeFlexible: AugmentedError<ApiType>;
1245
1368
  /**
1246
1369
  * The bond lot could not be found.
1247
1370
  **/
1248
1371
  BondLotNotFound: AugmentedError<ApiType>;
1249
- /**
1250
- * The vault doesn't have enough bitcoin security to support this bond purchase
1251
- **/
1252
- BondPurchaseAboveSecurity: AugmentedError<ApiType>;
1253
1372
  /**
1254
1373
  * The purchase is below the minimum amount.
1255
1374
  **/
@@ -1259,9 +1378,13 @@ declare module '@polkadot/api-base/types/errors' {
1259
1378
  **/
1260
1379
  BondPurchaseRejected: AugmentedError<ApiType>;
1261
1380
  /**
1262
- * The beneficiary already has a bond lot for this vault.
1381
+ * The bonus approval nonce has already been consumed or superseded.
1382
+ **/
1383
+ BonusApprovalAlreadyUsed: AugmentedError<ApiType>;
1384
+ /**
1385
+ * The approved bonus plus the vault's profit sharing exceeds 100%.
1263
1386
  **/
1264
- BonusApprovalExistingBondLot: AugmentedError<ApiType>;
1387
+ BonusApprovalExceedsProfitSharing: AugmentedError<ApiType>;
1265
1388
  /**
1266
1389
  * The bonus approval already expired.
1267
1390
  **/
@@ -1274,6 +1397,10 @@ declare module '@polkadot/api-base/types/errors' {
1274
1397
  * The bonus approval was signed for a different vault.
1275
1398
  **/
1276
1399
  BonusApprovalWrongVault: AugmentedError<ApiType>;
1400
+ /**
1401
+ * The vault doesn't have enough bitcoin security to support this bond purchase
1402
+ **/
1403
+ InsufficientBondSpace: AugmentedError<ApiType>;
1277
1404
  /**
1278
1405
  * An internal error occurred.
1279
1406
  **/
@@ -1362,10 +1489,6 @@ declare module '@polkadot/api-base/types/errors' {
1362
1489
  * The bitcoin script to lock this bitcoin has errors
1363
1490
  **/
1364
1491
  InvalidBitcoinScript: AugmentedError<ApiType>;
1365
- /**
1366
- * Treasury bond sharing plus bonus cannot exceed 100%.
1367
- **/
1368
- InvalidBondSharingTerms: AugmentedError<ApiType>;
1369
1492
  /**
1370
1493
  * An invalid securitization percent was provided for the vault. NOTE: it cannot be
1371
1494
  * decreased (or negative)
@@ -1375,11 +1498,6 @@ declare module '@polkadot/api-base/types/errors' {
1375
1498
  * Funding would result in an overflow of the balance type
1376
1499
  **/
1377
1500
  InvalidVaultAmount: AugmentedError<ApiType>;
1378
- /**
1379
- * Vault names must start with an uppercase ASCII letter and otherwise be ASCII
1380
- * alphanumeric.
1381
- **/
1382
- InvalidVaultName: AugmentedError<ApiType>;
1383
1501
  /**
1384
1502
  * Unable to decode xpubkey
1385
1503
  **/