@arcium-hq/client 0.11.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.cjs +7574 -234
- package/build/index.mjs +7570 -235
- package/build/types/constants.d.ts +5 -0
- package/build/types/constants.d.ts.map +1 -1
- package/build/types/idl/arcium.d.ts +30 -1
- package/build/types/idl/arcium.d.ts.map +1 -1
- package/build/types/idl/arcium_staking.d.ts +112 -0
- package/build/types/idl/arcium_staking.d.ts.map +1 -1
- package/build/types/idl/index.d.ts +12 -2
- package/build/types/idl/index.d.ts.map +1 -1
- package/build/types/onchain.d.ts +7 -0
- package/build/types/onchain.d.ts.map +1 -1
- package/build/types/pda.d.ts +12 -0
- package/build/types/pda.d.ts.map +1 -1
- package/build/types/recoveryPeers.d.ts +1 -1
- package/package.json +1 -1
- package/src/constants.ts +5 -0
- package/src/idl/arcium.json +30 -1
- package/src/idl/arcium.ts +30 -1
- package/src/idl/arcium_staking.json +72 -0
- package/src/idl/arcium_staking.ts +112 -0
- package/src/idl/index.ts +15 -2
- package/src/onchain.ts +27 -1
- package/src/pda.ts +23 -1
- package/src/recoveryPeers.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/idl/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/idl/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD,QAAA,MAAM,UAAU,EAA4F,MAAM,CAAC;AACnH,QAAA,MAAM,kBAAkB,EAAmH,aAAa,CAAC;AAEzJ;;GAEG;AACH,eAAO,MAAM,WAAW,gDAAqB,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,mBAAmB,gDAA6B,CAAC;AAE9D;;GAEG;AACH,YAAY,EAAE,MAAM,IAAI,aAAa,EAAE,CAAC;AAExC;;GAEG;AACH,YAAY,EAAE,aAAa,IAAI,oBAAoB,EAAE,CAAC;AAEtD;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC"}
|
package/build/types/onchain.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import * as anchor from '@anchor-lang/core';
|
|
|
3
3
|
import type { ConfirmOptions, PublicKey } from '@solana/web3.js';
|
|
4
4
|
import { ArciumIdlType } from './idl/index.js';
|
|
5
5
|
import { Arcium } from './idl/arcium.js';
|
|
6
|
+
import { ArciumStaking } from './idl/arcium_staking.js';
|
|
6
7
|
import { ComputationReference } from './utils.js';
|
|
7
8
|
/**
|
|
8
9
|
* Represents a mempool account of any size (tiny, small, medium, or large).
|
|
@@ -140,6 +141,12 @@ export declare function getCompDefAccOffset(circuitName: string): Uint8Array;
|
|
|
140
141
|
* @returns Anchor program instance for Arcium.
|
|
141
142
|
*/
|
|
142
143
|
export declare function getArciumProgram(provider: AnchorProvider): Program<Arcium>;
|
|
144
|
+
/**
|
|
145
|
+
* Return an Anchor program instance for the Arcium staking program.
|
|
146
|
+
* @param provider - Anchor provider to use.
|
|
147
|
+
* @returns Anchor program instance for the Arcium staking program.
|
|
148
|
+
*/
|
|
149
|
+
export declare function getArciumStakingProgram(provider: AnchorProvider): Program<ArciumStaking>;
|
|
143
150
|
/**
|
|
144
151
|
* Initialize an MXE (part 1). Due to Solana's 10KB per-instruction allocation limit,
|
|
145
152
|
* this only partially allocates recovery_cluster_acc.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onchain.d.ts","sourceRoot":"","sources":["../../src/onchain.ts"],"names":[],"mappings":"AAAA,OAAkB,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5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BG;AACH,wBAAsB,YAAY,CAC9B,QAAQ,EAAE,cAAc,EACxB,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,EACnC,YAAY,EAAE,MAAM,CAAC,EAAE,EACvB,qBAAqB,EAAE,MAAM,CAAC,EAAE,EAChC,aAAa,EAAE,MAAM,EAAE,EACvB,SAAS,EAAE,MAAM,CAAC,EAAE,EACpB,YAAY,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,EACpC,cAAc,CAAC,EAAE,cAAc,GAChC,OAAO,CAAC,MAAM,CAAC,CAkCjB;AAED;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACtC,QAAQ,EAAE,cAAc,EACxB,aAAa,EAAE,MAAM,EACrB,iBAAiB,EAAE,MAAM,CAAC,EAAE,EAC5B,cAAc,CAAC,EAAE,cAAc,GAChC,OAAO,CAAC,MAAM,CAAC,CAUjB"}
|
package/build/types/pda.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ import * as anchor from '@anchor-lang/core';
|
|
|
5
5
|
* @returns Arcium program's public key.
|
|
6
6
|
*/
|
|
7
7
|
export declare function getArciumProgramId(): PublicKey;
|
|
8
|
+
/**
|
|
9
|
+
* Return the public key of the deployed Arcium staking program on Solana.
|
|
10
|
+
* @returns Arcium staking program's public key.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getArciumStakingProgramId(): PublicKey;
|
|
8
13
|
/**
|
|
9
14
|
* Derive the computation account address for a given cluster and computation offset.
|
|
10
15
|
* @param clusterOffset - Offset of the cluster this computation will be executed by.
|
|
@@ -71,6 +76,13 @@ export declare function getRecoveryClusterAccAddress(mxeProgramId: PublicKey): P
|
|
|
71
76
|
* @returns Derived MXE recovery account public key.
|
|
72
77
|
*/
|
|
73
78
|
export declare function getMxeRecoveryAccAddress(originalMxeProgramId: PublicKey): PublicKey;
|
|
79
|
+
/**
|
|
80
|
+
* Derive the staking program's MxeRecoveryStakeState PDA for an MXE program.
|
|
81
|
+
* Derived under the staking program, not the Arcium program.
|
|
82
|
+
* @param mxeProgramId - Public key of the MXE program.
|
|
83
|
+
* @returns Derived MxeRecoveryStakeState account public key.
|
|
84
|
+
*/
|
|
85
|
+
export declare function getMxeRecoveryStakeStateAccAddress(mxeProgramId: PublicKey): PublicKey;
|
|
74
86
|
/**
|
|
75
87
|
* Derive the recovery peer account address for a given recovery peer offset.
|
|
76
88
|
* @param peerOffset - Recovery peer offset as a u32 in `[0, 2^32 - 1]`.
|
package/build/types/pda.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pda.d.ts","sourceRoot":"","sources":["../../src/pda.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA6B,MAAM,iBAAiB,CAAC;AACvE,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"pda.d.ts","sourceRoot":"","sources":["../../src/pda.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA6B,MAAM,iBAAiB,CAAC;AACvE,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AA2B5C;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,SAAS,CAE9C;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,SAAS,CAErD;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,GAAG,SAAS,CAEvG;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAErE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAE3E;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,SAAS,CAEhD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,SAAS,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,oBAAo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mxe_part1` recovery-peer bounds before building the instruction.
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
5
|
export declare function assertValidRecoveryPeers(recoveryPeers: readonly number[]): void;
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
|
@@ -53,6 +53,11 @@ export const RECOVERY_CLUSTER_ACC_SEED = 'RecoveryClusterAccount';
|
|
|
53
53
|
* @constant {string}
|
|
54
54
|
*/
|
|
55
55
|
export const MXE_RECOVERY_ACC_SEED = 'MxeRecoveryAccount';
|
|
56
|
+
/**
|
|
57
|
+
* Seed for the staking program's MxeRecoveryStakeState PDA.
|
|
58
|
+
* @constant {string}
|
|
59
|
+
*/
|
|
60
|
+
export const MXE_RECOVERY_STAKE_STATE_SEED = 'MxeRecoveryStakeState';
|
|
56
61
|
/**
|
|
57
62
|
* Seed for ComputationDefinitionRaw PDA.
|
|
58
63
|
* @constant {string}
|
package/src/idl/arcium.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"address": "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ",
|
|
3
3
|
"metadata": {
|
|
4
4
|
"name": "arcium",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.12.0",
|
|
6
6
|
"spec": "0.1.0",
|
|
7
7
|
"description": "The Arcium program"
|
|
8
8
|
},
|
|
@@ -7664,6 +7664,30 @@
|
|
|
7664
7664
|
]
|
|
7665
7665
|
}
|
|
7666
7666
|
},
|
|
7667
|
+
{
|
|
7668
|
+
"name": "cluster_acc",
|
|
7669
|
+
"pda": {
|
|
7670
|
+
"seeds": [
|
|
7671
|
+
{
|
|
7672
|
+
"kind": "const",
|
|
7673
|
+
"value": [
|
|
7674
|
+
67,
|
|
7675
|
+
108,
|
|
7676
|
+
117,
|
|
7677
|
+
115,
|
|
7678
|
+
116,
|
|
7679
|
+
101,
|
|
7680
|
+
114
|
|
7681
|
+
]
|
|
7682
|
+
},
|
|
7683
|
+
{
|
|
7684
|
+
"kind": "account",
|
|
7685
|
+
"path": "mxe.cluster",
|
|
7686
|
+
"account": "MXEAccount"
|
|
7687
|
+
}
|
|
7688
|
+
]
|
|
7689
|
+
}
|
|
7690
|
+
},
|
|
7667
7691
|
{
|
|
7668
7692
|
"name": "comp",
|
|
7669
7693
|
"writable": true,
|
|
@@ -11135,6 +11159,11 @@
|
|
|
11135
11159
|
"code": 6727,
|
|
11136
11160
|
"name": "InsufficientPrimaryStake",
|
|
11137
11161
|
"msg": "Node's primary stake is below the minimum for this cluster's mempool size"
|
|
11162
|
+
},
|
|
11163
|
+
{
|
|
11164
|
+
"code": 6728,
|
|
11165
|
+
"name": "InvalidRecoveryPeersArgument",
|
|
11166
|
+
"msg": "Invalid recovery peers argument"
|
|
11138
11167
|
}
|
|
11139
11168
|
],
|
|
11140
11169
|
"types": [
|
package/src/idl/arcium.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type Arcium = {
|
|
|
8
8
|
"address": "Arcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQ",
|
|
9
9
|
"metadata": {
|
|
10
10
|
"name": "arcium",
|
|
11
|
-
"version": "0.
|
|
11
|
+
"version": "0.12.0",
|
|
12
12
|
"spec": "0.1.0",
|
|
13
13
|
"description": "The Arcium program"
|
|
14
14
|
},
|
|
@@ -7670,6 +7670,30 @@ export type Arcium = {
|
|
|
7670
7670
|
]
|
|
7671
7671
|
}
|
|
7672
7672
|
},
|
|
7673
|
+
{
|
|
7674
|
+
"name": "clusterAcc",
|
|
7675
|
+
"pda": {
|
|
7676
|
+
"seeds": [
|
|
7677
|
+
{
|
|
7678
|
+
"kind": "const",
|
|
7679
|
+
"value": [
|
|
7680
|
+
67,
|
|
7681
|
+
108,
|
|
7682
|
+
117,
|
|
7683
|
+
115,
|
|
7684
|
+
116,
|
|
7685
|
+
101,
|
|
7686
|
+
114
|
|
7687
|
+
]
|
|
7688
|
+
},
|
|
7689
|
+
{
|
|
7690
|
+
"kind": "account",
|
|
7691
|
+
"path": "mxe.cluster",
|
|
7692
|
+
"account": "mxeAccount"
|
|
7693
|
+
}
|
|
7694
|
+
]
|
|
7695
|
+
}
|
|
7696
|
+
},
|
|
7673
7697
|
{
|
|
7674
7698
|
"name": "comp",
|
|
7675
7699
|
"writable": true,
|
|
@@ -11141,6 +11165,11 @@ export type Arcium = {
|
|
|
11141
11165
|
"code": 6727,
|
|
11142
11166
|
"name": "insufficientPrimaryStake",
|
|
11143
11167
|
"msg": "Node's primary stake is below the minimum for this cluster's mempool size"
|
|
11168
|
+
},
|
|
11169
|
+
{
|
|
11170
|
+
"code": 6728,
|
|
11171
|
+
"name": "invalidRecoveryPeersArgument",
|
|
11172
|
+
"msg": "Invalid recovery peers argument"
|
|
11144
11173
|
}
|
|
11145
11174
|
],
|
|
11146
11175
|
"types": [
|
|
@@ -5340,6 +5340,20 @@
|
|
|
5340
5340
|
]
|
|
5341
5341
|
}
|
|
5342
5342
|
],
|
|
5343
|
+
"events": [
|
|
5344
|
+
{
|
|
5345
|
+
"name": "EmptyRewardClaim",
|
|
5346
|
+
"discriminator": [
|
|
5347
|
+
0
|
|
5348
|
+
]
|
|
5349
|
+
},
|
|
5350
|
+
{
|
|
5351
|
+
"name": "RewardClaimInserted",
|
|
5352
|
+
"discriminator": [
|
|
5353
|
+
1
|
|
5354
|
+
]
|
|
5355
|
+
}
|
|
5356
|
+
],
|
|
5343
5357
|
"errors": [
|
|
5344
5358
|
{
|
|
5345
5359
|
"code": 6000,
|
|
@@ -6063,6 +6077,12 @@
|
|
|
6063
6077
|
]
|
|
6064
6078
|
}
|
|
6065
6079
|
},
|
|
6080
|
+
{
|
|
6081
|
+
"name": "EmptyRewardClaim",
|
|
6082
|
+
"type": {
|
|
6083
|
+
"kind": "struct"
|
|
6084
|
+
}
|
|
6085
|
+
},
|
|
6066
6086
|
{
|
|
6067
6087
|
"name": "Epoch",
|
|
6068
6088
|
"docs": [
|
|
@@ -6963,6 +6983,38 @@
|
|
|
6963
6983
|
]
|
|
6964
6984
|
}
|
|
6965
6985
|
},
|
|
6986
|
+
{
|
|
6987
|
+
"name": "RewardClaimInserted",
|
|
6988
|
+
"type": {
|
|
6989
|
+
"kind": "struct",
|
|
6990
|
+
"fields": [
|
|
6991
|
+
{
|
|
6992
|
+
"name": "claim",
|
|
6993
|
+
"type": {
|
|
6994
|
+
"defined": {
|
|
6995
|
+
"name": "RewardClaim"
|
|
6996
|
+
}
|
|
6997
|
+
}
|
|
6998
|
+
},
|
|
6999
|
+
{
|
|
7000
|
+
"name": "root",
|
|
7001
|
+
"type": {
|
|
7002
|
+
"defined": {
|
|
7003
|
+
"name": "Hash"
|
|
7004
|
+
}
|
|
7005
|
+
}
|
|
7006
|
+
},
|
|
7007
|
+
{
|
|
7008
|
+
"name": "current_epoch",
|
|
7009
|
+
"type": {
|
|
7010
|
+
"defined": {
|
|
7011
|
+
"name": "Epoch"
|
|
7012
|
+
}
|
|
7013
|
+
}
|
|
7014
|
+
}
|
|
7015
|
+
]
|
|
7016
|
+
}
|
|
7017
|
+
},
|
|
6966
7018
|
{
|
|
6967
7019
|
"name": "SetUnset",
|
|
6968
7020
|
"docs": [
|
|
@@ -7156,5 +7208,25 @@
|
|
|
7156
7208
|
]
|
|
7157
7209
|
}
|
|
7158
7210
|
}
|
|
7211
|
+
],
|
|
7212
|
+
"constants": [
|
|
7213
|
+
{
|
|
7214
|
+
"name": "REWARDS_MT_HEIGHT_U32",
|
|
7215
|
+
"docs": [
|
|
7216
|
+
"IDL-exported mirror of [`REWARDS_MT_HEIGHT`]. Anchor's `#[constant]` macro",
|
|
7217
|
+
"doesn't support `usize` (its type isn't platform-stable), so off-chain",
|
|
7218
|
+
"consumers reading via the IDL import this `u32` and cast to `usize`."
|
|
7219
|
+
],
|
|
7220
|
+
"type": "u32",
|
|
7221
|
+
"value": "15"
|
|
7222
|
+
},
|
|
7223
|
+
{
|
|
7224
|
+
"name": "REWARD_BATCHING_RATE",
|
|
7225
|
+
"docs": [
|
|
7226
|
+
"How many rewards we batch together in a single MerkleTree leaf."
|
|
7227
|
+
],
|
|
7228
|
+
"type": "u8",
|
|
7229
|
+
"value": "1"
|
|
7230
|
+
}
|
|
7159
7231
|
]
|
|
7160
7232
|
}
|
|
@@ -4588,6 +4588,26 @@ export type ArciumStaking = {
|
|
|
4588
4588
|
{
|
|
4589
4589
|
"name": "tokenProgram",
|
|
4590
4590
|
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
4591
|
+
},
|
|
4592
|
+
{
|
|
4593
|
+
"name": "arxNode",
|
|
4594
|
+
"docs": [
|
|
4595
|
+
"The `ArxNode` this stake is bound to. Required (and validated against the stored binding)",
|
|
4596
|
+
"on withdrawals when the stake's `binding` is `Node(..)`, so we can read the node's",
|
|
4597
|
+
"cluster and enforce that cluster's minimum primary stake. May be omitted for deposits,",
|
|
4598
|
+
"unbound stakes, or recovery-peer bindings. The `Account` wrapper enforces it's owned by",
|
|
4599
|
+
"the arcium program."
|
|
4600
|
+
],
|
|
4601
|
+
"optional": true
|
|
4602
|
+
},
|
|
4603
|
+
{
|
|
4604
|
+
"name": "mempool",
|
|
4605
|
+
"docs": [
|
|
4606
|
+
"The mempool account of the cluster the bound node is seated in (or proposed to). Required",
|
|
4607
|
+
"alongside `arx_node` when that node belongs to a cluster. Only its discriminator (the",
|
|
4608
|
+
"mempool size) is read."
|
|
4609
|
+
],
|
|
4610
|
+
"optional": true
|
|
4591
4611
|
}
|
|
4592
4612
|
],
|
|
4593
4613
|
"args": [
|
|
@@ -5326,6 +5346,20 @@ export type ArciumStaking = {
|
|
|
5326
5346
|
]
|
|
5327
5347
|
}
|
|
5328
5348
|
],
|
|
5349
|
+
"events": [
|
|
5350
|
+
{
|
|
5351
|
+
"name": "emptyRewardClaim",
|
|
5352
|
+
"discriminator": [
|
|
5353
|
+
0
|
|
5354
|
+
]
|
|
5355
|
+
},
|
|
5356
|
+
{
|
|
5357
|
+
"name": "rewardClaimInserted",
|
|
5358
|
+
"discriminator": [
|
|
5359
|
+
1
|
|
5360
|
+
]
|
|
5361
|
+
}
|
|
5362
|
+
],
|
|
5329
5363
|
"errors": [
|
|
5330
5364
|
{
|
|
5331
5365
|
"code": 6000,
|
|
@@ -5477,6 +5511,26 @@ export type ArciumStaking = {
|
|
|
5477
5511
|
"code": 6034,
|
|
5478
5512
|
"name": "delegatedRemovalNotMatured",
|
|
5479
5513
|
"msg": "Delegated stake removal has not matured on the primary yet (finalize the primary first)"
|
|
5514
|
+
},
|
|
5515
|
+
{
|
|
5516
|
+
"code": 6035,
|
|
5517
|
+
"name": "insufficientPrimaryStake",
|
|
5518
|
+
"msg": "Resulting primary stake is below the minimum for the bound node's cluster mempool size"
|
|
5519
|
+
},
|
|
5520
|
+
{
|
|
5521
|
+
"code": 6036,
|
|
5522
|
+
"name": "missingNodeAccount",
|
|
5523
|
+
"msg": "Stake is bound to a node; the bound ArxNode account must be provided"
|
|
5524
|
+
},
|
|
5525
|
+
{
|
|
5526
|
+
"code": 6037,
|
|
5527
|
+
"name": "missingMempoolAccount",
|
|
5528
|
+
"msg": "Bound node is seated in a cluster; the cluster's mempool account must be provided"
|
|
5529
|
+
},
|
|
5530
|
+
{
|
|
5531
|
+
"code": 6038,
|
|
5532
|
+
"name": "invalidMempool",
|
|
5533
|
+
"msg": "Provided mempool account does not match the bound node's cluster"
|
|
5480
5534
|
}
|
|
5481
5535
|
],
|
|
5482
5536
|
"types": [
|
|
@@ -6029,6 +6083,12 @@ export type ArciumStaking = {
|
|
|
6029
6083
|
]
|
|
6030
6084
|
}
|
|
6031
6085
|
},
|
|
6086
|
+
{
|
|
6087
|
+
"name": "emptyRewardClaim",
|
|
6088
|
+
"type": {
|
|
6089
|
+
"kind": "struct"
|
|
6090
|
+
}
|
|
6091
|
+
},
|
|
6032
6092
|
{
|
|
6033
6093
|
"name": "epoch",
|
|
6034
6094
|
"docs": [
|
|
@@ -6929,6 +6989,38 @@ export type ArciumStaking = {
|
|
|
6929
6989
|
]
|
|
6930
6990
|
}
|
|
6931
6991
|
},
|
|
6992
|
+
{
|
|
6993
|
+
"name": "rewardClaimInserted",
|
|
6994
|
+
"type": {
|
|
6995
|
+
"kind": "struct",
|
|
6996
|
+
"fields": [
|
|
6997
|
+
{
|
|
6998
|
+
"name": "claim",
|
|
6999
|
+
"type": {
|
|
7000
|
+
"defined": {
|
|
7001
|
+
"name": "rewardClaim"
|
|
7002
|
+
}
|
|
7003
|
+
}
|
|
7004
|
+
},
|
|
7005
|
+
{
|
|
7006
|
+
"name": "root",
|
|
7007
|
+
"type": {
|
|
7008
|
+
"defined": {
|
|
7009
|
+
"name": "hash"
|
|
7010
|
+
}
|
|
7011
|
+
}
|
|
7012
|
+
},
|
|
7013
|
+
{
|
|
7014
|
+
"name": "currentEpoch",
|
|
7015
|
+
"type": {
|
|
7016
|
+
"defined": {
|
|
7017
|
+
"name": "epoch"
|
|
7018
|
+
}
|
|
7019
|
+
}
|
|
7020
|
+
}
|
|
7021
|
+
]
|
|
7022
|
+
}
|
|
7023
|
+
},
|
|
6932
7024
|
{
|
|
6933
7025
|
"name": "setUnset",
|
|
6934
7026
|
"docs": [
|
|
@@ -7122,5 +7214,25 @@ export type ArciumStaking = {
|
|
|
7122
7214
|
]
|
|
7123
7215
|
}
|
|
7124
7216
|
}
|
|
7217
|
+
],
|
|
7218
|
+
"constants": [
|
|
7219
|
+
{
|
|
7220
|
+
"name": "rewardsMtHeightU32",
|
|
7221
|
+
"docs": [
|
|
7222
|
+
"IDL-exported mirror of [`REWARDS_MT_HEIGHT`]. Anchor's `#[constant]` macro",
|
|
7223
|
+
"doesn't support `usize` (its type isn't platform-stable), so off-chain",
|
|
7224
|
+
"consumers reading via the IDL import this `u32` and cast to `usize`."
|
|
7225
|
+
],
|
|
7226
|
+
"type": "u32",
|
|
7227
|
+
"value": "15"
|
|
7228
|
+
},
|
|
7229
|
+
{
|
|
7230
|
+
"name": "rewardBatchingRate",
|
|
7231
|
+
"docs": [
|
|
7232
|
+
"How many rewards we batch together in a single MerkleTree leaf."
|
|
7233
|
+
],
|
|
7234
|
+
"type": "u8",
|
|
7235
|
+
"value": "1"
|
|
7236
|
+
}
|
|
7125
7237
|
]
|
|
7126
7238
|
};
|
package/src/idl/index.ts
CHANGED
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
import { Arcium } from './arcium.js';
|
|
2
2
|
import * as ARCIUM_IDL_MODULE from './arcium.json' with { type: 'json' };
|
|
3
|
+
import { ArciumStaking } from './arcium_staking.js';
|
|
4
|
+
import * as ARCIUM_STAKING_IDL_MODULE from './arcium_staking.json' with { type: 'json' };
|
|
3
5
|
|
|
4
6
|
// Handle both ESM (ts-node wraps as {default: ...}) and bundled (direct) imports
|
|
5
7
|
const ARCIUM_IDL = ((ARCIUM_IDL_MODULE as { default?: Arcium }).default ?? ARCIUM_IDL_MODULE) as unknown as Arcium;
|
|
8
|
+
const ARCIUM_STAKING_IDL = ((ARCIUM_STAKING_IDL_MODULE as { default?: ArciumStaking }).default ?? ARCIUM_STAKING_IDL_MODULE) as unknown as ArciumStaking;
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* The deployed address of the Arcium program, as specified in the IDL.
|
|
9
12
|
*/
|
|
10
13
|
export const ARCIUM_ADDR = ARCIUM_IDL.address;
|
|
11
14
|
|
|
15
|
+
/**
|
|
16
|
+
* The deployed address of the Arcium staking program, as specified in the IDL.
|
|
17
|
+
*/
|
|
18
|
+
export const ARCIUM_STAKING_ADDR = ARCIUM_STAKING_IDL.address;
|
|
19
|
+
|
|
12
20
|
/**
|
|
13
21
|
* The Anchor-generated IDL type for the Arcium program.
|
|
14
22
|
*/
|
|
15
23
|
export type { Arcium as ArciumIdlType };
|
|
16
24
|
|
|
17
25
|
/**
|
|
18
|
-
* The Anchor-generated IDL
|
|
26
|
+
* The Anchor-generated IDL type for the Arcium staking program.
|
|
27
|
+
*/
|
|
28
|
+
export type { ArciumStaking as ArciumStakingIdlType };
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The Anchor-generated IDL JSON objects for the Arcium programs.
|
|
19
32
|
*/
|
|
20
|
-
export { ARCIUM_IDL };
|
|
33
|
+
export { ARCIUM_IDL, ARCIUM_STAKING_IDL };
|
package/src/onchain.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import anchorPkg, { Program, AnchorProvider } from '@anchor-lang/core';
|
|
2
2
|
import * as anchor from '@anchor-lang/core';
|
|
3
3
|
import type { AccountInfo, ConfirmOptions, PublicKey } from '@solana/web3.js';
|
|
4
|
-
import { ARCIUM_IDL, ArciumIdlType } from './idl/index.js';
|
|
4
|
+
import { ARCIUM_IDL, ARCIUM_STAKING_IDL, ArciumIdlType } from './idl/index.js';
|
|
5
5
|
import { sha256 } from './cryptography/cryptography.js';
|
|
6
6
|
import { Arcium } from './idl/arcium.js';
|
|
7
|
+
import { ArciumStaking } from './idl/arcium_staking.js';
|
|
7
8
|
import {
|
|
8
9
|
COMP_DEF_OFFSET_SIZE,
|
|
9
10
|
DEFAULT_UPLOAD_TX_BATCH_SIZE,
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
getComputationAccAddress,
|
|
19
20
|
getCompDefAccAddress,
|
|
20
21
|
getFeePoolAccAddress,
|
|
22
|
+
getMxeRecoveryStakeStateAccAddress,
|
|
21
23
|
getRawCircuitAccAddress,
|
|
22
24
|
getLookupTableAddress,
|
|
23
25
|
} from './pda.js';
|
|
@@ -607,6 +609,15 @@ export function getArciumProgram(provider: AnchorProvider): Program<Arcium> {
|
|
|
607
609
|
return new Program(ARCIUM_IDL as unknown as Arcium, provider);
|
|
608
610
|
}
|
|
609
611
|
|
|
612
|
+
/**
|
|
613
|
+
* Return an Anchor program instance for the Arcium staking program.
|
|
614
|
+
* @param provider - Anchor provider to use.
|
|
615
|
+
* @returns Anchor program instance for the Arcium staking program.
|
|
616
|
+
*/
|
|
617
|
+
export function getArciumStakingProgram(provider: AnchorProvider): Program<ArciumStaking> {
|
|
618
|
+
return new Program(ARCIUM_STAKING_IDL as unknown as ArciumStaking, provider);
|
|
619
|
+
}
|
|
620
|
+
|
|
610
621
|
/**
|
|
611
622
|
* Return the public key and offset for a computation definition account, given the circuit name and MXE program ID.
|
|
612
623
|
* @param circuitName - Name of the circuit.
|
|
@@ -695,6 +706,21 @@ export async function initMxePart2(
|
|
|
695
706
|
addressLookupTable: getLookupTableAddress(mxeProgramId, lutOffset),
|
|
696
707
|
})
|
|
697
708
|
.transaction();
|
|
709
|
+
|
|
710
|
+
// The Arcium program requires the staking program's initMxeRecoveryStakeState to immediately
|
|
711
|
+
// follow initMxePart2 in the same transaction (enforced by instruction introspection), so the
|
|
712
|
+
// MXE always ships with the recovery-stake state its fee-drain path depends on.
|
|
713
|
+
const recoveryStakeStateIx = await getArciumStakingProgram(provider)
|
|
714
|
+
.methods.initMxeRecoveryStakeState(mxeProgramId)
|
|
715
|
+
.accountsPartial({
|
|
716
|
+
payer: provider.publicKey,
|
|
717
|
+
mxeRecoveryStakeState: getMxeRecoveryStakeStateAccAddress(mxeProgramId),
|
|
718
|
+
instructionsSysvar: anchor.web3.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
719
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
720
|
+
})
|
|
721
|
+
.instruction();
|
|
722
|
+
tx.add(recoveryStakeStateIx);
|
|
723
|
+
|
|
698
724
|
return signAndSendWithBlockhash(provider, tx, await provider.connection.getLatestBlockhash({ commitment: confirmOptions?.commitment || 'confirmed' }), confirmOptions);
|
|
699
725
|
}
|
|
700
726
|
|
package/src/pda.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
MEMPOOL_ACC_SEED,
|
|
13
13
|
MXE_ACCOUNT_SEED,
|
|
14
14
|
MXE_RECOVERY_ACC_SEED,
|
|
15
|
+
MXE_RECOVERY_STAKE_STATE_SEED,
|
|
15
16
|
OPERATOR_ACC_SEED,
|
|
16
17
|
OFFSET_BUFFER_SIZE,
|
|
17
18
|
POOL_ACC_SEED,
|
|
@@ -19,7 +20,7 @@ import {
|
|
|
19
20
|
RECOVERY_CLUSTER_ACC_SEED,
|
|
20
21
|
RECOVERY_PEER_ACC_SEED,
|
|
21
22
|
} from './constants.js';
|
|
22
|
-
import { ARCIUM_ADDR } from './idl/index.js';
|
|
23
|
+
import { ARCIUM_ADDR, ARCIUM_STAKING_ADDR } from './idl/index.js';
|
|
23
24
|
|
|
24
25
|
const U64_SEED_SIZE = 8;
|
|
25
26
|
const MAX_U8 = 0xff;
|
|
@@ -33,6 +34,14 @@ export function getArciumProgramId(): PublicKey {
|
|
|
33
34
|
return new anchor.web3.PublicKey(ARCIUM_ADDR);
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Return the public key of the deployed Arcium staking program on Solana.
|
|
39
|
+
* @returns Arcium staking program's public key.
|
|
40
|
+
*/
|
|
41
|
+
export function getArciumStakingProgramId(): PublicKey {
|
|
42
|
+
return new anchor.web3.PublicKey(ARCIUM_STAKING_ADDR);
|
|
43
|
+
}
|
|
44
|
+
|
|
36
45
|
/**
|
|
37
46
|
* Derive the computation account address for a given cluster and computation offset.
|
|
38
47
|
* @param clusterOffset - Offset of the cluster this computation will be executed by.
|
|
@@ -132,6 +141,19 @@ export function getMxeRecoveryAccAddress(originalMxeProgramId: PublicKey): Publi
|
|
|
132
141
|
return findArciumPda([stringSeed(MXE_RECOVERY_ACC_SEED), pubkeySeed(originalMxeProgramId)]);
|
|
133
142
|
}
|
|
134
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Derive the staking program's MxeRecoveryStakeState PDA for an MXE program.
|
|
146
|
+
* Derived under the staking program, not the Arcium program.
|
|
147
|
+
* @param mxeProgramId - Public key of the MXE program.
|
|
148
|
+
* @returns Derived MxeRecoveryStakeState account public key.
|
|
149
|
+
*/
|
|
150
|
+
export function getMxeRecoveryStakeStateAccAddress(mxeProgramId: PublicKey): PublicKey {
|
|
151
|
+
return findPda(getArciumStakingProgramId(), [
|
|
152
|
+
stringSeed(MXE_RECOVERY_STAKE_STATE_SEED),
|
|
153
|
+
pubkeySeed(mxeProgramId),
|
|
154
|
+
]);
|
|
155
|
+
}
|
|
156
|
+
|
|
135
157
|
/**
|
|
136
158
|
* Derive the recovery peer account address for a given recovery peer offset.
|
|
137
159
|
* @param peerOffset - Recovery peer offset as a u32 in `[0, 2^32 - 1]`.
|
package/src/recoveryPeers.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { MAX_RECOVERY_PEERS, MIN_RECOVERY_PEERS } from './constants.js';
|
|
|
3
3
|
const MAX_U32 = 0xffffffff;
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Mirrors the on-chain `
|
|
6
|
+
* Mirrors the on-chain `init_mxe_part1` recovery-peer bounds before building the instruction.
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
9
|
export function assertValidRecoveryPeers(recoveryPeers: readonly number[]): void {
|