@reclaimprotocol/attestor-core 5.0.1-beta.2 → 5.0.1-beta.22
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/browser/resources/attestor-browser.min.mjs +4512 -0
- package/lib/avs/abis/avsDirectoryABI.js +338 -341
- package/lib/avs/abis/delegationABI.js +1 -4
- package/lib/avs/abis/registryABI.js +719 -722
- package/lib/avs/client/create-claim-on-avs.js +129 -157
- package/lib/avs/config.js +18 -24
- package/lib/avs/contracts/ReclaimServiceManager.js +1 -0
- package/lib/avs/contracts/common.js +1 -0
- package/lib/avs/contracts/factories/ReclaimServiceManager__factory.js +1139 -1156
- package/lib/avs/contracts/factories/index.js +4 -4
- package/lib/avs/contracts/index.js +2 -6
- package/lib/avs/types/index.js +1 -0
- package/lib/avs/utils/contracts.js +30 -50
- package/lib/avs/utils/register.js +75 -70
- package/lib/avs/utils/tasks.js +38 -45
- package/lib/client/create-claim.js +402 -431
- package/lib/client/tunnels/make-rpc-tcp-tunnel.js +46 -48
- package/lib/client/tunnels/make-rpc-tls-tunnel.js +125 -121
- package/lib/client/utils/attestor-pool.js +23 -22
- package/lib/client/utils/client-socket.js +86 -109
- package/lib/client/utils/message-handler.js +79 -89
- package/lib/config/index.js +40 -58
- package/lib/external-rpc/benchmark.js +61 -74
- package/lib/external-rpc/event-bus.js +12 -15
- package/lib/external-rpc/handle-incoming-msg.js +216 -225
- package/lib/external-rpc/jsc-polyfills/1.js +70 -68
- package/lib/external-rpc/jsc-polyfills/2.js +17 -12
- package/lib/external-rpc/jsc-polyfills/event.js +10 -15
- package/lib/external-rpc/jsc-polyfills/index.js +2 -2
- package/lib/external-rpc/jsc-polyfills/ws.js +77 -79
- package/lib/external-rpc/setup-browser.js +28 -28
- package/lib/external-rpc/setup-jsc.js +17 -17
- package/lib/external-rpc/types.js +1 -0
- package/lib/external-rpc/utils.js +89 -89
- package/lib/external-rpc/zk.js +55 -50
- package/lib/index.js +2 -6
- package/lib/mechain/abis/governanceABI.js +457 -460
- package/lib/mechain/abis/taskABI.js +502 -505
- package/lib/mechain/client/create-claim-on-mechain.js +24 -29
- package/lib/mechain/constants/index.js +3 -8
- package/lib/mechain/types/index.js +1 -0
- package/lib/proto/api.js +4200 -4087
- package/lib/proto/tee-bundle.js +1261 -1241
- package/lib/providers/http/index.js +616 -603
- package/lib/providers/http/patch-parse5-tree.js +27 -29
- package/lib/providers/http/utils.js +289 -248
- package/lib/providers/index.js +3 -6
- package/lib/server/create-server.js +89 -91
- package/lib/server/handlers/claimTeeBundle.js +231 -211
- package/lib/server/handlers/claimTunnel.js +66 -73
- package/lib/server/handlers/completeClaimOnChain.js +20 -25
- package/lib/server/handlers/createClaimOnChain.js +21 -27
- package/lib/server/handlers/createTaskOnMechain.js +40 -50
- package/lib/server/handlers/createTunnel.js +85 -90
- package/lib/server/handlers/disconnectTunnel.js +4 -7
- package/lib/server/handlers/fetchCertificateBytes.js +37 -53
- package/lib/server/handlers/index.js +21 -24
- package/lib/server/handlers/init.js +27 -28
- package/lib/server/handlers/toprf.js +13 -16
- package/lib/server/socket.js +97 -100
- package/lib/server/tunnels/make-tcp-tunnel.js +161 -186
- package/lib/server/utils/apm.js +32 -25
- package/lib/server/utils/assert-valid-claim-request.js +305 -334
- package/lib/server/utils/config-env.js +2 -2
- package/lib/server/utils/dns.js +12 -18
- package/lib/server/utils/gcp-attestation.js +233 -181
- package/lib/server/utils/generics.d.ts +1 -1
- package/lib/server/utils/generics.js +43 -37
- package/lib/server/utils/iso.js +253 -256
- package/lib/server/utils/keep-alive.js +36 -36
- package/lib/server/utils/nitro-attestation.js +295 -220
- package/lib/server/utils/oprf-raw.js +48 -55
- package/lib/server/utils/process-handshake.js +200 -218
- package/lib/server/utils/proxy-session.js +5 -5
- package/lib/server/utils/tee-oprf-mpc-verification.js +82 -78
- package/lib/server/utils/tee-oprf-verification.js +165 -142
- package/lib/server/utils/tee-transcript-reconstruction.js +176 -129
- package/lib/server/utils/tee-verification.js +397 -334
- package/lib/server/utils/validation.js +30 -37
- package/lib/types/bgp.js +1 -0
- package/lib/types/claims.js +1 -0
- package/lib/types/client.js +1 -0
- package/lib/types/general.js +1 -0
- package/lib/types/handlers.js +1 -0
- package/lib/types/providers.d.ts +3 -2
- package/lib/types/providers.gen.js +9 -15
- package/lib/types/providers.js +1 -0
- package/lib/types/rpc.js +1 -0
- package/lib/types/signatures.d.ts +1 -2
- package/lib/types/signatures.js +1 -0
- package/lib/types/tunnel.js +1 -0
- package/lib/types/zk.js +1 -0
- package/lib/utils/auth.js +54 -66
- package/lib/utils/b64-json.js +15 -15
- package/lib/utils/bgp-listener.js +107 -111
- package/lib/utils/claims.js +89 -80
- package/lib/utils/env.js +13 -17
- package/lib/utils/error.js +43 -47
- package/lib/utils/generics.js +284 -235
- package/lib/utils/http-parser.js +232 -187
- package/lib/utils/logger.js +80 -71
- package/lib/utils/prepare-packets.js +69 -67
- package/lib/utils/redactions.js +163 -121
- package/lib/utils/retries.js +22 -24
- package/lib/utils/signatures/eth.js +29 -28
- package/lib/utils/signatures/index.js +5 -10
- package/lib/utils/socket-base.js +84 -88
- package/lib/utils/tls.js +28 -28
- package/lib/utils/ws.js +19 -19
- package/lib/utils/zk.js +542 -582
- package/package.json +12 -5
- package/lib/external-rpc/global.d.js +0 -0
- package/lib/scripts/build-browser.d.ts +0 -1
- package/lib/scripts/build-jsc.d.ts +0 -1
- package/lib/scripts/build-lib.d.ts +0 -1
- package/lib/scripts/check-avs-registration.d.ts +0 -1
- package/lib/scripts/check-avs-registration.js +0 -28
- package/lib/scripts/fallbacks/crypto.d.ts +0 -1
- package/lib/scripts/fallbacks/crypto.js +0 -4
- package/lib/scripts/fallbacks/empty.d.ts +0 -3
- package/lib/scripts/fallbacks/empty.js +0 -4
- package/lib/scripts/fallbacks/re2.d.ts +0 -1
- package/lib/scripts/fallbacks/re2.js +0 -7
- package/lib/scripts/fallbacks/snarkjs.d.ts +0 -1
- package/lib/scripts/fallbacks/snarkjs.js +0 -10
- package/lib/scripts/fallbacks/stwo.d.ts +0 -6
- package/lib/scripts/fallbacks/stwo.js +0 -159
- package/lib/scripts/generate-provider-types.d.ts +0 -5
- package/lib/scripts/generate-provider-types.js +0 -101
- package/lib/scripts/generate-receipt.d.ts +0 -9
- package/lib/scripts/generate-receipt.js +0 -101
- package/lib/scripts/generate-toprf-keys.d.ts +0 -1
- package/lib/scripts/generate-toprf-keys.js +0 -24
- package/lib/scripts/jsc-cli-rpc.d.ts +0 -1
- package/lib/scripts/jsc-cli-rpc.js +0 -35
- package/lib/scripts/register-avs-operator.d.ts +0 -1
- package/lib/scripts/register-avs-operator.js +0 -3
- package/lib/scripts/start-server.d.ts +0 -1
- package/lib/scripts/start-server.js +0 -11
- package/lib/scripts/update-avs-metadata.d.ts +0 -1
- package/lib/scripts/update-avs-metadata.js +0 -20
- package/lib/scripts/utils.d.ts +0 -1
- package/lib/scripts/utils.js +0 -10
- package/lib/scripts/whitelist-operator.d.ts +0 -1
- package/lib/scripts/whitelist-operator.js +0 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
export { ReclaimServiceManager__factory } from "./ReclaimServiceManager__factory.js";
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
ReclaimServiceManager__factory,
|
|
5
|
-
factories
|
|
6
|
-
};
|
|
1
|
+
export * as factories from "./factories/index.js";
|
|
2
|
+
export { ReclaimServiceManager__factory } from "./factories/ReclaimServiceManager__factory.js";
|
package/lib/avs/types/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,53 +1,33 @@
|
|
|
1
|
-
import { Contract, JsonRpcProvider, Wallet } from
|
|
2
|
-
import { avsDirectoryABI } from "
|
|
3
|
-
import { delegationABI } from "
|
|
4
|
-
import { registryABI } from "
|
|
5
|
-
import { CHAIN_CONFIGS, PRIVATE_KEY, SELECTED_CHAIN_ID } from "
|
|
6
|
-
import { ReclaimServiceManager__factory } from "
|
|
1
|
+
import { Contract, JsonRpcProvider, Wallet } from 'ethers';
|
|
2
|
+
import { avsDirectoryABI } from "../abis/avsDirectoryABI.js";
|
|
3
|
+
import { delegationABI } from "../abis/delegationABI.js";
|
|
4
|
+
import { registryABI } from "../abis/registryABI.js";
|
|
5
|
+
import { CHAIN_CONFIGS, PRIVATE_KEY, SELECTED_CHAIN_ID } from "../config.js";
|
|
6
|
+
import { ReclaimServiceManager__factory } from "../contracts/index.js";
|
|
7
7
|
const configs = {};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
/**
|
|
9
|
+
* get the contracts for the given chain ID
|
|
10
|
+
*/
|
|
11
|
+
export function getContracts(chainId = SELECTED_CHAIN_ID) {
|
|
12
|
+
const config = CHAIN_CONFIGS[chainId];
|
|
13
|
+
if (!config) {
|
|
14
|
+
throw new Error(`No config found for chain ID: ${chainId}`);
|
|
15
|
+
}
|
|
16
|
+
configs[chainId] ||= initialiseContracts(config);
|
|
17
|
+
return configs[chainId];
|
|
15
18
|
}
|
|
16
|
-
function initialiseContracts({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
delegationABI,
|
|
31
|
-
wallet || provider
|
|
32
|
-
),
|
|
33
|
-
// eslint-disable-next-line camelcase
|
|
34
|
-
contract: ReclaimServiceManager__factory.connect(
|
|
35
|
-
contractAddress,
|
|
36
|
-
wallet || provider
|
|
37
|
-
),
|
|
38
|
-
registryContract: new Contract(
|
|
39
|
-
stakeRegistryAddress,
|
|
40
|
-
registryABI,
|
|
41
|
-
wallet || provider
|
|
42
|
-
),
|
|
43
|
-
avsDirectory: new Contract(
|
|
44
|
-
avsDirectoryAddress,
|
|
45
|
-
avsDirectoryABI,
|
|
46
|
-
wallet || provider
|
|
47
|
-
)
|
|
48
|
-
};
|
|
19
|
+
export function initialiseContracts({ rpcUrl, stakeRegistryAddress, avsDirectoryAddress, contractAddress, delegationManagerAddress, }, privateKey = PRIVATE_KEY) {
|
|
20
|
+
const provider = new JsonRpcProvider(rpcUrl);
|
|
21
|
+
const wallet = privateKey
|
|
22
|
+
? new Wallet(privateKey, provider)
|
|
23
|
+
: undefined;
|
|
24
|
+
return {
|
|
25
|
+
provider,
|
|
26
|
+
wallet,
|
|
27
|
+
delegationManager: new Contract(delegationManagerAddress, delegationABI, wallet || provider),
|
|
28
|
+
// eslint-disable-next-line camelcase
|
|
29
|
+
contract: ReclaimServiceManager__factory.connect(contractAddress, wallet || provider),
|
|
30
|
+
registryContract: new Contract(stakeRegistryAddress, registryABI, wallet || provider),
|
|
31
|
+
avsDirectory: new Contract(avsDirectoryAddress, avsDirectoryABI, wallet || provider),
|
|
32
|
+
};
|
|
49
33
|
}
|
|
50
|
-
export {
|
|
51
|
-
getContracts,
|
|
52
|
-
initialiseContracts
|
|
53
|
-
};
|
|
@@ -1,74 +1,79 @@
|
|
|
1
|
-
import { hexlify, randomBytes, SigningKey } from
|
|
2
|
-
import { RECLAIM_PUBLIC_URL, SELECTED_CHAIN_ID } from "
|
|
3
|
-
import { getContracts } from "
|
|
1
|
+
import { hexlify, randomBytes, SigningKey } from 'ethers';
|
|
2
|
+
import { RECLAIM_PUBLIC_URL, SELECTED_CHAIN_ID } from "../config.js";
|
|
3
|
+
import { getContracts } from "./contracts.js";
|
|
4
4
|
import { logger as LOGGER } from "../../utils/index.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Registers the operator on the chain, if required.
|
|
7
|
+
* If already registered -- will just pass through
|
|
8
|
+
*/
|
|
9
|
+
export async function registerOperator({ logger = LOGGER, chainId = SELECTED_CHAIN_ID, wallet = getContracts(chainId).wallet, reclaimRpcUrl = RECLAIM_PUBLIC_URL } = {}) {
|
|
10
|
+
const contracts = getContracts(chainId);
|
|
11
|
+
const delegationManager = contracts.delegationManager
|
|
12
|
+
.connect(wallet);
|
|
13
|
+
const avsDirectory = contracts.avsDirectory
|
|
14
|
+
.connect(wallet);
|
|
15
|
+
const contract = contracts.contract
|
|
16
|
+
.connect(wallet);
|
|
17
|
+
const registryContract = contracts.registryContract
|
|
18
|
+
.connect(wallet);
|
|
19
|
+
const addr = wallet.address;
|
|
20
|
+
try {
|
|
21
|
+
const tx1 = await delegationManager
|
|
22
|
+
.registerAsOperator({
|
|
23
|
+
earningsReceiver: addr,
|
|
24
|
+
delegationApprover: '0x0000000000000000000000000000000000000000',
|
|
25
|
+
stakerOptOutWindowBlocks: 0
|
|
26
|
+
}, '');
|
|
27
|
+
await tx1.wait();
|
|
28
|
+
logger.info('operator registered on DM successfully');
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
expiry,
|
|
35
|
-
salt,
|
|
36
|
-
signature: ""
|
|
37
|
-
};
|
|
38
|
-
const contractAddress = await contract.getAddress();
|
|
39
|
-
const digestHash = await avsDirectory.calculateOperatorAVSRegistrationDigestHash(
|
|
40
|
-
addr,
|
|
41
|
-
contractAddress,
|
|
42
|
-
salt,
|
|
43
|
-
expiry
|
|
44
|
-
);
|
|
45
|
-
const signingKey = new SigningKey(
|
|
46
|
-
wallet.privateKey
|
|
47
|
-
);
|
|
48
|
-
const signature = signingKey.sign(digestHash);
|
|
49
|
-
operatorSignature.signature = signature.serialized;
|
|
50
|
-
logger.info("operator signature generated successfully");
|
|
51
|
-
if (!await registryContract.operatorRegistered(addr)) {
|
|
52
|
-
const tx2 = await registryContract.registerOperatorWithSignature(addr, operatorSignature);
|
|
53
|
-
await tx2.wait();
|
|
54
|
-
logger.info("operator registered on AVS successfully");
|
|
55
|
-
} else {
|
|
56
|
-
logger.info("Operator already registered on AVS");
|
|
57
|
-
}
|
|
58
|
-
const existingMetadata = await contract.getMetadataForOperator(addr).catch((err) => {
|
|
59
|
-
if (err.message.includes("Operator not found")) {
|
|
60
|
-
return void 0;
|
|
30
|
+
catch (err) {
|
|
31
|
+
if (!err.message.includes('operator has already registered')) {
|
|
32
|
+
throw err;
|
|
33
|
+
}
|
|
34
|
+
logger.info('Operator already registered on EL');
|
|
61
35
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
36
|
+
const salt = hexlify(randomBytes(32));
|
|
37
|
+
// Example expiry, 1 hour from now
|
|
38
|
+
const expiry = Math.floor(Date.now() / 1000) + 3600;
|
|
39
|
+
// Define the output structure
|
|
40
|
+
const operatorSignature = {
|
|
41
|
+
expiry: expiry,
|
|
42
|
+
salt: salt,
|
|
43
|
+
signature: ''
|
|
44
|
+
};
|
|
45
|
+
// Calculate the digest hash using the avsDirectory's method
|
|
46
|
+
const contractAddress = await contract.getAddress();
|
|
47
|
+
const digestHash = await avsDirectory
|
|
48
|
+
.calculateOperatorAVSRegistrationDigestHash(addr, contractAddress, salt, expiry);
|
|
49
|
+
// Sign the digest hash with the operator's private key
|
|
50
|
+
const signingKey = new SigningKey(wallet.privateKey);
|
|
51
|
+
const signature = signingKey.sign(digestHash);
|
|
52
|
+
// Encode the signature in the required format
|
|
53
|
+
operatorSignature.signature = signature.serialized;
|
|
54
|
+
logger.info('operator signature generated successfully');
|
|
55
|
+
if (!(await registryContract.operatorRegistered(addr))) {
|
|
56
|
+
const tx2 = await registryContract
|
|
57
|
+
.registerOperatorWithSignature(addr, operatorSignature);
|
|
58
|
+
await tx2.wait();
|
|
59
|
+
logger.info('operator registered on AVS successfully');
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
logger.info('Operator already registered on AVS');
|
|
63
|
+
}
|
|
64
|
+
const existingMetadata = await contract.getMetadataForOperator(addr)
|
|
65
|
+
.catch(err => {
|
|
66
|
+
if (err.message.includes('Operator not found')) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
throw err;
|
|
70
|
+
});
|
|
71
|
+
const metadata = { addr, url: reclaimRpcUrl };
|
|
72
|
+
if (existingMetadata?.addr === metadata.addr
|
|
73
|
+
&& existingMetadata?.url === metadata.url) {
|
|
74
|
+
logger.info('operator metadata already up to date');
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
await contract.updateOperatorMetadata(metadata);
|
|
78
|
+
logger.info({ metadata }, 'operator metadata updated successfully');
|
|
71
79
|
}
|
|
72
|
-
export {
|
|
73
|
-
registerOperator
|
|
74
|
-
};
|
package/lib/avs/utils/tasks.js
CHANGED
|
@@ -1,48 +1,41 @@
|
|
|
1
|
-
import { EventLog, getBytes } from
|
|
2
|
-
import { getContracts } from "
|
|
3
|
-
async function createNewClaimRequestOnChain({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import { EventLog, getBytes } from 'ethers';
|
|
2
|
+
import { getContracts } from "./contracts.js";
|
|
3
|
+
export async function createNewClaimRequestOnChain({ request, payer, chainId, ...rest }) {
|
|
4
|
+
const contracts = getContracts(chainId);
|
|
5
|
+
const contract = contracts.contract.connect(payer);
|
|
6
|
+
const ownerAddress = typeof rest.owner === 'string'
|
|
7
|
+
? rest.owner
|
|
8
|
+
: rest.owner.address;
|
|
9
|
+
const fullRequest = {
|
|
10
|
+
...request,
|
|
11
|
+
owner: ownerAddress
|
|
12
|
+
};
|
|
13
|
+
const signature = await getSignature();
|
|
14
|
+
const task = await contract.createNewTask(fullRequest, signature || '0x00');
|
|
15
|
+
const rslt = await task.wait();
|
|
16
|
+
const logs = rslt?.logs ?? [];
|
|
17
|
+
const eventLogs = logs.filter((log) => log instanceof EventLog);
|
|
18
|
+
// check task created event was emitted
|
|
19
|
+
const ev = eventLogs[0];
|
|
20
|
+
const arg = ev?.args;
|
|
21
|
+
return { task: arg, tx: rslt };
|
|
22
|
+
function getSignature() {
|
|
23
|
+
if (ownerAddress.toLowerCase() === payer.address.toLowerCase()) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if ('requestSignature' in rest) {
|
|
27
|
+
return rest.requestSignature;
|
|
28
|
+
}
|
|
29
|
+
if (typeof rest.owner !== 'object') {
|
|
30
|
+
throw new Error('Owner wallet must be provided or'
|
|
31
|
+
+ ' requestSignature must be provided');
|
|
32
|
+
}
|
|
33
|
+
return signClaimRequest(fullRequest, rest.owner, chainId);
|
|
27
34
|
}
|
|
28
|
-
if ("requestSignature" in rest) {
|
|
29
|
-
return rest.requestSignature;
|
|
30
|
-
}
|
|
31
|
-
if (typeof rest.owner !== "object") {
|
|
32
|
-
throw new Error(
|
|
33
|
-
"Owner wallet must be provided or requestSignature must be provided"
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
return signClaimRequest(fullRequest, rest.owner, chainId);
|
|
37
|
-
}
|
|
38
35
|
}
|
|
39
|
-
async function signClaimRequest(request, owner, chainId) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
export async function signClaimRequest(request, owner, chainId) {
|
|
37
|
+
const contract = getContracts(chainId).contract;
|
|
38
|
+
const encoded = await contract.encodeClaimRequest(request);
|
|
39
|
+
const strSig = await owner.signMessage(getBytes(encoded));
|
|
40
|
+
return getBytes(strSig);
|
|
44
41
|
}
|
|
45
|
-
export {
|
|
46
|
-
createNewClaimRequestOnChain,
|
|
47
|
-
signClaimRequest
|
|
48
|
-
};
|