@obolnetwork/obol-sdk 2.11.4 → 2.11.5-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/dist/browser/src/index.js +18280 -0
- package/dist/browser/src/index.js.map +1 -0
- package/dist/cjs/src/index.js +17470 -382
- package/dist/cjs/src/index.js.map +1 -0
- package/dist/esm/src/index.js +17437 -361
- package/dist/esm/src/index.js.map +1 -0
- package/dist/types/src/constants.d.ts +1 -2
- package/dist/types/src/eoa/eoaHelpers.d.ts +1 -1
- package/dist/types/src/exits/verificationHelpers.d.ts +0 -2
- package/dist/types/src/incentives/incentiveHelpers.d.ts +1 -1
- package/dist/types/src/splits/splitHelpers.d.ts +3 -3
- package/dist/types/src/utils.d.ts +2 -2
- package/dist/types/src/verification/common.d.ts +0 -2
- package/dist/types/src/verification/signature-validator.d.ts +4 -4
- package/dist/types/src/verification/v1.10.0.d.ts +1 -1
- package/dist/types/src/verification/v1.6.0.d.ts +1 -1
- package/dist/types/src/verification/v1.7.0.d.ts +1 -1
- package/dist/types/src/verification/v1.8.0.d.ts +1 -1
- package/dist/types/test/client/methods.spec.d.ts +17 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -0
- package/dist/types/tsup.config.d.ts +2 -0
- package/package.json +96 -58
- package/dist/cjs/package.json +0 -139
- package/dist/cjs/src/abi/BatchDeposit.js +0 -120
- package/dist/cjs/src/abi/MerkleDistributorWithDeadline.js +0 -73
- package/dist/cjs/src/abi/Multicall3.js +0 -253
- package/dist/cjs/src/abi/OVM.js +0 -627
- package/dist/cjs/src/abi/OWR.js +0 -304
- package/dist/cjs/src/abi/SplitMain.js +0 -929
- package/dist/cjs/src/abi/splitV2FactoryAbi.js +0 -420
- package/dist/cjs/src/ajv.js +0 -136
- package/dist/cjs/src/base.js +0 -42
- package/dist/cjs/src/bytecodes.js +0 -19
- package/dist/cjs/src/constants.js +0 -272
- package/dist/cjs/src/eoa/eoa.js +0 -132
- package/dist/cjs/src/eoa/eoaHelpers.js +0 -82
- package/dist/cjs/src/errors.js +0 -11
- package/dist/cjs/src/exits/ethUtils.js +0 -57
- package/dist/cjs/src/exits/exit.js +0 -502
- package/dist/cjs/src/exits/verificationHelpers.js +0 -86
- package/dist/cjs/src/incentives/incentiveHelpers.js +0 -39
- package/dist/cjs/src/incentives/incentives.js +0 -119
- package/dist/cjs/src/schema.js +0 -352
- package/dist/cjs/src/services.js +0 -33
- package/dist/cjs/src/splits/splitHelpers.js +0 -571
- package/dist/cjs/src/splits/splits.js +0 -366
- package/dist/cjs/src/types.js +0 -29
- package/dist/cjs/src/utils.js +0 -77
- package/dist/cjs/src/verification/common.js +0 -355
- package/dist/cjs/src/verification/signature-validator.js +0 -73
- package/dist/cjs/src/verification/sszTypes.js +0 -69
- package/dist/cjs/src/verification/termsAndConditions.js +0 -40
- package/dist/cjs/src/verification/v1.10.0.js +0 -146
- package/dist/cjs/src/verification/v1.6.0.js +0 -149
- package/dist/cjs/src/verification/v1.7.0.js +0 -173
- package/dist/cjs/src/verification/v1.8.0.js +0 -196
- package/dist/cjs/test/client/ajv.spec.js +0 -320
- package/dist/cjs/test/client/methods.spec.js +0 -418
- package/dist/cjs/test/eoa/eoa.spec.js +0 -176
- package/dist/cjs/test/exit/ethUtils.spec.js +0 -83
- package/dist/cjs/test/exit/exit.spec.js +0 -399
- package/dist/cjs/test/exit/verificationHelpers.spec.js +0 -68
- package/dist/cjs/test/fixtures.js +0 -896
- package/dist/cjs/test/incentives/incentives.spec.js +0 -202
- package/dist/cjs/test/splits/splits.spec.js +0 -402
- package/dist/esm/package.json +0 -139
- package/dist/esm/src/abi/BatchDeposit.js +0 -117
- package/dist/esm/src/abi/MerkleDistributorWithDeadline.js +0 -70
- package/dist/esm/src/abi/Multicall3.js +0 -250
- package/dist/esm/src/abi/OVM.js +0 -624
- package/dist/esm/src/abi/OWR.js +0 -301
- package/dist/esm/src/abi/SplitMain.js +0 -926
- package/dist/esm/src/abi/splitV2FactoryAbi.js +0 -417
- package/dist/esm/src/ajv.js +0 -129
- package/dist/esm/src/base.js +0 -38
- package/dist/esm/src/bytecodes.js +0 -16
- package/dist/esm/src/constants.js +0 -238
- package/dist/esm/src/eoa/eoa.js +0 -128
- package/dist/esm/src/eoa/eoaHelpers.js +0 -77
- package/dist/esm/src/errors.js +0 -7
- package/dist/esm/src/exits/ethUtils.js +0 -52
- package/dist/esm/src/exits/exit.js +0 -475
- package/dist/esm/src/exits/verificationHelpers.js +0 -81
- package/dist/esm/src/incentives/incentiveHelpers.js +0 -34
- package/dist/esm/src/incentives/incentives.js +0 -115
- package/dist/esm/src/schema.js +0 -349
- package/dist/esm/src/services.js +0 -29
- package/dist/esm/src/splits/splitHelpers.js +0 -554
- package/dist/esm/src/splits/splits.js +0 -362
- package/dist/esm/src/types.js +0 -26
- package/dist/esm/src/utils.js +0 -68
- package/dist/esm/src/verification/common.js +0 -319
- package/dist/esm/src/verification/signature-validator.js +0 -64
- package/dist/esm/src/verification/sszTypes.js +0 -64
- package/dist/esm/src/verification/termsAndConditions.js +0 -33
- package/dist/esm/src/verification/v1.10.0.js +0 -140
- package/dist/esm/src/verification/v1.6.0.js +0 -142
- package/dist/esm/src/verification/v1.7.0.js +0 -166
- package/dist/esm/src/verification/v1.8.0.js +0 -189
- package/dist/esm/test/client/ajv.spec.js +0 -318
- package/dist/esm/test/client/methods.spec.js +0 -393
- package/dist/esm/test/eoa/eoa.spec.js +0 -174
- package/dist/esm/test/exit/ethUtils.spec.js +0 -81
- package/dist/esm/test/exit/exit.spec.js +0 -374
- package/dist/esm/test/exit/verificationHelpers.spec.js +0 -66
- package/dist/esm/test/fixtures.js +0 -893
- package/dist/esm/test/incentives/incentives.spec.js +0 -177
- package/dist/esm/test/splits/splits.spec.js +0 -400
- package/dist/types/src/verification/termsAndConditions.d.ts +0 -1
- package/src/abi/BatchDeposit.ts +0 -117
- package/src/abi/MerkleDistributorWithDeadline.ts +0 -70
- package/src/abi/Multicall3.ts +0 -250
- package/src/abi/OVM.ts +0 -624
- package/src/abi/OWR.ts +0 -302
- package/src/abi/SplitMain.ts +0 -927
- package/src/abi/splitV2FactoryAbi.ts +0 -417
- package/src/ajv.ts +0 -191
- package/src/base.ts +0 -54
- package/src/bytecodes.ts +0 -32
- package/src/constants.ts +0 -309
- package/src/eoa/eoa.ts +0 -153
- package/src/eoa/eoaHelpers.ts +0 -112
- package/src/errors.ts +0 -8
- package/src/exits/ethUtils.ts +0 -49
- package/src/exits/exit.ts +0 -661
- package/src/exits/verificationHelpers.ts +0 -110
- package/src/incentives/incentiveHelpers.ts +0 -55
- package/src/incentives/incentives.ts +0 -153
- package/src/index.ts +0 -614
- package/src/schema.ts +0 -376
- package/src/services.ts +0 -24
- package/src/splits/splitHelpers.ts +0 -1032
- package/src/splits/splits.ts +0 -504
- package/src/types.ts +0 -687
- package/src/utils.ts +0 -88
- package/src/verification/common.ts +0 -532
- package/src/verification/signature-validator.ts +0 -103
- package/src/verification/sszTypes.ts +0 -88
- package/src/verification/termsAndConditions.ts +0 -32
- package/src/verification/v1.10.0.ts +0 -245
- package/src/verification/v1.6.0.ts +0 -256
- package/src/verification/v1.7.0.ts +0 -309
- package/src/verification/v1.8.0.ts +0 -340
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { isContractAvailable } from '../utils';
|
|
11
|
-
import { FORK_NAMES, } from '../types';
|
|
12
|
-
import { claimIncentivesFromMerkleDistributor, isClaimedFromMerkleDistributor, } from './incentiveHelpers';
|
|
13
|
-
import { DEFAULT_BASE_VERSION } from '../constants';
|
|
14
|
-
/**
|
|
15
|
-
* Incentives can be used for fetching and claiming Obol incentives.
|
|
16
|
-
* @class
|
|
17
|
-
* @internal Access it through Client.incentives.
|
|
18
|
-
* @example
|
|
19
|
-
* const obolClient = new Client(config);
|
|
20
|
-
* await obolClient.incentives.claimIncentives(address);
|
|
21
|
-
*/
|
|
22
|
-
export class Incentives {
|
|
23
|
-
constructor(signer, chainId, request, provider) {
|
|
24
|
-
this.signer = signer;
|
|
25
|
-
this.chainId = chainId;
|
|
26
|
-
this.request = request;
|
|
27
|
-
this.provider = provider;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Claims Obol incentives from a Merkle Distributor contract using an address.
|
|
31
|
-
*
|
|
32
|
-
* This method automatically fetches incentive data and verifies whether the incentives have already been claimed.
|
|
33
|
-
* If `txHash` is `null`, it indicates that the incentives were already claimed.
|
|
34
|
-
*
|
|
35
|
-
* Note: This method is not yet enabled and will throw an error if called.
|
|
36
|
-
*
|
|
37
|
-
* @remarks
|
|
38
|
-
* **⚠️ Important:** If you're storing the private key in an `.env` file, ensure it is securely managed
|
|
39
|
-
* and not pushed to version control.
|
|
40
|
-
*
|
|
41
|
-
* @param {string} address - The address to claim incentives for
|
|
42
|
-
* @returns {Promise<ClaimIncentivesResponse>} The transaction hash or already claimed status
|
|
43
|
-
* @throws Will throw an error if the incentives data is not found or the claim fails
|
|
44
|
-
*
|
|
45
|
-
* An example of how to use claimIncentives:
|
|
46
|
-
* [obolClient](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L281)
|
|
47
|
-
*/
|
|
48
|
-
claimIncentives(address) {
|
|
49
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
if (!this.signer) {
|
|
51
|
-
throw new Error('Signer is required in claimIncentives');
|
|
52
|
-
}
|
|
53
|
-
try {
|
|
54
|
-
const incentivesData = yield this.getIncentivesByAddress(address);
|
|
55
|
-
if (!(incentivesData === null || incentivesData === void 0 ? void 0 : incentivesData.contract_address)) {
|
|
56
|
-
throw new Error(`No incentives found for address ${address}`);
|
|
57
|
-
}
|
|
58
|
-
const isContractDeployed = yield isContractAvailable(incentivesData.contract_address, this.provider);
|
|
59
|
-
if (!isContractDeployed) {
|
|
60
|
-
throw new Error(`Merkle Distributor contract is not available at address ${incentivesData.contract_address}`);
|
|
61
|
-
}
|
|
62
|
-
const claimed = yield this.isClaimed(incentivesData.contract_address, incentivesData.index);
|
|
63
|
-
if (claimed) {
|
|
64
|
-
return { txHash: null };
|
|
65
|
-
}
|
|
66
|
-
const { txHash } = yield claimIncentivesFromMerkleDistributor({
|
|
67
|
-
signer: this.signer,
|
|
68
|
-
contractAddress: incentivesData.contract_address,
|
|
69
|
-
index: incentivesData.index,
|
|
70
|
-
operatorAddress: incentivesData.operator_address,
|
|
71
|
-
amount: incentivesData.amount,
|
|
72
|
-
merkleProof: incentivesData.merkle_proof,
|
|
73
|
-
});
|
|
74
|
-
return { txHash };
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
console.log('Error claiming incentives:', error);
|
|
78
|
-
throw new Error(`Failed to claim incentives: ${error.message}`);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Read isClaimed.
|
|
84
|
-
*
|
|
85
|
-
* @param {ETH_ADDRESS} contractAddress - Address of the Merkle Distributor Contract
|
|
86
|
-
* @param {ETH_ADDRESS} index - operator index in merkle tree
|
|
87
|
-
* @returns {Promise<boolean>} true if incentives are already claime
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* An example of how to use isClaimed:
|
|
91
|
-
* [obolClient](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L266)
|
|
92
|
-
*/
|
|
93
|
-
isClaimed(contractAddress, index) {
|
|
94
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
return yield isClaimedFromMerkleDistributor(contractAddress, index, this.provider);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* @param address - Operator address
|
|
100
|
-
* @returns {Promise<IncentivesType>} The matched incentives from DB
|
|
101
|
-
* @throws On not found if address not found.
|
|
102
|
-
*
|
|
103
|
-
* An example of how to use getIncentivesByAddress:
|
|
104
|
-
* [obolClient](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L250)
|
|
105
|
-
*/
|
|
106
|
-
getIncentivesByAddress(address) {
|
|
107
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
const network = FORK_NAMES[this.chainId];
|
|
109
|
-
const incentives = yield this.request(`/${DEFAULT_BASE_VERSION}/address/incentives/${network}/${address}`, {
|
|
110
|
-
method: 'GET',
|
|
111
|
-
});
|
|
112
|
-
return incentives;
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
package/dist/esm/src/schema.js
DELETED
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
import { ZeroAddress } from 'ethers';
|
|
2
|
-
import { DEFAULT_RETROACTIVE_FUNDING_REWARDS_ONLY_SPLIT, DEFAULT_RETROACTIVE_FUNDING_TOTAL_SPLIT, PRINCIPAL_THRESHOLD, } from './constants';
|
|
3
|
-
import { VALID_DEPOSIT_AMOUNTS, VALID_NON_COMPOUNDING_AMOUNTS } from './ajv';
|
|
4
|
-
export const operatorPayloadSchema = {
|
|
5
|
-
type: 'object',
|
|
6
|
-
properties: {
|
|
7
|
-
version: { type: 'string' },
|
|
8
|
-
enr: { type: 'string' },
|
|
9
|
-
},
|
|
10
|
-
required: ['version', 'enr'],
|
|
11
|
-
};
|
|
12
|
-
export const definitionSchema = {
|
|
13
|
-
type: 'object',
|
|
14
|
-
properties: {
|
|
15
|
-
name: { type: 'string' },
|
|
16
|
-
operators: {
|
|
17
|
-
type: 'array',
|
|
18
|
-
minItems: 4,
|
|
19
|
-
items: {
|
|
20
|
-
type: 'object',
|
|
21
|
-
properties: {
|
|
22
|
-
address: {
|
|
23
|
-
type: 'string',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
required: ['address'],
|
|
27
|
-
},
|
|
28
|
-
validateUniqueAddresses: true,
|
|
29
|
-
},
|
|
30
|
-
validators: {
|
|
31
|
-
type: 'array',
|
|
32
|
-
minItems: 1,
|
|
33
|
-
items: {
|
|
34
|
-
type: 'object',
|
|
35
|
-
properties: {
|
|
36
|
-
fee_recipient_address: {
|
|
37
|
-
type: 'string',
|
|
38
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
39
|
-
},
|
|
40
|
-
withdrawal_address: {
|
|
41
|
-
type: 'string',
|
|
42
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
required: ['fee_recipient_address', 'withdrawal_address'],
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
deposit_amounts: {
|
|
49
|
-
type: ['array', 'null'],
|
|
50
|
-
items: {
|
|
51
|
-
type: 'string',
|
|
52
|
-
pattern: '^[0-9]+$',
|
|
53
|
-
},
|
|
54
|
-
if: {
|
|
55
|
-
$data: '1/compounding',
|
|
56
|
-
},
|
|
57
|
-
then: {
|
|
58
|
-
items: {
|
|
59
|
-
enum: VALID_DEPOSIT_AMOUNTS,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
else: {
|
|
63
|
-
items: {
|
|
64
|
-
enum: VALID_NON_COMPOUNDING_AMOUNTS,
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
default: null,
|
|
68
|
-
},
|
|
69
|
-
compounding: {
|
|
70
|
-
type: 'boolean',
|
|
71
|
-
default: false,
|
|
72
|
-
},
|
|
73
|
-
target_gas_limit: {
|
|
74
|
-
type: 'number',
|
|
75
|
-
minimum: 1,
|
|
76
|
-
default: 36000000,
|
|
77
|
-
},
|
|
78
|
-
consensus_protocol: {
|
|
79
|
-
type: 'string',
|
|
80
|
-
enum: ['qbft', ''],
|
|
81
|
-
default: '',
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
required: ['name', 'operators', 'validators'],
|
|
85
|
-
};
|
|
86
|
-
export const totalSplitterPayloadSchema = {
|
|
87
|
-
type: 'object',
|
|
88
|
-
properties: {
|
|
89
|
-
splitRecipients: {
|
|
90
|
-
type: 'array',
|
|
91
|
-
items: {
|
|
92
|
-
type: 'object',
|
|
93
|
-
properties: {
|
|
94
|
-
account: {
|
|
95
|
-
type: 'string',
|
|
96
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
97
|
-
},
|
|
98
|
-
percentAllocation: { type: 'number' },
|
|
99
|
-
},
|
|
100
|
-
required: ['account', 'percentAllocation'],
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
ObolRAFSplit: {
|
|
104
|
-
type: 'number',
|
|
105
|
-
minimum: DEFAULT_RETROACTIVE_FUNDING_TOTAL_SPLIT,
|
|
106
|
-
default: DEFAULT_RETROACTIVE_FUNDING_TOTAL_SPLIT,
|
|
107
|
-
},
|
|
108
|
-
distributorFee: {
|
|
109
|
-
type: 'number',
|
|
110
|
-
maximum: 10,
|
|
111
|
-
multipleOf: 0.01,
|
|
112
|
-
default: 0,
|
|
113
|
-
},
|
|
114
|
-
controllerAddress: {
|
|
115
|
-
type: 'string',
|
|
116
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
117
|
-
default: ZeroAddress,
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
validateTotalSplitRecipients: true,
|
|
121
|
-
required: ['splitRecipients'],
|
|
122
|
-
};
|
|
123
|
-
export const rewardsSplitterPayloadSchema = {
|
|
124
|
-
type: 'object',
|
|
125
|
-
properties: Object.assign(Object.assign({}, totalSplitterPayloadSchema.properties), { ObolRAFSplit: {
|
|
126
|
-
type: 'number',
|
|
127
|
-
minimum: DEFAULT_RETROACTIVE_FUNDING_REWARDS_ONLY_SPLIT,
|
|
128
|
-
default: DEFAULT_RETROACTIVE_FUNDING_REWARDS_ONLY_SPLIT,
|
|
129
|
-
}, recoveryAddress: {
|
|
130
|
-
type: 'string',
|
|
131
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
132
|
-
default: ZeroAddress,
|
|
133
|
-
}, etherAmount: { type: 'number' }, principalRecipient: {
|
|
134
|
-
type: 'string',
|
|
135
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
136
|
-
} }),
|
|
137
|
-
validateRewardsSplitRecipients: true,
|
|
138
|
-
required: ['splitRecipients', 'principalRecipient', 'etherAmount'],
|
|
139
|
-
};
|
|
140
|
-
export const ovmBaseSplitPayload = {
|
|
141
|
-
rewardSplitRecipients: {
|
|
142
|
-
type: 'array',
|
|
143
|
-
items: {
|
|
144
|
-
type: 'object',
|
|
145
|
-
properties: {
|
|
146
|
-
address: {
|
|
147
|
-
type: 'string',
|
|
148
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
149
|
-
},
|
|
150
|
-
percentAllocation: { type: 'number' },
|
|
151
|
-
},
|
|
152
|
-
required: ['address', 'percentAllocation'],
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
OVMOwnerAddress: {
|
|
156
|
-
type: 'string',
|
|
157
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
158
|
-
},
|
|
159
|
-
splitOwnerAddress: {
|
|
160
|
-
type: 'string',
|
|
161
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
162
|
-
default: ZeroAddress,
|
|
163
|
-
},
|
|
164
|
-
principalThreshold: {
|
|
165
|
-
type: 'number',
|
|
166
|
-
minimum: 16,
|
|
167
|
-
default: PRINCIPAL_THRESHOLD,
|
|
168
|
-
},
|
|
169
|
-
distributorFeePercent: {
|
|
170
|
-
type: 'number',
|
|
171
|
-
minimum: 0,
|
|
172
|
-
maximum: 10,
|
|
173
|
-
default: 0,
|
|
174
|
-
},
|
|
175
|
-
};
|
|
176
|
-
export const ovmRewardsSplitPayloadSchema = {
|
|
177
|
-
type: 'object',
|
|
178
|
-
properties: Object.assign(Object.assign({}, ovmBaseSplitPayload), { principalRecipient: {
|
|
179
|
-
type: 'string',
|
|
180
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
181
|
-
} }),
|
|
182
|
-
validateOVMRewardsSplitRecipients: true,
|
|
183
|
-
required: ['rewardSplitRecipients', 'OVMOwnerAddress', 'principalRecipient'],
|
|
184
|
-
};
|
|
185
|
-
export const ovmTotalSplitPayloadSchema = {
|
|
186
|
-
type: 'object',
|
|
187
|
-
properties: Object.assign(Object.assign({}, ovmBaseSplitPayload), { principalSplitRecipients: {
|
|
188
|
-
type: 'array',
|
|
189
|
-
items: {
|
|
190
|
-
type: 'object',
|
|
191
|
-
properties: {
|
|
192
|
-
address: {
|
|
193
|
-
type: 'string',
|
|
194
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
195
|
-
},
|
|
196
|
-
percentAllocation: { type: 'number' },
|
|
197
|
-
},
|
|
198
|
-
required: ['address', 'percentAllocation'],
|
|
199
|
-
},
|
|
200
|
-
} }),
|
|
201
|
-
validateOVMRewardsSplitRecipients: true,
|
|
202
|
-
validateOVMTotalSplitRecipients: true,
|
|
203
|
-
required: [
|
|
204
|
-
'rewardSplitRecipients',
|
|
205
|
-
'principalSplitRecipients',
|
|
206
|
-
'OVMOwnerAddress',
|
|
207
|
-
],
|
|
208
|
-
};
|
|
209
|
-
export const ovmRequestWithdrawalPayloadSchema = {
|
|
210
|
-
type: 'object',
|
|
211
|
-
properties: {
|
|
212
|
-
withdrawalFees: {
|
|
213
|
-
type: 'string',
|
|
214
|
-
pattern: '^[0-9]+$',
|
|
215
|
-
},
|
|
216
|
-
ovmAddress: {
|
|
217
|
-
type: 'string',
|
|
218
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
219
|
-
},
|
|
220
|
-
pubKeys: {
|
|
221
|
-
type: 'array',
|
|
222
|
-
minItems: 1,
|
|
223
|
-
items: {
|
|
224
|
-
type: 'string',
|
|
225
|
-
pattern: '^0x[a-fA-F0-9]{96}$', // 48 bytes = 96 hex chars + 0x prefix
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
amounts: {
|
|
229
|
-
type: 'array',
|
|
230
|
-
minItems: 1,
|
|
231
|
-
items: {
|
|
232
|
-
type: 'string',
|
|
233
|
-
pattern: '^[0-9]+$',
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
validateOVMRequestWithdrawalPayload: true,
|
|
238
|
-
required: ['ovmAddress', 'pubKeys', 'amounts', 'withdrawalFees'],
|
|
239
|
-
};
|
|
240
|
-
export const eoaWithdrawalPayloadSchema = {
|
|
241
|
-
type: 'object',
|
|
242
|
-
properties: {
|
|
243
|
-
pubkey: {
|
|
244
|
-
type: 'string',
|
|
245
|
-
pattern: '^0x[a-fA-F0-9]{96}$', // 48 bytes = 96 hex chars + 0x prefix
|
|
246
|
-
},
|
|
247
|
-
allocation: {
|
|
248
|
-
type: 'number',
|
|
249
|
-
minimum: 0,
|
|
250
|
-
},
|
|
251
|
-
requiredFee: {
|
|
252
|
-
type: 'string',
|
|
253
|
-
pattern: '^[0-9]+$',
|
|
254
|
-
},
|
|
255
|
-
},
|
|
256
|
-
required: ['pubkey', 'allocation', 'requiredFee'],
|
|
257
|
-
};
|
|
258
|
-
export const ovmDepositPayloadSchema = {
|
|
259
|
-
type: 'object',
|
|
260
|
-
properties: {
|
|
261
|
-
ovmAddress: {
|
|
262
|
-
type: 'string',
|
|
263
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
264
|
-
},
|
|
265
|
-
deposits: {
|
|
266
|
-
type: 'array',
|
|
267
|
-
minItems: 1,
|
|
268
|
-
items: {
|
|
269
|
-
type: 'object',
|
|
270
|
-
properties: {
|
|
271
|
-
pubkey: {
|
|
272
|
-
type: 'string',
|
|
273
|
-
pattern: '^0x[a-fA-F0-9]{96}$',
|
|
274
|
-
},
|
|
275
|
-
withdrawal_credentials: {
|
|
276
|
-
type: 'string',
|
|
277
|
-
pattern: '^0x[a-fA-F0-9]{64}$',
|
|
278
|
-
description: '32 bytes withdrawal credentials',
|
|
279
|
-
},
|
|
280
|
-
signature: {
|
|
281
|
-
type: 'string',
|
|
282
|
-
pattern: '^0x[a-fA-F0-9]{192}$',
|
|
283
|
-
description: '96 bytes signature (190 hex chars + 0x prefix)',
|
|
284
|
-
},
|
|
285
|
-
deposit_data_root: {
|
|
286
|
-
type: 'string',
|
|
287
|
-
pattern: '^0x[a-fA-F0-9]{64}$', // 32 bytes = 64 hex chars + 0x prefix
|
|
288
|
-
},
|
|
289
|
-
amount: {
|
|
290
|
-
type: 'string',
|
|
291
|
-
pattern: '^[0-9]+$',
|
|
292
|
-
},
|
|
293
|
-
},
|
|
294
|
-
required: [
|
|
295
|
-
'pubkey',
|
|
296
|
-
'withdrawal_credentials',
|
|
297
|
-
'signature',
|
|
298
|
-
'deposit_data_root',
|
|
299
|
-
'amount',
|
|
300
|
-
],
|
|
301
|
-
},
|
|
302
|
-
},
|
|
303
|
-
},
|
|
304
|
-
required: ['ovmAddress', 'deposits'],
|
|
305
|
-
};
|
|
306
|
-
export const eoaDepositPayloadSchema = {
|
|
307
|
-
type: 'object',
|
|
308
|
-
properties: {
|
|
309
|
-
deposits: {
|
|
310
|
-
type: 'array',
|
|
311
|
-
minItems: 1,
|
|
312
|
-
items: {
|
|
313
|
-
type: 'object',
|
|
314
|
-
properties: {
|
|
315
|
-
pubkey: {
|
|
316
|
-
type: 'string',
|
|
317
|
-
pattern: '^0x[a-fA-F0-9]{96}$',
|
|
318
|
-
},
|
|
319
|
-
withdrawal_credentials: {
|
|
320
|
-
type: 'string',
|
|
321
|
-
pattern: '^0x[a-fA-F0-9]{64}$',
|
|
322
|
-
description: '32 bytes withdrawal credentials',
|
|
323
|
-
},
|
|
324
|
-
signature: {
|
|
325
|
-
type: 'string',
|
|
326
|
-
pattern: '^0x[a-fA-F0-9]{192}$',
|
|
327
|
-
description: '96 bytes signature (190 hex chars + 0x prefix)',
|
|
328
|
-
},
|
|
329
|
-
deposit_data_root: {
|
|
330
|
-
type: 'string',
|
|
331
|
-
pattern: '^0x[a-fA-F0-9]{64}$', // 32 bytes = 64 hex chars + 0x prefix
|
|
332
|
-
},
|
|
333
|
-
amount: {
|
|
334
|
-
type: 'string',
|
|
335
|
-
pattern: '^[0-9]+$',
|
|
336
|
-
},
|
|
337
|
-
},
|
|
338
|
-
required: [
|
|
339
|
-
'pubkey',
|
|
340
|
-
'withdrawal_credentials',
|
|
341
|
-
'signature',
|
|
342
|
-
'deposit_data_root',
|
|
343
|
-
'amount',
|
|
344
|
-
],
|
|
345
|
-
},
|
|
346
|
-
},
|
|
347
|
-
},
|
|
348
|
-
required: ['deposits'],
|
|
349
|
-
};
|
package/dist/esm/src/services.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { isValidClusterLock } from './verification/common.js';
|
|
11
|
-
/**
|
|
12
|
-
* Verifies Cluster Lock's validity.
|
|
13
|
-
* @param lock - cluster lock
|
|
14
|
-
* @param safeRpcUrl - optional safeRpcUrl for safe wallet verification
|
|
15
|
-
* @returns {Promise<{ result: boolean }> } boolean result to indicate if lock is valid
|
|
16
|
-
* @throws on missing keys or values.
|
|
17
|
-
*
|
|
18
|
-
* An example of how to use validateClusterLock:
|
|
19
|
-
* [validateClusterLock](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L127)
|
|
20
|
-
*/
|
|
21
|
-
export const validateClusterLock = (lock, safeRpcUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
try {
|
|
23
|
-
const isLockValid = yield isValidClusterLock(lock, safeRpcUrl);
|
|
24
|
-
return isLockValid;
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
throw err;
|
|
28
|
-
}
|
|
29
|
-
});
|