genlayer-js 0.18.7 → 0.18.8
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/CHANGELOG.md +2 -0
- package/dist/chains/index.cjs +2 -2
- package/dist/chains/index.js +1 -1
- package/dist/{chunk-RW6PLN5W.js → chunk-V4ZFI4GV.js} +61 -0
- package/dist/{chunk-I23SLL2A.cjs → chunk-WTAFQOXC.cjs} +61 -0
- package/dist/{index-9QkkDjYm.d.ts → index-BNui_XYa.d.ts} +63 -0
- package/dist/{index-DM646L5c.d.cts → index-C3KT8eu_.d.cts} +63 -0
- package/dist/index.cjs +31 -31
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/abi/staking.ts +61 -0
package/CHANGELOG.md
CHANGED
package/dist/chains/index.cjs
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkWTAFQOXCcjs = require('../chunk-WTAFQOXC.cjs');
|
|
6
6
|
require('../chunk-75ZPJI57.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.localnet =
|
|
11
|
+
exports.localnet = _chunkWTAFQOXCcjs.localnet; exports.studionet = _chunkWTAFQOXCcjs.studionet; exports.testnetAsimov = _chunkWTAFQOXCcjs.testnetAsimov;
|
package/dist/chains/index.js
CHANGED
|
@@ -8109,6 +8109,67 @@ var VALIDATOR_WALLET_ABI = [
|
|
|
8109
8109
|
{ name: "extraCid", type: "bytes" }
|
|
8110
8110
|
],
|
|
8111
8111
|
outputs: []
|
|
8112
|
+
},
|
|
8113
|
+
// Staking functions (forwarded to staking contract)
|
|
8114
|
+
{
|
|
8115
|
+
name: "validatorDeposit",
|
|
8116
|
+
type: "function",
|
|
8117
|
+
stateMutability: "payable",
|
|
8118
|
+
inputs: [],
|
|
8119
|
+
outputs: []
|
|
8120
|
+
},
|
|
8121
|
+
{
|
|
8122
|
+
name: "validatorExit",
|
|
8123
|
+
type: "function",
|
|
8124
|
+
stateMutability: "nonpayable",
|
|
8125
|
+
inputs: [{ name: "_shares", type: "uint256" }],
|
|
8126
|
+
outputs: []
|
|
8127
|
+
},
|
|
8128
|
+
{
|
|
8129
|
+
name: "validatorClaim",
|
|
8130
|
+
type: "function",
|
|
8131
|
+
stateMutability: "nonpayable",
|
|
8132
|
+
inputs: [],
|
|
8133
|
+
outputs: []
|
|
8134
|
+
},
|
|
8135
|
+
// Two-step operator transfer
|
|
8136
|
+
{
|
|
8137
|
+
name: "initiateOperatorTransfer",
|
|
8138
|
+
type: "function",
|
|
8139
|
+
stateMutability: "nonpayable",
|
|
8140
|
+
inputs: [{ name: "_newOperator", type: "address" }],
|
|
8141
|
+
outputs: []
|
|
8142
|
+
},
|
|
8143
|
+
{
|
|
8144
|
+
name: "completeOperatorTransfer",
|
|
8145
|
+
type: "function",
|
|
8146
|
+
stateMutability: "nonpayable",
|
|
8147
|
+
inputs: [],
|
|
8148
|
+
outputs: []
|
|
8149
|
+
},
|
|
8150
|
+
{
|
|
8151
|
+
name: "cancelOperatorTransfer",
|
|
8152
|
+
type: "function",
|
|
8153
|
+
stateMutability: "nonpayable",
|
|
8154
|
+
inputs: [],
|
|
8155
|
+
outputs: []
|
|
8156
|
+
},
|
|
8157
|
+
{
|
|
8158
|
+
name: "getPendingOperator",
|
|
8159
|
+
type: "function",
|
|
8160
|
+
stateMutability: "view",
|
|
8161
|
+
inputs: [],
|
|
8162
|
+
outputs: [
|
|
8163
|
+
{ name: "", type: "address" },
|
|
8164
|
+
{ name: "", type: "uint256" }
|
|
8165
|
+
]
|
|
8166
|
+
},
|
|
8167
|
+
{
|
|
8168
|
+
name: "getOperator",
|
|
8169
|
+
type: "function",
|
|
8170
|
+
stateMutability: "view",
|
|
8171
|
+
inputs: [],
|
|
8172
|
+
outputs: [{ name: "", type: "address" }]
|
|
8112
8173
|
}
|
|
8113
8174
|
];
|
|
8114
8175
|
var STAKING_ABI = [
|
|
@@ -8109,6 +8109,67 @@ var VALIDATOR_WALLET_ABI = [
|
|
|
8109
8109
|
{ name: "extraCid", type: "bytes" }
|
|
8110
8110
|
],
|
|
8111
8111
|
outputs: []
|
|
8112
|
+
},
|
|
8113
|
+
// Staking functions (forwarded to staking contract)
|
|
8114
|
+
{
|
|
8115
|
+
name: "validatorDeposit",
|
|
8116
|
+
type: "function",
|
|
8117
|
+
stateMutability: "payable",
|
|
8118
|
+
inputs: [],
|
|
8119
|
+
outputs: []
|
|
8120
|
+
},
|
|
8121
|
+
{
|
|
8122
|
+
name: "validatorExit",
|
|
8123
|
+
type: "function",
|
|
8124
|
+
stateMutability: "nonpayable",
|
|
8125
|
+
inputs: [{ name: "_shares", type: "uint256" }],
|
|
8126
|
+
outputs: []
|
|
8127
|
+
},
|
|
8128
|
+
{
|
|
8129
|
+
name: "validatorClaim",
|
|
8130
|
+
type: "function",
|
|
8131
|
+
stateMutability: "nonpayable",
|
|
8132
|
+
inputs: [],
|
|
8133
|
+
outputs: []
|
|
8134
|
+
},
|
|
8135
|
+
// Two-step operator transfer
|
|
8136
|
+
{
|
|
8137
|
+
name: "initiateOperatorTransfer",
|
|
8138
|
+
type: "function",
|
|
8139
|
+
stateMutability: "nonpayable",
|
|
8140
|
+
inputs: [{ name: "_newOperator", type: "address" }],
|
|
8141
|
+
outputs: []
|
|
8142
|
+
},
|
|
8143
|
+
{
|
|
8144
|
+
name: "completeOperatorTransfer",
|
|
8145
|
+
type: "function",
|
|
8146
|
+
stateMutability: "nonpayable",
|
|
8147
|
+
inputs: [],
|
|
8148
|
+
outputs: []
|
|
8149
|
+
},
|
|
8150
|
+
{
|
|
8151
|
+
name: "cancelOperatorTransfer",
|
|
8152
|
+
type: "function",
|
|
8153
|
+
stateMutability: "nonpayable",
|
|
8154
|
+
inputs: [],
|
|
8155
|
+
outputs: []
|
|
8156
|
+
},
|
|
8157
|
+
{
|
|
8158
|
+
name: "getPendingOperator",
|
|
8159
|
+
type: "function",
|
|
8160
|
+
stateMutability: "view",
|
|
8161
|
+
inputs: [],
|
|
8162
|
+
outputs: [
|
|
8163
|
+
{ name: "", type: "address" },
|
|
8164
|
+
{ name: "", type: "uint256" }
|
|
8165
|
+
]
|
|
8166
|
+
},
|
|
8167
|
+
{
|
|
8168
|
+
name: "getOperator",
|
|
8169
|
+
type: "function",
|
|
8170
|
+
stateMutability: "view",
|
|
8171
|
+
inputs: [],
|
|
8172
|
+
outputs: [{ name: "", type: "address" }]
|
|
8112
8173
|
}
|
|
8113
8174
|
];
|
|
8114
8175
|
var STAKING_ABI = [
|
|
@@ -405,6 +405,69 @@ declare const VALIDATOR_WALLET_ABI: readonly [{
|
|
|
405
405
|
readonly type: "bytes";
|
|
406
406
|
}];
|
|
407
407
|
readonly outputs: readonly [];
|
|
408
|
+
}, {
|
|
409
|
+
readonly name: "validatorDeposit";
|
|
410
|
+
readonly type: "function";
|
|
411
|
+
readonly stateMutability: "payable";
|
|
412
|
+
readonly inputs: readonly [];
|
|
413
|
+
readonly outputs: readonly [];
|
|
414
|
+
}, {
|
|
415
|
+
readonly name: "validatorExit";
|
|
416
|
+
readonly type: "function";
|
|
417
|
+
readonly stateMutability: "nonpayable";
|
|
418
|
+
readonly inputs: readonly [{
|
|
419
|
+
readonly name: "_shares";
|
|
420
|
+
readonly type: "uint256";
|
|
421
|
+
}];
|
|
422
|
+
readonly outputs: readonly [];
|
|
423
|
+
}, {
|
|
424
|
+
readonly name: "validatorClaim";
|
|
425
|
+
readonly type: "function";
|
|
426
|
+
readonly stateMutability: "nonpayable";
|
|
427
|
+
readonly inputs: readonly [];
|
|
428
|
+
readonly outputs: readonly [];
|
|
429
|
+
}, {
|
|
430
|
+
readonly name: "initiateOperatorTransfer";
|
|
431
|
+
readonly type: "function";
|
|
432
|
+
readonly stateMutability: "nonpayable";
|
|
433
|
+
readonly inputs: readonly [{
|
|
434
|
+
readonly name: "_newOperator";
|
|
435
|
+
readonly type: "address";
|
|
436
|
+
}];
|
|
437
|
+
readonly outputs: readonly [];
|
|
438
|
+
}, {
|
|
439
|
+
readonly name: "completeOperatorTransfer";
|
|
440
|
+
readonly type: "function";
|
|
441
|
+
readonly stateMutability: "nonpayable";
|
|
442
|
+
readonly inputs: readonly [];
|
|
443
|
+
readonly outputs: readonly [];
|
|
444
|
+
}, {
|
|
445
|
+
readonly name: "cancelOperatorTransfer";
|
|
446
|
+
readonly type: "function";
|
|
447
|
+
readonly stateMutability: "nonpayable";
|
|
448
|
+
readonly inputs: readonly [];
|
|
449
|
+
readonly outputs: readonly [];
|
|
450
|
+
}, {
|
|
451
|
+
readonly name: "getPendingOperator";
|
|
452
|
+
readonly type: "function";
|
|
453
|
+
readonly stateMutability: "view";
|
|
454
|
+
readonly inputs: readonly [];
|
|
455
|
+
readonly outputs: readonly [{
|
|
456
|
+
readonly name: "";
|
|
457
|
+
readonly type: "address";
|
|
458
|
+
}, {
|
|
459
|
+
readonly name: "";
|
|
460
|
+
readonly type: "uint256";
|
|
461
|
+
}];
|
|
462
|
+
}, {
|
|
463
|
+
readonly name: "getOperator";
|
|
464
|
+
readonly type: "function";
|
|
465
|
+
readonly stateMutability: "view";
|
|
466
|
+
readonly inputs: readonly [];
|
|
467
|
+
readonly outputs: readonly [{
|
|
468
|
+
readonly name: "";
|
|
469
|
+
readonly type: "address";
|
|
470
|
+
}];
|
|
408
471
|
}];
|
|
409
472
|
declare const STAKING_ABI: readonly [{
|
|
410
473
|
readonly name: "OnlyGEN";
|
|
@@ -405,6 +405,69 @@ declare const VALIDATOR_WALLET_ABI: readonly [{
|
|
|
405
405
|
readonly type: "bytes";
|
|
406
406
|
}];
|
|
407
407
|
readonly outputs: readonly [];
|
|
408
|
+
}, {
|
|
409
|
+
readonly name: "validatorDeposit";
|
|
410
|
+
readonly type: "function";
|
|
411
|
+
readonly stateMutability: "payable";
|
|
412
|
+
readonly inputs: readonly [];
|
|
413
|
+
readonly outputs: readonly [];
|
|
414
|
+
}, {
|
|
415
|
+
readonly name: "validatorExit";
|
|
416
|
+
readonly type: "function";
|
|
417
|
+
readonly stateMutability: "nonpayable";
|
|
418
|
+
readonly inputs: readonly [{
|
|
419
|
+
readonly name: "_shares";
|
|
420
|
+
readonly type: "uint256";
|
|
421
|
+
}];
|
|
422
|
+
readonly outputs: readonly [];
|
|
423
|
+
}, {
|
|
424
|
+
readonly name: "validatorClaim";
|
|
425
|
+
readonly type: "function";
|
|
426
|
+
readonly stateMutability: "nonpayable";
|
|
427
|
+
readonly inputs: readonly [];
|
|
428
|
+
readonly outputs: readonly [];
|
|
429
|
+
}, {
|
|
430
|
+
readonly name: "initiateOperatorTransfer";
|
|
431
|
+
readonly type: "function";
|
|
432
|
+
readonly stateMutability: "nonpayable";
|
|
433
|
+
readonly inputs: readonly [{
|
|
434
|
+
readonly name: "_newOperator";
|
|
435
|
+
readonly type: "address";
|
|
436
|
+
}];
|
|
437
|
+
readonly outputs: readonly [];
|
|
438
|
+
}, {
|
|
439
|
+
readonly name: "completeOperatorTransfer";
|
|
440
|
+
readonly type: "function";
|
|
441
|
+
readonly stateMutability: "nonpayable";
|
|
442
|
+
readonly inputs: readonly [];
|
|
443
|
+
readonly outputs: readonly [];
|
|
444
|
+
}, {
|
|
445
|
+
readonly name: "cancelOperatorTransfer";
|
|
446
|
+
readonly type: "function";
|
|
447
|
+
readonly stateMutability: "nonpayable";
|
|
448
|
+
readonly inputs: readonly [];
|
|
449
|
+
readonly outputs: readonly [];
|
|
450
|
+
}, {
|
|
451
|
+
readonly name: "getPendingOperator";
|
|
452
|
+
readonly type: "function";
|
|
453
|
+
readonly stateMutability: "view";
|
|
454
|
+
readonly inputs: readonly [];
|
|
455
|
+
readonly outputs: readonly [{
|
|
456
|
+
readonly name: "";
|
|
457
|
+
readonly type: "address";
|
|
458
|
+
}, {
|
|
459
|
+
readonly name: "";
|
|
460
|
+
readonly type: "uint256";
|
|
461
|
+
}];
|
|
462
|
+
}, {
|
|
463
|
+
readonly name: "getOperator";
|
|
464
|
+
readonly type: "function";
|
|
465
|
+
readonly stateMutability: "view";
|
|
466
|
+
readonly inputs: readonly [];
|
|
467
|
+
readonly outputs: readonly [{
|
|
468
|
+
readonly name: "";
|
|
469
|
+
readonly type: "address";
|
|
470
|
+
}];
|
|
408
471
|
}];
|
|
409
472
|
declare const STAKING_ABI: readonly [{
|
|
410
473
|
readonly name: "OnlyGEN";
|
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkWTAFQOXCcjs = require('./chunk-WTAFQOXC.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -31,7 +31,7 @@ var _viem = require('viem');
|
|
|
31
31
|
function accountActions(client) {
|
|
32
32
|
return {
|
|
33
33
|
fundAccount: async ({ address, amount }) => {
|
|
34
|
-
if (_optionalChain([client, 'access', _ => _.chain, 'optionalAccess', _2 => _2.id]) !==
|
|
34
|
+
if (_optionalChain([client, 'access', _ => _.chain, 'optionalAccess', _2 => _2.id]) !== _chunkWTAFQOXCcjs.localnet.id) {
|
|
35
35
|
throw new Error("Client is not connected to the localnet");
|
|
36
36
|
}
|
|
37
37
|
return client.request({
|
|
@@ -415,8 +415,8 @@ function serialize(data) {
|
|
|
415
415
|
// src/abi/index.ts
|
|
416
416
|
var abi_exports = {};
|
|
417
417
|
_chunk75ZPJI57cjs.__export.call(void 0, abi_exports, {
|
|
418
|
-
STAKING_ABI: () =>
|
|
419
|
-
VALIDATOR_WALLET_ABI: () =>
|
|
418
|
+
STAKING_ABI: () => _chunkWTAFQOXCcjs.STAKING_ABI,
|
|
419
|
+
VALIDATOR_WALLET_ABI: () => _chunkWTAFQOXCcjs.VALIDATOR_WALLET_ABI,
|
|
420
420
|
calldata: () => calldata,
|
|
421
421
|
transactions: () => transactions
|
|
422
422
|
});
|
|
@@ -516,7 +516,7 @@ function _toJsonSafeDeep(value, seen) {
|
|
|
516
516
|
var contractActions = (client, publicClient) => {
|
|
517
517
|
return {
|
|
518
518
|
getContractCode: async (address) => {
|
|
519
|
-
if (client.chain.id !==
|
|
519
|
+
if (client.chain.id !== _chunkWTAFQOXCcjs.localnet.id) {
|
|
520
520
|
throw new Error("Getting contract code is not supported on this network");
|
|
521
521
|
}
|
|
522
522
|
const result = await client.request({
|
|
@@ -527,7 +527,7 @@ var contractActions = (client, publicClient) => {
|
|
|
527
527
|
return new TextDecoder().decode(codeBytes);
|
|
528
528
|
},
|
|
529
529
|
getContractSchema: async (address) => {
|
|
530
|
-
if (client.chain.id !==
|
|
530
|
+
if (client.chain.id !== _chunkWTAFQOXCcjs.localnet.id) {
|
|
531
531
|
throw new Error("Contract schema is not supported on this network");
|
|
532
532
|
}
|
|
533
533
|
const schema = await client.request({
|
|
@@ -537,7 +537,7 @@ var contractActions = (client, publicClient) => {
|
|
|
537
537
|
return schema;
|
|
538
538
|
},
|
|
539
539
|
getContractSchemaForCode: async (contractCode) => {
|
|
540
|
-
if (client.chain.id !==
|
|
540
|
+
if (client.chain.id !== _chunkWTAFQOXCcjs.localnet.id) {
|
|
541
541
|
throw new Error("Contract schema is not supported on this network");
|
|
542
542
|
}
|
|
543
543
|
const schema = await client.request({
|
|
@@ -1054,7 +1054,7 @@ var receiptActions = (client, publicClient) => ({
|
|
|
1054
1054
|
const requestedStatus = _chunkW4V73RPNcjs.transactionsStatusNameToNumber[status];
|
|
1055
1055
|
if (transactionStatusString === requestedStatus || status === "ACCEPTED" /* ACCEPTED */ && _chunkW4V73RPNcjs.isDecidedState.call(void 0, transactionStatusString)) {
|
|
1056
1056
|
let finalTransaction = transaction;
|
|
1057
|
-
if (client.chain.id ===
|
|
1057
|
+
if (client.chain.id === _chunkWTAFQOXCcjs.localnet.id) {
|
|
1058
1058
|
finalTransaction = decodeLocalnetTransaction(transaction);
|
|
1059
1059
|
}
|
|
1060
1060
|
if (!fullTransaction) {
|
|
@@ -1119,9 +1119,9 @@ var snapID = {
|
|
|
1119
1119
|
|
|
1120
1120
|
// src/wallet/connect.ts
|
|
1121
1121
|
var networks = {
|
|
1122
|
-
localnet:
|
|
1123
|
-
studionet:
|
|
1124
|
-
testnetAsimov:
|
|
1122
|
+
localnet: _chunkWTAFQOXCcjs.localnet,
|
|
1123
|
+
studionet: _chunkWTAFQOXCcjs.studionet,
|
|
1124
|
+
testnetAsimov: _chunkWTAFQOXCcjs.testnetAsimov
|
|
1125
1125
|
};
|
|
1126
1126
|
var connect = async (client, network = "studionet", snapSource = "npm") => {
|
|
1127
1127
|
if (!window.ethereum) {
|
|
@@ -1237,7 +1237,7 @@ function formatStakingAmount(amount) {
|
|
|
1237
1237
|
// src/staking/actions.ts
|
|
1238
1238
|
var FALLBACK_GAS = 1000000n;
|
|
1239
1239
|
var GAS_BUFFER_MULTIPLIER = 2n;
|
|
1240
|
-
var COMBINED_ERROR_ABI = [...
|
|
1240
|
+
var COMBINED_ERROR_ABI = [..._chunkWTAFQOXCcjs.STAKING_ABI, ..._chunkWTAFQOXCcjs.VALIDATOR_WALLET_ABI];
|
|
1241
1241
|
function extractRevertReason(err) {
|
|
1242
1242
|
if (err instanceof _viem.BaseError) {
|
|
1243
1243
|
const rawError = err.walk((e) => e instanceof _viem.RawContractError);
|
|
@@ -1369,7 +1369,7 @@ var stakingActions = (client, publicClient) => {
|
|
|
1369
1369
|
const address = getStakingAddress();
|
|
1370
1370
|
return _viem.getContract.call(void 0, {
|
|
1371
1371
|
address,
|
|
1372
|
-
abi:
|
|
1372
|
+
abi: _chunkWTAFQOXCcjs.STAKING_ABI,
|
|
1373
1373
|
client: { public: publicClient, wallet: client }
|
|
1374
1374
|
});
|
|
1375
1375
|
};
|
|
@@ -1377,7 +1377,7 @@ var stakingActions = (client, publicClient) => {
|
|
|
1377
1377
|
const address = getStakingAddress();
|
|
1378
1378
|
return _viem.getContract.call(void 0, {
|
|
1379
1379
|
address,
|
|
1380
|
-
abi:
|
|
1380
|
+
abi: _chunkWTAFQOXCcjs.STAKING_ABI,
|
|
1381
1381
|
client: publicClient
|
|
1382
1382
|
});
|
|
1383
1383
|
};
|
|
@@ -1386,11 +1386,11 @@ var stakingActions = (client, publicClient) => {
|
|
|
1386
1386
|
const amount = parseStakingAmount(options.amount);
|
|
1387
1387
|
const stakingAddress = getStakingAddress();
|
|
1388
1388
|
const data = options.operator ? _viem.encodeFunctionData.call(void 0, {
|
|
1389
|
-
abi:
|
|
1389
|
+
abi: _chunkWTAFQOXCcjs.STAKING_ABI,
|
|
1390
1390
|
functionName: "validatorJoin",
|
|
1391
1391
|
args: [options.operator]
|
|
1392
1392
|
}) : _viem.encodeFunctionData.call(void 0, {
|
|
1393
|
-
abi:
|
|
1393
|
+
abi: _chunkWTAFQOXCcjs.STAKING_ABI,
|
|
1394
1394
|
functionName: "validatorJoin"
|
|
1395
1395
|
});
|
|
1396
1396
|
const result = await executeWrite({ to: stakingAddress, data, value: amount });
|
|
@@ -1399,7 +1399,7 @@ var stakingActions = (client, publicClient) => {
|
|
|
1399
1399
|
let eventFound = false;
|
|
1400
1400
|
for (const log of receipt.logs) {
|
|
1401
1401
|
try {
|
|
1402
|
-
const decoded = _viem.decodeEventLog.call(void 0, { abi:
|
|
1402
|
+
const decoded = _viem.decodeEventLog.call(void 0, { abi: _chunkWTAFQOXCcjs.STAKING_ABI, data: log.data, topics: log.topics });
|
|
1403
1403
|
if (decoded.eventName === "ValidatorJoin") {
|
|
1404
1404
|
validatorWallet = decoded.args.validator;
|
|
1405
1405
|
eventFound = true;
|
|
@@ -1426,7 +1426,7 @@ var stakingActions = (client, publicClient) => {
|
|
|
1426
1426
|
validatorDeposit: async (options) => {
|
|
1427
1427
|
const amount = parseStakingAmount(options.amount);
|
|
1428
1428
|
const data = _viem.encodeFunctionData.call(void 0, {
|
|
1429
|
-
abi:
|
|
1429
|
+
abi: _chunkWTAFQOXCcjs.STAKING_ABI,
|
|
1430
1430
|
functionName: "validatorDeposit"
|
|
1431
1431
|
});
|
|
1432
1432
|
return executeWrite({ to: getStakingAddress(), data, value: amount });
|
|
@@ -1434,7 +1434,7 @@ var stakingActions = (client, publicClient) => {
|
|
|
1434
1434
|
validatorExit: async (options) => {
|
|
1435
1435
|
const shares = typeof options.shares === "string" ? BigInt(options.shares) : options.shares;
|
|
1436
1436
|
const data = _viem.encodeFunctionData.call(void 0, {
|
|
1437
|
-
abi:
|
|
1437
|
+
abi: _chunkWTAFQOXCcjs.STAKING_ABI,
|
|
1438
1438
|
functionName: "validatorExit",
|
|
1439
1439
|
args: [shares]
|
|
1440
1440
|
});
|
|
@@ -1446,7 +1446,7 @@ var stakingActions = (client, publicClient) => {
|
|
|
1446
1446
|
}
|
|
1447
1447
|
const validatorAddress = _optionalChain([options, 'optionalAccess', _58 => _58.validator]) || client.account.address;
|
|
1448
1448
|
const data = _viem.encodeFunctionData.call(void 0, {
|
|
1449
|
-
abi:
|
|
1449
|
+
abi: _chunkWTAFQOXCcjs.STAKING_ABI,
|
|
1450
1450
|
functionName: "validatorClaim",
|
|
1451
1451
|
args: [validatorAddress]
|
|
1452
1452
|
});
|
|
@@ -1455,7 +1455,7 @@ var stakingActions = (client, publicClient) => {
|
|
|
1455
1455
|
},
|
|
1456
1456
|
validatorPrime: async (options) => {
|
|
1457
1457
|
const data = _viem.encodeFunctionData.call(void 0, {
|
|
1458
|
-
abi:
|
|
1458
|
+
abi: _chunkWTAFQOXCcjs.STAKING_ABI,
|
|
1459
1459
|
functionName: "validatorPrime",
|
|
1460
1460
|
args: [options.validator]
|
|
1461
1461
|
});
|
|
@@ -1463,7 +1463,7 @@ var stakingActions = (client, publicClient) => {
|
|
|
1463
1463
|
},
|
|
1464
1464
|
setOperator: async (options) => {
|
|
1465
1465
|
const data = _viem.encodeFunctionData.call(void 0, {
|
|
1466
|
-
abi:
|
|
1466
|
+
abi: _chunkWTAFQOXCcjs.VALIDATOR_WALLET_ABI,
|
|
1467
1467
|
functionName: "setOperator",
|
|
1468
1468
|
args: [options.operator]
|
|
1469
1469
|
});
|
|
@@ -1479,7 +1479,7 @@ var stakingActions = (client, publicClient) => {
|
|
|
1479
1479
|
}
|
|
1480
1480
|
}
|
|
1481
1481
|
const data = _viem.encodeFunctionData.call(void 0, {
|
|
1482
|
-
abi:
|
|
1482
|
+
abi: _chunkWTAFQOXCcjs.VALIDATOR_WALLET_ABI,
|
|
1483
1483
|
functionName: "setIdentity",
|
|
1484
1484
|
args: [
|
|
1485
1485
|
options.moniker,
|
|
@@ -1498,7 +1498,7 @@ var stakingActions = (client, publicClient) => {
|
|
|
1498
1498
|
delegatorJoin: async (options) => {
|
|
1499
1499
|
const amount = parseStakingAmount(options.amount);
|
|
1500
1500
|
const data = _viem.encodeFunctionData.call(void 0, {
|
|
1501
|
-
abi:
|
|
1501
|
+
abi: _chunkWTAFQOXCcjs.STAKING_ABI,
|
|
1502
1502
|
functionName: "delegatorJoin",
|
|
1503
1503
|
args: [options.validator]
|
|
1504
1504
|
});
|
|
@@ -1514,7 +1514,7 @@ var stakingActions = (client, publicClient) => {
|
|
|
1514
1514
|
delegatorExit: async (options) => {
|
|
1515
1515
|
const shares = typeof options.shares === "string" ? BigInt(options.shares) : options.shares;
|
|
1516
1516
|
const data = _viem.encodeFunctionData.call(void 0, {
|
|
1517
|
-
abi:
|
|
1517
|
+
abi: _chunkWTAFQOXCcjs.STAKING_ABI,
|
|
1518
1518
|
functionName: "delegatorExit",
|
|
1519
1519
|
args: [options.validator, shares]
|
|
1520
1520
|
});
|
|
@@ -1526,7 +1526,7 @@ var stakingActions = (client, publicClient) => {
|
|
|
1526
1526
|
}
|
|
1527
1527
|
const delegatorAddress = options.delegator || client.account.address;
|
|
1528
1528
|
const data = _viem.encodeFunctionData.call(void 0, {
|
|
1529
|
-
abi:
|
|
1529
|
+
abi: _chunkWTAFQOXCcjs.STAKING_ABI,
|
|
1530
1530
|
functionName: "delegatorClaim",
|
|
1531
1531
|
args: [delegatorAddress, options.validator]
|
|
1532
1532
|
});
|
|
@@ -1544,7 +1544,7 @@ var stakingActions = (client, publicClient) => {
|
|
|
1544
1544
|
}
|
|
1545
1545
|
const walletContract = _viem.getContract.call(void 0, {
|
|
1546
1546
|
address: validator,
|
|
1547
|
-
abi:
|
|
1547
|
+
abi: _chunkWTAFQOXCcjs.VALIDATOR_WALLET_ABI,
|
|
1548
1548
|
client: publicClient
|
|
1549
1549
|
});
|
|
1550
1550
|
const [view, owner, operator, identityRaw, currentEpoch] = await Promise.all([
|
|
@@ -1757,7 +1757,7 @@ var stakingActions = (client, publicClient) => {
|
|
|
1757
1757
|
function chainActions(client) {
|
|
1758
1758
|
return {
|
|
1759
1759
|
initializeConsensusSmartContract: async (forceReset = false) => {
|
|
1760
|
-
if (_optionalChain([client, 'access', _59 => _59.chain, 'optionalAccess', _60 => _60.id]) ===
|
|
1760
|
+
if (_optionalChain([client, 'access', _59 => _59.chain, 'optionalAccess', _60 => _60.id]) === _chunkWTAFQOXCcjs.testnetAsimov.id) {
|
|
1761
1761
|
return;
|
|
1762
1762
|
}
|
|
1763
1763
|
if (!forceReset && _optionalChain([client, 'access', _61 => _61.chain, 'access', _62 => _62.consensusMainContract, 'optionalAccess', _63 => _63.address]) && _optionalChain([client, 'access', _64 => _64.chain, 'access', _65 => _65.consensusMainContract, 'optionalAccess', _66 => _66.abi])) {
|
|
@@ -1830,8 +1830,8 @@ var getCustomTransportConfig = (config) => {
|
|
|
1830
1830
|
}
|
|
1831
1831
|
};
|
|
1832
1832
|
};
|
|
1833
|
-
var createClient = (config = { chain:
|
|
1834
|
-
const chainConfig = config.chain ||
|
|
1833
|
+
var createClient = (config = { chain: _chunkWTAFQOXCcjs.localnet }) => {
|
|
1834
|
+
const chainConfig = config.chain || _chunkWTAFQOXCcjs.localnet;
|
|
1835
1835
|
if (config.endpoint) {
|
|
1836
1836
|
chainConfig.rpcUrls.default.http = [config.endpoint];
|
|
1837
1837
|
}
|
|
@@ -1892,4 +1892,4 @@ var createAccount = (accountPrivateKey) => {
|
|
|
1892
1892
|
|
|
1893
1893
|
|
|
1894
1894
|
|
|
1895
|
-
exports.abi = abi_exports; exports.chains =
|
|
1895
|
+
exports.abi = abi_exports; exports.chains = _chunkWTAFQOXCcjs.chains_exports; exports.createAccount = createAccount; exports.createClient = createClient; exports.decodeInputData = decodeInputData; exports.decodeLocalnetTransaction = decodeLocalnetTransaction; exports.decodeTransaction = decodeTransaction; exports.formatStakingAmount = formatStakingAmount; exports.generatePrivateKey = generatePrivateKey; exports.parseStakingAmount = parseStakingAmount; exports.simplifyTransactionReceipt = simplifyTransactionReceipt;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as viem from 'viem';
|
|
2
2
|
import { Account, Address, Hex } from 'viem';
|
|
3
3
|
import { G as GenLayerChain } from './chains-B7B7UXdn.cjs';
|
|
4
|
-
import { G as GenLayerClient, D as DecodedDeployData, a as DecodedCallData, b as GenLayerRawTransaction, c as GenLayerTransaction, C as CalldataEncodable, T as TransactionDataElement, S as STAKING_ABI, V as VALIDATOR_WALLET_ABI } from './index-
|
|
4
|
+
import { G as GenLayerClient, D as DecodedDeployData, a as DecodedCallData, b as GenLayerRawTransaction, c as GenLayerTransaction, C as CalldataEncodable, T as TransactionDataElement, S as STAKING_ABI, V as VALIDATOR_WALLET_ABI } from './index-C3KT8eu_.cjs';
|
|
5
5
|
import * as abitype from 'abitype';
|
|
6
6
|
import * as viem__types_types_authorization from 'viem/_types/types/authorization';
|
|
7
7
|
import * as viem_accounts from 'viem/accounts';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as viem from 'viem';
|
|
2
2
|
import { Account, Address, Hex } from 'viem';
|
|
3
3
|
import { G as GenLayerChain } from './chains-B7B7UXdn.js';
|
|
4
|
-
import { G as GenLayerClient, D as DecodedDeployData, a as DecodedCallData, b as GenLayerRawTransaction, c as GenLayerTransaction, C as CalldataEncodable, T as TransactionDataElement, S as STAKING_ABI, V as VALIDATOR_WALLET_ABI } from './index-
|
|
4
|
+
import { G as GenLayerClient, D as DecodedDeployData, a as DecodedCallData, b as GenLayerRawTransaction, c as GenLayerTransaction, C as CalldataEncodable, T as TransactionDataElement, S as STAKING_ABI, V as VALIDATOR_WALLET_ABI } from './index-BNui_XYa.js';
|
|
5
5
|
import * as abitype from 'abitype';
|
|
6
6
|
import * as viem__types_types_authorization from 'viem/_types/types/authorization';
|
|
7
7
|
import * as viem_accounts from 'viem/accounts';
|
package/dist/index.js
CHANGED
package/dist/types/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { Account, Address } from 'viem';
|
|
2
|
-
export { I as BannedValidatorInfo, d as CalldataAddress, C as CalldataEncodable, i as ContractMethod, h as ContractMethodBase, f as ContractParamsArraySchemaElement, g as ContractParamsSchema, j as ContractSchema, o as DECIDED_STATES, a as DecodedCallData, D as DecodedDeployData, a3 as DelegatorClaimOptions, a2 as DelegatorExitOptions, a1 as DelegatorJoinOptions, R as DelegatorJoinResult, K as EpochData, L as EpochInfo, G as GenLayerClient, e as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, M as MethodDescription, N as Network, P as PendingDeposit, F as PendingWithdrawal, a0 as SetIdentityOptions, $ as SetOperatorOptions, y as SnapSource, J as StakeInfo, a4 as StakingActions, z as StakingContract, O as StakingTransactionResult, k as TransactionHash, x as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, w as TransactionType, Z as ValidatorClaimOptions, X as ValidatorDepositOptions, Y as ValidatorExitOptions, B as ValidatorIdentity, E as ValidatorInfo, U as ValidatorJoinOptions, Q as ValidatorJoinResult, _ as ValidatorPrimeOptions, A as ValidatorView, s as VoteType, W as WithdrawalCommit, p as isDecidedState, q as transactionResultNumberToName, n as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, u as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-
|
|
2
|
+
export { I as BannedValidatorInfo, d as CalldataAddress, C as CalldataEncodable, i as ContractMethod, h as ContractMethodBase, f as ContractParamsArraySchemaElement, g as ContractParamsSchema, j as ContractSchema, o as DECIDED_STATES, a as DecodedCallData, D as DecodedDeployData, a3 as DelegatorClaimOptions, a2 as DelegatorExitOptions, a1 as DelegatorJoinOptions, R as DelegatorJoinResult, K as EpochData, L as EpochInfo, G as GenLayerClient, e as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, M as MethodDescription, N as Network, P as PendingDeposit, F as PendingWithdrawal, a0 as SetIdentityOptions, $ as SetOperatorOptions, y as SnapSource, J as StakeInfo, a4 as StakingActions, z as StakingContract, O as StakingTransactionResult, k as TransactionHash, x as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, w as TransactionType, Z as ValidatorClaimOptions, X as ValidatorDepositOptions, Y as ValidatorExitOptions, B as ValidatorIdentity, E as ValidatorInfo, U as ValidatorJoinOptions, Q as ValidatorJoinResult, _ as ValidatorPrimeOptions, A as ValidatorView, s as VoteType, W as WithdrawalCommit, p as isDecidedState, q as transactionResultNumberToName, n as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, u as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-C3KT8eu_.cjs';
|
|
3
3
|
export { G as GenLayerChain } from '../chains-B7B7UXdn.cjs';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { Account, Address } from 'viem';
|
|
2
|
-
export { I as BannedValidatorInfo, d as CalldataAddress, C as CalldataEncodable, i as ContractMethod, h as ContractMethodBase, f as ContractParamsArraySchemaElement, g as ContractParamsSchema, j as ContractSchema, o as DECIDED_STATES, a as DecodedCallData, D as DecodedDeployData, a3 as DelegatorClaimOptions, a2 as DelegatorExitOptions, a1 as DelegatorJoinOptions, R as DelegatorJoinResult, K as EpochData, L as EpochInfo, G as GenLayerClient, e as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, M as MethodDescription, N as Network, P as PendingDeposit, F as PendingWithdrawal, a0 as SetIdentityOptions, $ as SetOperatorOptions, y as SnapSource, J as StakeInfo, a4 as StakingActions, z as StakingContract, O as StakingTransactionResult, k as TransactionHash, x as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, w as TransactionType, Z as ValidatorClaimOptions, X as ValidatorDepositOptions, Y as ValidatorExitOptions, B as ValidatorIdentity, E as ValidatorInfo, U as ValidatorJoinOptions, Q as ValidatorJoinResult, _ as ValidatorPrimeOptions, A as ValidatorView, s as VoteType, W as WithdrawalCommit, p as isDecidedState, q as transactionResultNumberToName, n as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, u as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-
|
|
2
|
+
export { I as BannedValidatorInfo, d as CalldataAddress, C as CalldataEncodable, i as ContractMethod, h as ContractMethodBase, f as ContractParamsArraySchemaElement, g as ContractParamsSchema, j as ContractSchema, o as DECIDED_STATES, a as DecodedCallData, D as DecodedDeployData, a3 as DelegatorClaimOptions, a2 as DelegatorExitOptions, a1 as DelegatorJoinOptions, R as DelegatorJoinResult, K as EpochData, L as EpochInfo, G as GenLayerClient, e as GenLayerMethod, b as GenLayerRawTransaction, c as GenLayerTransaction, H as Hash, M as MethodDescription, N as Network, P as PendingDeposit, F as PendingWithdrawal, a0 as SetIdentityOptions, $ as SetOperatorOptions, y as SnapSource, J as StakeInfo, a4 as StakingActions, z as StakingContract, O as StakingTransactionResult, k as TransactionHash, x as TransactionHashVariant, m as TransactionResult, r as TransactionResultNameToNumber, l as TransactionStatus, w as TransactionType, Z as ValidatorClaimOptions, X as ValidatorDepositOptions, Y as ValidatorExitOptions, B as ValidatorIdentity, E as ValidatorInfo, U as ValidatorJoinOptions, Q as ValidatorJoinResult, _ as ValidatorPrimeOptions, A as ValidatorView, s as VoteType, W as WithdrawalCommit, p as isDecidedState, q as transactionResultNumberToName, n as transactionsStatusNameToNumber, t as transactionsStatusNumberToName, u as voteTypeNameToNumber, v as voteTypeNumberToName } from '../index-BNui_XYa.js';
|
|
3
3
|
export { G as GenLayerChain } from '../chains-B7B7UXdn.js';
|
package/package.json
CHANGED
package/src/abi/staking.ts
CHANGED
|
@@ -69,6 +69,67 @@ export const VALIDATOR_WALLET_ABI = [
|
|
|
69
69
|
],
|
|
70
70
|
outputs: [],
|
|
71
71
|
},
|
|
72
|
+
// Staking functions (forwarded to staking contract)
|
|
73
|
+
{
|
|
74
|
+
name: "validatorDeposit",
|
|
75
|
+
type: "function",
|
|
76
|
+
stateMutability: "payable",
|
|
77
|
+
inputs: [],
|
|
78
|
+
outputs: [],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "validatorExit",
|
|
82
|
+
type: "function",
|
|
83
|
+
stateMutability: "nonpayable",
|
|
84
|
+
inputs: [{name: "_shares", type: "uint256"}],
|
|
85
|
+
outputs: [],
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "validatorClaim",
|
|
89
|
+
type: "function",
|
|
90
|
+
stateMutability: "nonpayable",
|
|
91
|
+
inputs: [],
|
|
92
|
+
outputs: [],
|
|
93
|
+
},
|
|
94
|
+
// Two-step operator transfer
|
|
95
|
+
{
|
|
96
|
+
name: "initiateOperatorTransfer",
|
|
97
|
+
type: "function",
|
|
98
|
+
stateMutability: "nonpayable",
|
|
99
|
+
inputs: [{name: "_newOperator", type: "address"}],
|
|
100
|
+
outputs: [],
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "completeOperatorTransfer",
|
|
104
|
+
type: "function",
|
|
105
|
+
stateMutability: "nonpayable",
|
|
106
|
+
inputs: [],
|
|
107
|
+
outputs: [],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "cancelOperatorTransfer",
|
|
111
|
+
type: "function",
|
|
112
|
+
stateMutability: "nonpayable",
|
|
113
|
+
inputs: [],
|
|
114
|
+
outputs: [],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "getPendingOperator",
|
|
118
|
+
type: "function",
|
|
119
|
+
stateMutability: "view",
|
|
120
|
+
inputs: [],
|
|
121
|
+
outputs: [
|
|
122
|
+
{name: "", type: "address"},
|
|
123
|
+
{name: "", type: "uint256"},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: "getOperator",
|
|
128
|
+
type: "function",
|
|
129
|
+
stateMutability: "view",
|
|
130
|
+
inputs: [],
|
|
131
|
+
outputs: [{name: "", type: "address"}],
|
|
132
|
+
},
|
|
72
133
|
] as const;
|
|
73
134
|
|
|
74
135
|
export const STAKING_ABI = [
|