@sravankumar02/sdk-core 1.0.0 → 2.0.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/out/abi/codec/binary.js.map +1 -1
- package/out/abi/codec/managedDecimal.js +17 -5
- package/out/abi/codec/managedDecimal.js.map +1 -1
- package/out/abi/codec/managedDecimalSigned.js +17 -5
- package/out/abi/codec/managedDecimalSigned.js.map +1 -1
- package/out/abi/index.d.ts +0 -3
- package/out/abi/index.js +0 -3
- package/out/abi/index.js.map +1 -1
- package/out/abi/nativeSerializer.js +1 -1
- package/out/abi/nativeSerializer.js.map +1 -1
- package/out/abi/typesystem/typeMapper.js +2 -0
- package/out/abi/typesystem/typeMapper.js.map +1 -1
- package/out/accountManagement/accountController.d.ts +2 -1
- package/out/accountManagement/accountController.js +11 -20
- package/out/accountManagement/accountController.js.map +1 -1
- package/out/accountManagement/accountTransactionsFactory.d.ts +10 -5
- package/out/accountManagement/accountTransactionsFactory.js +45 -34
- package/out/accountManagement/accountTransactionsFactory.js.map +1 -1
- package/out/core/address.d.ts +1 -25
- package/out/core/address.js +3 -41
- package/out/core/address.js.map +1 -1
- package/out/core/baseController.d.ts +9 -3
- package/out/core/baseController.js +24 -10
- package/out/core/baseController.js.map +1 -1
- package/out/core/baseFactory.d.ts +25 -0
- package/out/core/baseFactory.js +40 -0
- package/out/core/baseFactory.js.map +1 -0
- package/out/core/codeMetadata.d.ts +0 -10
- package/out/core/codeMetadata.js +0 -27
- package/out/core/codeMetadata.js.map +1 -1
- package/out/core/constants.d.ts +1 -0
- package/out/core/constants.js +2 -1
- package/out/core/constants.js.map +1 -1
- package/out/core/errors.d.ts +9 -0
- package/out/core/errors.js +17 -2
- package/out/core/errors.js.map +1 -1
- package/out/core/index.d.ts +2 -0
- package/out/core/index.js +2 -0
- package/out/core/index.js.map +1 -1
- package/out/core/interfaces.d.ts +5 -0
- package/out/core/tokens.d.ts +1 -77
- package/out/core/tokens.js +2 -144
- package/out/core/tokens.js.map +1 -1
- package/out/core/transaction.d.ts +1 -144
- package/out/core/transaction.js +0 -209
- package/out/core/transaction.js.map +1 -1
- package/out/core/transactionStatus.d.ts +0 -5
- package/out/core/transactionStatus.js +0 -7
- package/out/core/transactionStatus.js.map +1 -1
- package/out/core/transactionsFactoryConfig.d.ts +16 -0
- package/out/core/transactionsFactoryConfig.js +17 -0
- package/out/core/transactionsFactoryConfig.js.map +1 -1
- package/out/delegation/delegationController.d.ts +2 -1
- package/out/delegation/delegationController.js +39 -134
- package/out/delegation/delegationController.js.map +1 -1
- package/out/delegation/delegationTransactionsFactory.d.ts +23 -20
- package/out/delegation/delegationTransactionsFactory.js +183 -159
- package/out/delegation/delegationTransactionsFactory.js.map +1 -1
- package/out/entrypoints/entrypoints.d.ts +36 -3
- package/out/entrypoints/entrypoints.js +102 -27
- package/out/entrypoints/entrypoints.js.map +1 -1
- package/out/gasEstimator/gasLimitEstimator.d.ts +19 -0
- package/out/gasEstimator/gasLimitEstimator.js +22 -0
- package/out/gasEstimator/gasLimitEstimator.js.map +1 -0
- package/out/gasEstimator/index.d.ts +1 -0
- package/out/gasEstimator/index.js +6 -0
- package/out/gasEstimator/index.js.map +1 -0
- package/out/governance/governanceController.d.ts +2 -1
- package/out/governance/governanceController.js +13 -43
- package/out/governance/governanceController.js.map +1 -1
- package/out/governance/governanceTransactionsFactory.d.ts +10 -8
- package/out/governance/governanceTransactionsFactory.js +60 -52
- package/out/governance/governanceTransactionsFactory.js.map +1 -1
- package/out/index.d.ts +1 -0
- package/out/index.js +1 -0
- package/out/index.js.map +1 -1
- package/out/multisig/index.d.ts +2 -0
- package/out/multisig/index.js +2 -0
- package/out/multisig/index.js.map +1 -1
- package/out/multisig/multisigController.d.ts +2 -1
- package/out/multisig/multisigController.js +61 -117
- package/out/multisig/multisigController.js.map +1 -1
- package/out/multisig/multisigTransactionsFactory.d.ts +26 -24
- package/out/multisig/multisigTransactionsFactory.js +57 -54
- package/out/multisig/multisigTransactionsFactory.js.map +1 -1
- package/out/multisig/proposeTransferExecuteContractInput.d.ts +2 -2
- package/out/multisig/proposeTransferExecuteContractInput.js +4 -4
- package/out/multisig/proposeTransferExecuteContractInput.js.map +1 -1
- package/out/multisig/resources.d.ts +2 -2
- package/out/networkProviders/apiNetworkProvider.js +1 -3
- package/out/networkProviders/apiNetworkProvider.js.map +1 -1
- package/out/networkProviders/proxyNetworkProvider.js +20 -1
- package/out/networkProviders/proxyNetworkProvider.js.map +1 -1
- package/out/networkProviders/tokens.d.ts +0 -1
- package/out/smartContracts/resources.d.ts +6 -2
- package/out/smartContracts/smartContractController.d.ts +2 -1
- package/out/smartContracts/smartContractController.js +10 -22
- package/out/smartContracts/smartContractController.js.map +1 -1
- package/out/smartContracts/smartContractTransactionsFactory.d.ts +12 -7
- package/out/smartContracts/smartContractTransactionsFactory.js +62 -44
- package/out/smartContracts/smartContractTransactionsFactory.js.map +1 -1
- package/out/tokenManagement/tokenManagementController.d.ts +2 -1
- package/out/tokenManagement/tokenManagementController.js +71 -246
- package/out/tokenManagement/tokenManagementController.js.map +1 -1
- package/out/tokenManagement/tokenManagementTransactionsFactory.d.ts +39 -36
- package/out/tokenManagement/tokenManagementTransactionsFactory.js +310 -275
- package/out/tokenManagement/tokenManagementTransactionsFactory.js.map +1 -1
- package/out/transfers/transferTransactionsFactory.d.ts +10 -8
- package/out/transfers/transferTransactionsFactory.js +28 -26
- package/out/transfers/transferTransactionsFactory.js.map +1 -1
- package/out/transfers/transfersControllers.d.ts +2 -1
- package/out/transfers/transfersControllers.js +10 -23
- package/out/transfers/transfersControllers.js.map +1 -1
- package/out/validators/index.d.ts +2 -0
- package/out/validators/index.js +15 -0
- package/out/validators/index.js.map +1 -0
- package/out/validators/resources.d.ts +40 -0
- package/out/validators/resources.js +3 -0
- package/out/validators/resources.js.map +1 -0
- package/out/validators/validatorsController.d.ts +27 -0
- package/out/validators/validatorsController.js +95 -0
- package/out/validators/validatorsController.js.map +1 -0
- package/out/validators/validatorsSigner.d.ts +9 -0
- package/out/validators/validatorsSigner.js +25 -0
- package/out/validators/validatorsSigner.js.map +1 -0
- package/out/validators/validatorsTransactionsFactory.d.ts +33 -0
- package/out/validators/validatorsTransactionsFactory.js +269 -0
- package/out/validators/validatorsTransactionsFactory.js.map +1 -0
- package/out/wallet/index.d.ts +1 -0
- package/out/wallet/index.js +1 -0
- package/out/wallet/index.js.map +1 -1
- package/out/wallet/userWallet.d.ts +1 -1
- package/out/wallet/userWallet.js +1 -1
- package/out/wallet/validatorPem.d.ts +12 -0
- package/out/wallet/validatorPem.js +45 -0
- package/out/wallet/validatorPem.js.map +1 -0
- package/out/wallet/validatorSigner.d.ts +9 -1
- package/out/wallet/validatorSigner.js +24 -1
- package/out/wallet/validatorSigner.js.map +1 -1
- package/package.json +5 -5
- package/out/abi/code.d.ts +0 -23
- package/out/abi/code.js +0 -41
- package/out/abi/code.js.map +0 -1
- package/out/abi/interaction.d.ts +0 -67
- package/out/abi/interaction.js +0 -146
- package/out/abi/interaction.js.map +0 -1
- package/out/abi/smartContract.d.ts +0 -74
- package/out/abi/smartContract.js +0 -208
- package/out/abi/smartContract.js.map +0 -1
- package/out/core/transactionBuilder.d.ts +0 -32
- package/out/core/transactionBuilder.js +0 -45
- package/out/core/transactionBuilder.js.map +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidatorsSigners = void 0;
|
|
4
|
+
const wallet_1 = require("../wallet");
|
|
5
|
+
class ValidatorsSigners {
|
|
6
|
+
constructor(validatorSigners) {
|
|
7
|
+
this.signers = validatorSigners;
|
|
8
|
+
}
|
|
9
|
+
static async newFromPem(filePath) {
|
|
10
|
+
const validatorPemFiles = await wallet_1.ValidatorPEM.fromFileAll(filePath);
|
|
11
|
+
const signers = validatorPemFiles.map((pem) => new wallet_1.ValidatorSigner(pem.secretKey));
|
|
12
|
+
return new ValidatorsSigners(signers);
|
|
13
|
+
}
|
|
14
|
+
getNumOfNodes() {
|
|
15
|
+
return this.signers.length;
|
|
16
|
+
}
|
|
17
|
+
getSigners() {
|
|
18
|
+
return this.signers;
|
|
19
|
+
}
|
|
20
|
+
getPublicKeys() {
|
|
21
|
+
return this.signers.map((signer) => signer.getPubkey());
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ValidatorsSigners = ValidatorsSigners;
|
|
25
|
+
//# sourceMappingURL=validatorsSigner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validatorsSigner.js","sourceRoot":"","sources":["../../src/validators/validatorsSigner.ts"],"names":[],"mappings":";;;AAAA,sCAA8E;AAE9E,MAAa,iBAAiB;IAG1B,YAAY,gBAAmC;QAC3C,IAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,QAAgB;QACpC,MAAM,iBAAiB,GAAG,MAAM,qBAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACnE,MAAM,OAAO,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,wBAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;QACnF,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED,aAAa;QACT,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IAC/B,CAAC;IAED,UAAU;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,aAAa;QACT,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;IAC5D,CAAC;CACJ;AAxBD,8CAwBC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { IGasLimitEstimator, TransactionsFactoryConfig } from "../core";
|
|
2
|
+
import { Address } from "../core/address";
|
|
3
|
+
import { BaseFactory } from "../core/baseFactory";
|
|
4
|
+
import { Transaction } from "../core/transaction";
|
|
5
|
+
import * as resources from "./resources";
|
|
6
|
+
/**
|
|
7
|
+
* Use this class to create validators related transactions like creating transaction for staking or adding nodes.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ValidatorsTransactionsFactory extends BaseFactory {
|
|
10
|
+
private readonly config;
|
|
11
|
+
private readonly argSerializer;
|
|
12
|
+
constructor(options: {
|
|
13
|
+
config: TransactionsFactoryConfig;
|
|
14
|
+
gasLimitEstimator?: IGasLimitEstimator;
|
|
15
|
+
});
|
|
16
|
+
createTransactionForStaking(sender: Address, options: resources.StakingInput): Promise<Transaction>;
|
|
17
|
+
private prepareDataPartsForStaking;
|
|
18
|
+
createTransactionForToppingUp(sender: Address, options: resources.ToppingUpInput): Promise<Transaction>;
|
|
19
|
+
createTransactionForUnstaking(sender: Address, options: resources.UnstakingInput): Promise<Transaction>;
|
|
20
|
+
createTransactionForUnjailing(sender: Address, options: resources.UnjailingInput): Promise<Transaction>;
|
|
21
|
+
createTransactionForUnbonding(sender: Address, options: resources.UnbondingInput): Promise<Transaction>;
|
|
22
|
+
createTransactionForChangingRewardsAddress(sender: Address, options: resources.ChangingRewardsAddressInput): Promise<Transaction>;
|
|
23
|
+
createTransactionForClaiming(sender: Address): Promise<Transaction>;
|
|
24
|
+
createTransactionForUnstakingNodes(sender: Address, options: resources.UnstakingInput): Promise<Transaction>;
|
|
25
|
+
createTransactionForUnstakingTokens(sender: Address, options: resources.UnstakingTokensInput): Promise<Transaction>;
|
|
26
|
+
createTransactionForUnbondingNodes(sender: Address, options: resources.UnbondingInput): Promise<Transaction>;
|
|
27
|
+
createTransactionForUnbondingTokens(sender: Address, options: resources.UnbondingTokensInput): Promise<Transaction>;
|
|
28
|
+
createTransactionForCleaningRegisteredData(sender: Address): Promise<Transaction>;
|
|
29
|
+
createTransactionForRestakingUnstakedNodes(sender: Address, options: resources.RestakingInput): Promise<Transaction>;
|
|
30
|
+
createTransactionForNewDelegationContractFromValidatorData(sender: Address, options: resources.NewDelegationContractInput): Promise<Transaction>;
|
|
31
|
+
createTransactionForMergingValidatorToDelegationWithWhitelist(sender: Address, options: resources.MergeValidatorToDelegationInput): Promise<Transaction>;
|
|
32
|
+
createTransactionForMergingValidatorToDelegationSameOwner(sender: Address, options: resources.MergeValidatorToDelegationInput): Promise<Transaction>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidatorsTransactionsFactory = void 0;
|
|
4
|
+
const abi_1 = require("../abi");
|
|
5
|
+
const address_1 = require("../core/address");
|
|
6
|
+
const baseFactory_1 = require("../core/baseFactory");
|
|
7
|
+
const constants_1 = require("../core/constants");
|
|
8
|
+
const transaction_1 = require("../core/transaction");
|
|
9
|
+
const validatorsSigner_1 = require("./validatorsSigner");
|
|
10
|
+
/**
|
|
11
|
+
* Use this class to create validators related transactions like creating transaction for staking or adding nodes.
|
|
12
|
+
*/
|
|
13
|
+
class ValidatorsTransactionsFactory extends baseFactory_1.BaseFactory {
|
|
14
|
+
constructor(options) {
|
|
15
|
+
super({ config: options.config, gasLimitEstimator: options.gasLimitEstimator });
|
|
16
|
+
this.config = options.config;
|
|
17
|
+
this.argSerializer = new abi_1.ArgSerializer();
|
|
18
|
+
}
|
|
19
|
+
async createTransactionForStaking(sender, options) {
|
|
20
|
+
let validators;
|
|
21
|
+
if (typeof options.validatorsFile === "string") {
|
|
22
|
+
validators = await validatorsSigner_1.ValidatorsSigners.newFromPem(options.validatorsFile);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
validators = options.validatorsFile;
|
|
26
|
+
}
|
|
27
|
+
const dataParts = this.prepareDataPartsForStaking({
|
|
28
|
+
nodeOperator: sender,
|
|
29
|
+
validatorsFile: validators,
|
|
30
|
+
rewardsAddress: options.rewardsAddress,
|
|
31
|
+
});
|
|
32
|
+
const transaction = new transaction_1.Transaction({
|
|
33
|
+
sender,
|
|
34
|
+
receiver: address_1.Address.newFromHex(constants_1.STAKING_SMART_CONTRACT_ADDRESS_HEX, this.config.addressHrp),
|
|
35
|
+
chainID: this.config.chainID,
|
|
36
|
+
gasLimit: 0n,
|
|
37
|
+
value: options.amount,
|
|
38
|
+
});
|
|
39
|
+
this.setTransactionPayload(transaction, dataParts);
|
|
40
|
+
await this.setGasLimit(transaction, undefined, this.config.gasLimitForStaking * BigInt(validators.getNumOfNodes()));
|
|
41
|
+
return transaction;
|
|
42
|
+
}
|
|
43
|
+
prepareDataPartsForStaking(options) {
|
|
44
|
+
const dataParts = ["stake"];
|
|
45
|
+
const numOfNodes = options.validatorsFile.getNumOfNodes();
|
|
46
|
+
const callArguments = [];
|
|
47
|
+
callArguments.push(new abi_1.U32Value(numOfNodes));
|
|
48
|
+
for (const signer of options.validatorsFile.getSigners()) {
|
|
49
|
+
const signedMessages = signer.sign(options.nodeOperator.getPublicKey());
|
|
50
|
+
callArguments.push(new abi_1.BytesValue(Buffer.from(signer.getPubkey())));
|
|
51
|
+
callArguments.push(new abi_1.BytesValue(Buffer.from(signedMessages)));
|
|
52
|
+
}
|
|
53
|
+
if (options.rewardsAddress) {
|
|
54
|
+
callArguments.push(new abi_1.AddressValue(options.rewardsAddress));
|
|
55
|
+
}
|
|
56
|
+
const args = this.argSerializer.valuesToStrings(callArguments);
|
|
57
|
+
return dataParts.concat(args);
|
|
58
|
+
}
|
|
59
|
+
async createTransactionForToppingUp(sender, options) {
|
|
60
|
+
const data = ["stake"];
|
|
61
|
+
const transaction = new transaction_1.Transaction({
|
|
62
|
+
sender,
|
|
63
|
+
receiver: address_1.Address.newFromHex(constants_1.STAKING_SMART_CONTRACT_ADDRESS_HEX, this.config.addressHrp),
|
|
64
|
+
chainID: this.config.chainID,
|
|
65
|
+
gasLimit: 0n,
|
|
66
|
+
value: options.amount,
|
|
67
|
+
});
|
|
68
|
+
this.setTransactionPayload(transaction, data);
|
|
69
|
+
await this.setGasLimit(transaction, undefined, this.config.gasLimitForToppingUp);
|
|
70
|
+
return transaction;
|
|
71
|
+
}
|
|
72
|
+
async createTransactionForUnstaking(sender, options) {
|
|
73
|
+
const dataParts = ["unStake"];
|
|
74
|
+
for (const key of options.publicKeys) {
|
|
75
|
+
dataParts.push(key.hex());
|
|
76
|
+
}
|
|
77
|
+
const transaction = new transaction_1.Transaction({
|
|
78
|
+
sender,
|
|
79
|
+
receiver: address_1.Address.newFromHex(constants_1.STAKING_SMART_CONTRACT_ADDRESS_HEX, this.config.addressHrp),
|
|
80
|
+
chainID: this.config.chainID,
|
|
81
|
+
gasLimit: 0n,
|
|
82
|
+
});
|
|
83
|
+
this.setTransactionPayload(transaction, dataParts);
|
|
84
|
+
await this.setGasLimit(transaction, undefined, this.config.gasLimitForUnstaking * BigInt(options.publicKeys.length));
|
|
85
|
+
return transaction;
|
|
86
|
+
}
|
|
87
|
+
async createTransactionForUnjailing(sender, options) {
|
|
88
|
+
const dataParts = ["unJail"];
|
|
89
|
+
for (const key of options.publicKeys) {
|
|
90
|
+
dataParts.push(key.hex());
|
|
91
|
+
}
|
|
92
|
+
const transaction = new transaction_1.Transaction({
|
|
93
|
+
sender,
|
|
94
|
+
receiver: address_1.Address.newFromHex(constants_1.STAKING_SMART_CONTRACT_ADDRESS_HEX, this.config.addressHrp),
|
|
95
|
+
chainID: this.config.chainID,
|
|
96
|
+
gasLimit: 0n,
|
|
97
|
+
});
|
|
98
|
+
this.setTransactionPayload(transaction, dataParts);
|
|
99
|
+
await this.setGasLimit(transaction, undefined, this.config.gasLimitForUnjailing * BigInt(options.publicKeys.length));
|
|
100
|
+
return transaction;
|
|
101
|
+
}
|
|
102
|
+
async createTransactionForUnbonding(sender, options) {
|
|
103
|
+
const dataParts = ["unBond"];
|
|
104
|
+
for (const key of options.publicKeys) {
|
|
105
|
+
dataParts.push(key.hex());
|
|
106
|
+
}
|
|
107
|
+
const transaction = new transaction_1.Transaction({
|
|
108
|
+
sender,
|
|
109
|
+
receiver: address_1.Address.newFromHex(constants_1.STAKING_SMART_CONTRACT_ADDRESS_HEX, this.config.addressHrp),
|
|
110
|
+
chainID: this.config.chainID,
|
|
111
|
+
gasLimit: 0n,
|
|
112
|
+
});
|
|
113
|
+
this.setTransactionPayload(transaction, dataParts);
|
|
114
|
+
await this.setGasLimit(transaction, undefined, this.config.gasLimitForUnbonding * BigInt(options.publicKeys.length));
|
|
115
|
+
return transaction;
|
|
116
|
+
}
|
|
117
|
+
async createTransactionForChangingRewardsAddress(sender, options) {
|
|
118
|
+
const dataParts = ["changeRewardAddress", options.rewardsAddress.toHex()];
|
|
119
|
+
const transaction = new transaction_1.Transaction({
|
|
120
|
+
sender,
|
|
121
|
+
receiver: address_1.Address.newFromHex(constants_1.STAKING_SMART_CONTRACT_ADDRESS_HEX, this.config.addressHrp),
|
|
122
|
+
chainID: this.config.chainID,
|
|
123
|
+
gasLimit: 0n,
|
|
124
|
+
});
|
|
125
|
+
this.setTransactionPayload(transaction, dataParts);
|
|
126
|
+
await this.setGasLimit(transaction, undefined, this.config.gasLimitForChangingRewardsAddress);
|
|
127
|
+
return transaction;
|
|
128
|
+
}
|
|
129
|
+
async createTransactionForClaiming(sender) {
|
|
130
|
+
const dataParts = ["claim"];
|
|
131
|
+
const transaction = new transaction_1.Transaction({
|
|
132
|
+
sender,
|
|
133
|
+
receiver: address_1.Address.newFromHex(constants_1.STAKING_SMART_CONTRACT_ADDRESS_HEX, this.config.addressHrp),
|
|
134
|
+
chainID: this.config.chainID,
|
|
135
|
+
gasLimit: 0n,
|
|
136
|
+
});
|
|
137
|
+
this.setTransactionPayload(transaction, dataParts);
|
|
138
|
+
await this.setGasLimit(transaction, undefined, this.config.gasLimitForClaiming);
|
|
139
|
+
return transaction;
|
|
140
|
+
}
|
|
141
|
+
async createTransactionForUnstakingNodes(sender, options) {
|
|
142
|
+
const dataParts = ["unStakeNodes"];
|
|
143
|
+
for (const key of options.publicKeys) {
|
|
144
|
+
dataParts.push(key.hex());
|
|
145
|
+
}
|
|
146
|
+
const transaction = new transaction_1.Transaction({
|
|
147
|
+
sender,
|
|
148
|
+
receiver: address_1.Address.newFromHex(constants_1.STAKING_SMART_CONTRACT_ADDRESS_HEX, this.config.addressHrp),
|
|
149
|
+
chainID: this.config.chainID,
|
|
150
|
+
gasLimit: 0n,
|
|
151
|
+
});
|
|
152
|
+
this.setTransactionPayload(transaction, dataParts);
|
|
153
|
+
await this.setGasLimit(transaction, undefined, this.config.gasLimitForUnstakingNodes * BigInt(options.publicKeys.length));
|
|
154
|
+
return transaction;
|
|
155
|
+
}
|
|
156
|
+
async createTransactionForUnstakingTokens(sender, options) {
|
|
157
|
+
const dataParts = ["unStakeTokens", this.argSerializer.valuesToStrings([new abi_1.BigUIntValue(options.amount)])[0]];
|
|
158
|
+
const transaction = new transaction_1.Transaction({
|
|
159
|
+
sender,
|
|
160
|
+
receiver: address_1.Address.newFromHex(constants_1.STAKING_SMART_CONTRACT_ADDRESS_HEX, this.config.addressHrp),
|
|
161
|
+
chainID: this.config.chainID,
|
|
162
|
+
gasLimit: 0n,
|
|
163
|
+
});
|
|
164
|
+
this.setTransactionPayload(transaction, dataParts);
|
|
165
|
+
await this.setGasLimit(transaction, undefined, this.config.gasLimitForUnstakingTokens);
|
|
166
|
+
return transaction;
|
|
167
|
+
}
|
|
168
|
+
async createTransactionForUnbondingNodes(sender, options) {
|
|
169
|
+
const dataParts = ["unBondNodes"];
|
|
170
|
+
for (const key of options.publicKeys) {
|
|
171
|
+
dataParts.push(key.hex());
|
|
172
|
+
}
|
|
173
|
+
const transaction = new transaction_1.Transaction({
|
|
174
|
+
sender,
|
|
175
|
+
receiver: address_1.Address.newFromHex(constants_1.STAKING_SMART_CONTRACT_ADDRESS_HEX, this.config.addressHrp),
|
|
176
|
+
chainID: this.config.chainID,
|
|
177
|
+
gasLimit: 0n,
|
|
178
|
+
});
|
|
179
|
+
this.setTransactionPayload(transaction, dataParts);
|
|
180
|
+
await this.setGasLimit(transaction, undefined, this.config.gasLimitForUnbondingNodes * BigInt(options.publicKeys.length));
|
|
181
|
+
return transaction;
|
|
182
|
+
}
|
|
183
|
+
async createTransactionForUnbondingTokens(sender, options) {
|
|
184
|
+
const dataParts = ["unBondTokens", this.argSerializer.valuesToStrings([new abi_1.BigUIntValue(options.amount)])[0]];
|
|
185
|
+
const transaction = new transaction_1.Transaction({
|
|
186
|
+
sender,
|
|
187
|
+
receiver: address_1.Address.newFromHex(constants_1.STAKING_SMART_CONTRACT_ADDRESS_HEX, this.config.addressHrp),
|
|
188
|
+
chainID: this.config.chainID,
|
|
189
|
+
gasLimit: 0n,
|
|
190
|
+
});
|
|
191
|
+
this.setTransactionPayload(transaction, dataParts);
|
|
192
|
+
await this.setGasLimit(transaction, undefined, this.config.gasLimitForUnbondingTokens);
|
|
193
|
+
return transaction;
|
|
194
|
+
}
|
|
195
|
+
async createTransactionForCleaningRegisteredData(sender) {
|
|
196
|
+
const dataParts = ["cleanRegisteredData"];
|
|
197
|
+
const transaction = new transaction_1.Transaction({
|
|
198
|
+
sender,
|
|
199
|
+
receiver: address_1.Address.newFromHex(constants_1.STAKING_SMART_CONTRACT_ADDRESS_HEX, this.config.addressHrp),
|
|
200
|
+
chainID: this.config.chainID,
|
|
201
|
+
gasLimit: 0n,
|
|
202
|
+
});
|
|
203
|
+
this.setTransactionPayload(transaction, dataParts);
|
|
204
|
+
await this.setGasLimit(transaction, undefined, this.config.gasLimitForCleaningRegisteredData);
|
|
205
|
+
return transaction;
|
|
206
|
+
}
|
|
207
|
+
async createTransactionForRestakingUnstakedNodes(sender, options) {
|
|
208
|
+
const dataParts = ["reStakeUnStakedNodes"];
|
|
209
|
+
for (const key of options.publicKeys) {
|
|
210
|
+
dataParts.push(key.hex());
|
|
211
|
+
}
|
|
212
|
+
const transaction = new transaction_1.Transaction({
|
|
213
|
+
sender,
|
|
214
|
+
receiver: address_1.Address.newFromHex(constants_1.STAKING_SMART_CONTRACT_ADDRESS_HEX, this.config.addressHrp),
|
|
215
|
+
chainID: this.config.chainID,
|
|
216
|
+
gasLimit: 0n,
|
|
217
|
+
});
|
|
218
|
+
this.setTransactionPayload(transaction, dataParts);
|
|
219
|
+
await this.setGasLimit(transaction, undefined, this.config.gasLimitForUnstakingNodes * BigInt(options.publicKeys.length));
|
|
220
|
+
return transaction;
|
|
221
|
+
}
|
|
222
|
+
async createTransactionForNewDelegationContractFromValidatorData(sender, options) {
|
|
223
|
+
const dataParts = [
|
|
224
|
+
"makeNewContractFromValidatorData",
|
|
225
|
+
...this.argSerializer.valuesToStrings([new abi_1.BigUIntValue(options.maxCap), new abi_1.BigUIntValue(options.fee)]),
|
|
226
|
+
];
|
|
227
|
+
const transaction = new transaction_1.Transaction({
|
|
228
|
+
sender,
|
|
229
|
+
receiver: address_1.Address.newFromHex(constants_1.DELEGATION_MANAGER_SC_ADDRESS_HEX, this.config.addressHrp),
|
|
230
|
+
chainID: this.config.chainID,
|
|
231
|
+
gasLimit: 0n,
|
|
232
|
+
});
|
|
233
|
+
this.setTransactionPayload(transaction, dataParts);
|
|
234
|
+
await this.setGasLimit(transaction, undefined, this.config.gasLimitForCreatingDelegationContractFromValidator);
|
|
235
|
+
return transaction;
|
|
236
|
+
}
|
|
237
|
+
async createTransactionForMergingValidatorToDelegationWithWhitelist(sender, options) {
|
|
238
|
+
const dataParts = [
|
|
239
|
+
"mergeValidatorToDelegationWithWhitelist",
|
|
240
|
+
this.argSerializer.valuesToStrings([new abi_1.AddressValue(options.delegationAddress)])[0],
|
|
241
|
+
];
|
|
242
|
+
const transaction = new transaction_1.Transaction({
|
|
243
|
+
sender,
|
|
244
|
+
receiver: address_1.Address.newFromHex(constants_1.DELEGATION_MANAGER_SC_ADDRESS_HEX, this.config.addressHrp),
|
|
245
|
+
chainID: this.config.chainID,
|
|
246
|
+
gasLimit: 0n,
|
|
247
|
+
});
|
|
248
|
+
this.setTransactionPayload(transaction, dataParts);
|
|
249
|
+
await this.setGasLimit(transaction, undefined, this.config.gasLimitForWhitelistForMerge);
|
|
250
|
+
return transaction;
|
|
251
|
+
}
|
|
252
|
+
async createTransactionForMergingValidatorToDelegationSameOwner(sender, options) {
|
|
253
|
+
const dataParts = [
|
|
254
|
+
"mergeValidatorToDelegationSameOwner",
|
|
255
|
+
this.argSerializer.valuesToStrings([new abi_1.AddressValue(options.delegationAddress)])[0],
|
|
256
|
+
];
|
|
257
|
+
const transaction = new transaction_1.Transaction({
|
|
258
|
+
sender,
|
|
259
|
+
receiver: address_1.Address.newFromHex(constants_1.DELEGATION_MANAGER_SC_ADDRESS_HEX, this.config.addressHrp),
|
|
260
|
+
chainID: this.config.chainID,
|
|
261
|
+
gasLimit: 0n,
|
|
262
|
+
});
|
|
263
|
+
this.setTransactionPayload(transaction, dataParts);
|
|
264
|
+
await this.setGasLimit(transaction, undefined, this.config.gasLimitForMergingValidatorToDelegation);
|
|
265
|
+
return transaction;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
exports.ValidatorsTransactionsFactory = ValidatorsTransactionsFactory;
|
|
269
|
+
//# sourceMappingURL=validatorsTransactionsFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validatorsTransactionsFactory.js","sourceRoot":"","sources":["../../src/validators/validatorsTransactionsFactory.ts"],"names":[],"mappings":";;;AAAA,gCAAyF;AAEzF,6CAA0C;AAC1C,qDAAkD;AAClD,iDAA0G;AAC1G,qDAAkD;AAElD,yDAAuD;AAEvD;;GAEG;AACH,MAAa,6BAA8B,SAAQ,yBAAW;IAI1D,YAAY,OAAsF;QAC9F,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAChF,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,IAAI,mBAAa,EAAE,CAAC;IAC7C,CA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E,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAAC,CAAC;QAEzF,OAAO,WAAW,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,yDAAyD,CAC3D,MAAe,EACf,OAAkD;QAElD,MAAM,SAAS,GAAG;YACd,qCAAqC;YACrC,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,IAAI,kBAAY,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACvF,CAAC;QAEF,MAAM,WAAW,GAAG,IAAI,yBAAW,CAAC;YAChC,MAAM;YACN,QAAQ,EAAE,iBAAO,CAAC,UAAU,CAAC,6CAAiC,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;YACvF,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;YAC5B,QAAQ,EAAE,EAAE;SACf,CAAC,CAAC;QAEH,IAAI,CAAC,qBAAqB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACnD,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,uCAAuC,CAAC,CAAC;QAEpG,OAAO,WAAW,CAAC;IACvB,CAAC;CACJ;AA5XD,sEA4XC"}
|
package/out/wallet/index.d.ts
CHANGED
package/out/wallet/index.js
CHANGED
|
@@ -20,5 +20,6 @@ __exportStar(require("./userSigner"), exports);
|
|
|
20
20
|
__exportStar(require("./userVerifier"), exports);
|
|
21
21
|
__exportStar(require("./userWallet"), exports);
|
|
22
22
|
__exportStar(require("./validatorKeys"), exports);
|
|
23
|
+
__exportStar(require("./validatorPem"), exports);
|
|
23
24
|
__exportStar(require("./validatorSigner"), exports);
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
package/out/wallet/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wallet/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B;AAC3B,wCAAsB;AACtB,6CAA2B;AAC3B,4CAA0B;AAC1B,+CAA6B;AAC7B,iDAA+B;AAC/B,+CAA6B;AAC7B,kDAAgC;AAChC,oDAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wallet/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B;AAC3B,wCAAsB;AACtB,6CAA2B;AAC3B,4CAA0B;AAC1B,+CAA6B;AAC7B,iDAA+B;AAC/B,+CAA6B;AAC7B,kDAAgC;AAChC,iDAA+B;AAC/B,oDAAkC"}
|
|
@@ -30,7 +30,7 @@ export declare class UserWallet {
|
|
|
30
30
|
static loadSecretKey(filePath: string, password: string, addressIndex?: number): UserSecretKey;
|
|
31
31
|
static decrypt(keyFileObject: any, password: string, addressIndex?: number): UserSecretKey;
|
|
32
32
|
/**
|
|
33
|
-
* Copied from: https://github.com/terradharitri/drt-
|
|
33
|
+
* Copied from: https://github.com/terradharitri/drt-deprecated-core-js/blob/v1.28.0/src/account.js#L42
|
|
34
34
|
* Notes: adjustements (code refactoring, no change in logic), in terms of:
|
|
35
35
|
* - typing (since this is the TypeScript version)
|
|
36
36
|
* - error handling (in line with sdk-core's error system)
|
package/out/wallet/userWallet.js
CHANGED
|
@@ -98,7 +98,7 @@ class UserWallet {
|
|
|
98
98
|
throw new errors_1.Err(`Unknown kind: ${kind}`);
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
|
-
* Copied from: https://github.com/terradharitri/drt-
|
|
101
|
+
* Copied from: https://github.com/terradharitri/drt-deprecated-core-js/blob/v1.28.0/src/account.js#L42
|
|
102
102
|
* Notes: adjustements (code refactoring, no change in logic), in terms of:
|
|
103
103
|
* - typing (since this is the TypeScript version)
|
|
104
104
|
* - error handling (in line with sdk-core's error system)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ValidatorSecretKey } from "../wallet/validatorKeys";
|
|
2
|
+
export declare class ValidatorPEM {
|
|
3
|
+
readonly label: string;
|
|
4
|
+
readonly secretKey: ValidatorSecretKey;
|
|
5
|
+
constructor(label: string, secretKey: ValidatorSecretKey);
|
|
6
|
+
static fromFile(path: string, index?: number): Promise<ValidatorPEM>;
|
|
7
|
+
static fromFileAll(path: string): Promise<ValidatorPEM[]>;
|
|
8
|
+
static fromText(text: string, index?: number): Promise<ValidatorPEM>;
|
|
9
|
+
static fromTextAll(text: string): Promise<ValidatorPEM[]>;
|
|
10
|
+
save(path: string): void;
|
|
11
|
+
toText(): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidatorPEM = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const pemEntry_1 = require("../wallet/pemEntry");
|
|
7
|
+
const validatorKeys_1 = require("../wallet/validatorKeys");
|
|
8
|
+
class ValidatorPEM {
|
|
9
|
+
constructor(label, secretKey) {
|
|
10
|
+
this.label = label;
|
|
11
|
+
this.secretKey = secretKey;
|
|
12
|
+
}
|
|
13
|
+
static async fromFile(path, index = 0) {
|
|
14
|
+
return (await this.fromFileAll(path))[index];
|
|
15
|
+
}
|
|
16
|
+
static async fromFileAll(path) {
|
|
17
|
+
const absPath = path_1.resolve(path);
|
|
18
|
+
const text = fs_1.readFileSync(absPath, "utf-8");
|
|
19
|
+
return await this.fromTextAll(text);
|
|
20
|
+
}
|
|
21
|
+
static async fromText(text, index = 0) {
|
|
22
|
+
return (await ValidatorPEM.fromTextAll(text))[index];
|
|
23
|
+
}
|
|
24
|
+
static async fromTextAll(text) {
|
|
25
|
+
const entries = pemEntry_1.PemEntry.fromTextAll(text);
|
|
26
|
+
const resultItems = [];
|
|
27
|
+
await validatorKeys_1.BLS.initIfNecessary();
|
|
28
|
+
for (const entry of entries) {
|
|
29
|
+
const secretKey = new validatorKeys_1.ValidatorSecretKey(entry.message);
|
|
30
|
+
const item = new ValidatorPEM(entry.label, secretKey);
|
|
31
|
+
resultItems.push(item);
|
|
32
|
+
}
|
|
33
|
+
return resultItems;
|
|
34
|
+
}
|
|
35
|
+
save(path) {
|
|
36
|
+
const absPath = path_1.resolve(path);
|
|
37
|
+
fs_1.writeFileSync(absPath, this.toText(), "utf-8");
|
|
38
|
+
}
|
|
39
|
+
toText() {
|
|
40
|
+
const message = this.secretKey.valueOf();
|
|
41
|
+
return new pemEntry_1.PemEntry(this.label, message).toText();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.ValidatorPEM = ValidatorPEM;
|
|
45
|
+
//# sourceMappingURL=validatorPem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validatorPem.js","sourceRoot":"","sources":["../../src/wallet/validatorPem.ts"],"names":[],"mappings":";;;AAAA,2BAAiD;AACjD,+BAA+B;AAC/B,iDAA8C;AAC9C,2DAAkE;AAElE,MAAa,YAAY;IAIrB,YAAY,KAAa,EAAE,SAA6B;QACpD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAY,EAAE,KAAK,GAAG,CAAC;QACzC,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAY;QACjC,MAAM,OAAO,GAAG,cAAO,CAAC,IAAI,CAAC,CAAC;QAC9B,MAAM,IAAI,GAAG,iBAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5C,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAY,EAAE,KAAK,GAAG,CAAC;QACzC,OAAO,CAAC,MAAM,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAY;QACjC,MAAM,OAAO,GAAG,mBAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,WAAW,GAAmB,EAAE,CAAC;QAEvC,MAAM,mBAAG,CAAC,eAAe,EAAE,CAAC;QAC5B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE;YACzB,MAAM,SAAS,GAAG,IAAI,kCAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACxD,MAAM,IAAI,GAAG,IAAI,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YACtD,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC1B;QAED,OAAO,WAAW,CAAC;IACvB,CAAC;IAED,IAAI,CAAC,IAAY;QACb,MAAM,OAAO,GAAG,cAAO,CAAC,IAAI,CAAC,CAAC;QAC9B,kBAAa,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IAED,MAAM;QACF,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzC,OAAO,IAAI,mBAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;IACtD,CAAC;CACJ;AA9CD,oCA8CC"}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import { ValidatorPublicKey, ValidatorSecretKey } from "./validatorKeys";
|
|
2
3
|
/**
|
|
3
4
|
* Validator signer (BLS signer)
|
|
4
5
|
*/
|
|
5
6
|
export declare class ValidatorSigner {
|
|
7
|
+
private readonly secretKey;
|
|
8
|
+
constructor(secretKey: ValidatorSecretKey);
|
|
6
9
|
/**
|
|
10
|
+
* * @deprecated This method will be deprecated! Use the sign method directly.
|
|
7
11
|
* Signs a message.
|
|
8
12
|
*/
|
|
9
|
-
signUsingPem(pemText: string, pemIndex: number | undefined, signable: Buffer | Uint8Array): Promise<Uint8Array>;
|
|
13
|
+
static signUsingPem(pemText: string, pemIndex: number | undefined, signable: Buffer | Uint8Array): Promise<Uint8Array>;
|
|
14
|
+
static fromPemFile(path: string, index?: number): Promise<ValidatorSigner>;
|
|
15
|
+
sign(data: Uint8Array): Uint8Array;
|
|
16
|
+
private trySign;
|
|
17
|
+
getPubkey(): ValidatorPublicKey;
|
|
10
18
|
}
|
|
@@ -3,14 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ValidatorSigner = void 0;
|
|
4
4
|
const errors_1 = require("../core/errors");
|
|
5
5
|
const validatorKeys_1 = require("./validatorKeys");
|
|
6
|
+
const validatorPem_1 = require("./validatorPem");
|
|
6
7
|
/**
|
|
7
8
|
* Validator signer (BLS signer)
|
|
8
9
|
*/
|
|
9
10
|
class ValidatorSigner {
|
|
11
|
+
constructor(secretKey) {
|
|
12
|
+
this.secretKey = secretKey;
|
|
13
|
+
}
|
|
10
14
|
/**
|
|
15
|
+
* * @deprecated This method will be deprecated! Use the sign method directly.
|
|
11
16
|
* Signs a message.
|
|
12
17
|
*/
|
|
13
|
-
async signUsingPem(pemText, pemIndex = 0, signable) {
|
|
18
|
+
static async signUsingPem(pemText, pemIndex = 0, signable) {
|
|
14
19
|
await validatorKeys_1.BLS.initIfNecessary();
|
|
15
20
|
try {
|
|
16
21
|
let secretKey = validatorKeys_1.ValidatorSecretKey.fromPem(pemText, pemIndex);
|
|
@@ -20,6 +25,24 @@ class ValidatorSigner {
|
|
|
20
25
|
throw new errors_1.ErrSignerCannotSign(err);
|
|
21
26
|
}
|
|
22
27
|
}
|
|
28
|
+
static async fromPemFile(path, index = 0) {
|
|
29
|
+
const secretKey = (await validatorPem_1.ValidatorPEM.fromFile(path, index)).secretKey;
|
|
30
|
+
return new ValidatorSigner(secretKey);
|
|
31
|
+
}
|
|
32
|
+
sign(data) {
|
|
33
|
+
try {
|
|
34
|
+
return this.trySign(data);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
throw new errors_1.ErrSignerCannotSign(err);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
trySign(data) {
|
|
41
|
+
return this.secretKey.sign(data);
|
|
42
|
+
}
|
|
43
|
+
getPubkey() {
|
|
44
|
+
return this.secretKey.generatePublicKey();
|
|
45
|
+
}
|
|
23
46
|
}
|
|
24
47
|
exports.ValidatorSigner = ValidatorSigner;
|
|
25
48
|
//# sourceMappingURL=validatorSigner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validatorSigner.js","sourceRoot":"","sources":["../../src/wallet/validatorSigner.ts"],"names":[],"mappings":";;;AAAA,2CAAqD;AACrD,
|
|
1
|
+
{"version":3,"file":"validatorSigner.js","sourceRoot":"","sources":["../../src/wallet/validatorSigner.ts"],"names":[],"mappings":";;;AAAA,2CAAqD;AACrD,mDAA8E;AAC9E,iDAA8C;AAE9C;;GAEG;AACH,MAAa,eAAe;IAGxB,YAAY,SAA6B;QACrC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,YAAY,CACrB,OAAe,EACf,WAAmB,CAAC,EACpB,QAA6B;QAE7B,MAAM,mBAAG,CAAC,eAAe,EAAE,CAAC;QAE5B,IAAI;YACA,IAAI,SAAS,GAAG,kCAAkB,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YAC9D,OAAO,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACnC;QAAC,OAAO,GAAQ,EAAE;YACf,MAAM,IAAI,4BAAmB,CAAC,GAAG,CAAC,CAAC;SACtC;IACL,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAY,EAAE,KAAK,GAAG,CAAC;QAC5C,MAAM,SAAS,GAAG,CAAC,MAAM,2BAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QACvE,OAAO,IAAI,eAAe,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,CAAC,IAAgB;QACjB,IAAI;YACA,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC7B;QAAC,OAAO,GAAG,EAAE;YACV,MAAM,IAAI,4BAAmB,CAAC,GAAY,CAAC,CAAC;SAC/C;IACL,CAAC;IAEO,OAAO,CAAC,IAAgB;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,SAAS;QACL,OAAO,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC;IAC9C,CAAC;CACJ;AA9CD,0CA8CC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sravankumar02/sdk-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "DharitrI SDK for JavaScript and TypeScript",
|
|
5
5
|
"author": "DharitrI",
|
|
6
6
|
"homepage": "https://dharitri.org",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"prepare": "npm run compile"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@terradharitri/sdk-transaction-decoder": "0.0.7",
|
|
41
40
|
"@noble/ed25519": "1.7.3",
|
|
42
41
|
"@noble/hashes": "1.3.0",
|
|
42
|
+
"@terradharitri/sdk-transaction-decoder": "0.0.7",
|
|
43
43
|
"bech32": "1.1.4",
|
|
44
44
|
"blake2b": "2.1.3",
|
|
45
45
|
"buffer": "6.0.3",
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
"protobufjs": "^7.2.6"
|
|
78
78
|
},
|
|
79
79
|
"optionalDependencies": {
|
|
80
|
-
"@terradharitri/sdk-bls-wasm": "0.0.3",
|
|
81
|
-
"axios": "^1.
|
|
82
|
-
"bip39": "3.1.0"
|
|
80
|
+
"@terradharitri/sdk-bls-wasm": "^0.0.3",
|
|
81
|
+
"axios": "^1.13.5",
|
|
82
|
+
"bip39": "^3.1.0"
|
|
83
83
|
}
|
|
84
84
|
}
|
package/out/abi/code.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
* * @deprecated Use the bytecode directly
|
|
4
|
-
* Bytecode of a Smart Contract, as an abstraction.
|
|
5
|
-
*/
|
|
6
|
-
export declare class Code {
|
|
7
|
-
private readonly hex;
|
|
8
|
-
private constructor();
|
|
9
|
-
/**
|
|
10
|
-
* Creates a Code object from a buffer (sequence of bytes).
|
|
11
|
-
*/
|
|
12
|
-
static fromBuffer(code: Buffer): Code;
|
|
13
|
-
/**
|
|
14
|
-
* Creates a Code object from a hex-encoded string.
|
|
15
|
-
*/
|
|
16
|
-
static fromHex(hex: string): Code;
|
|
17
|
-
/**
|
|
18
|
-
* Returns the bytecode as a hex-encoded string.
|
|
19
|
-
*/
|
|
20
|
-
toString(): string;
|
|
21
|
-
valueOf(): Buffer;
|
|
22
|
-
computeHash(): Buffer;
|
|
23
|
-
}
|
package/out/abi/code.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Code = void 0;
|
|
4
|
-
const createHasher = require("blake2b");
|
|
5
|
-
const CODE_HASH_LENGTH = 32;
|
|
6
|
-
/**
|
|
7
|
-
* * @deprecated Use the bytecode directly
|
|
8
|
-
* Bytecode of a Smart Contract, as an abstraction.
|
|
9
|
-
*/
|
|
10
|
-
class Code {
|
|
11
|
-
constructor(hex) {
|
|
12
|
-
this.hex = hex;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Creates a Code object from a buffer (sequence of bytes).
|
|
16
|
-
*/
|
|
17
|
-
static fromBuffer(code) {
|
|
18
|
-
return new Code(code.toString("hex"));
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Creates a Code object from a hex-encoded string.
|
|
22
|
-
*/
|
|
23
|
-
static fromHex(hex) {
|
|
24
|
-
return new Code(hex);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Returns the bytecode as a hex-encoded string.
|
|
28
|
-
*/
|
|
29
|
-
toString() {
|
|
30
|
-
return this.hex;
|
|
31
|
-
}
|
|
32
|
-
valueOf() {
|
|
33
|
-
return Buffer.from(this.hex, "hex");
|
|
34
|
-
}
|
|
35
|
-
computeHash() {
|
|
36
|
-
const hash = createHasher(CODE_HASH_LENGTH).update(this.valueOf()).digest();
|
|
37
|
-
return Buffer.from(hash);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.Code = Code;
|
|
41
|
-
//# sourceMappingURL=code.js.map
|
package/out/abi/code.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code.js","sourceRoot":"","sources":["../../src/abi/code.ts"],"names":[],"mappings":";;;AAAA,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACxC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B;;;GAGG;AACH,MAAa,IAAI;IAGb,YAAoB,GAAW;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,IAAY;QAC1B,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,GAAW;QACtB,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,QAAQ;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED,OAAO;QACH,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,WAAW;QACP,MAAM,IAAI,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;QAE5E,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;CACJ;AArCD,oBAqCC"}
|