Skip to content

Commit 85ce4bc

Browse files
committed
update tasks to respect only one signer config
1 parent 024a90b commit 85ce4bc

5 files changed

Lines changed: 20 additions & 9 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Boolean",
4+
"type": "boolean"
5+
}

tasks/add-signers.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { contractTask, logTransaction } from "@asteroid-protocol/lift";
22
import { readFile } from "fs/promises";
3+
import { ONLY_ONE_SIGNER } from "./src/constants.js";
34

45
contractTask(async (context, contract) => {
56
const pubkey1 = await readFile(
@@ -20,14 +21,16 @@ contractTask(async (context, contract) => {
2021

2122
logTransaction(res);
2223

23-
res = await contract.execute({
24-
add_signer: {
25-
name: "trusted-party-2",
26-
public_key_base64: pubkey2.trim(),
27-
},
28-
});
24+
if (!ONLY_ONE_SIGNER) {
25+
res = await contract.execute({
26+
add_signer: {
27+
name: "trusted-party-2",
28+
public_key_base64: pubkey2.trim(),
29+
},
30+
});
2931

30-
logTransaction(res);
32+
logTransaction(res);
33+
}
3134

3235
const signers = await contract.query({ signers: {} });
3336
console.log("signers:", signers);

tasks/link-token.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
SOURCE_CHAIN_ID,
55
DESTINATION_CHAIN_ID,
66
TICKER,
7+
ONLY_ONE_SIGNER,
78
} from "./src/constants.js";
89

910
contractTask(async (context, contract) => {
@@ -16,7 +17,7 @@ contractTask(async (context, contract) => {
1617

1718
const message = `${SOURCE_CHAIN_ID}${token.ticker}${token.decimals}${DESTINATION_CHAIN_ID}${contract.address}`;
1819

19-
const signatures = await signMessage(message);
20+
const signatures = await signMessage(message, ONLY_ONE_SIGNER);
2021

2122
const res = await contract.execute({
2223
link_token: {

tasks/receive.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
SOURCE_CHAIN_ID,
99
DESTINATION_CHAIN_ID,
1010
TICKER,
11+
ONLY_ONE_SIGNER,
1112
} from "./src/constants.js";
1213

1314
const command = contractCommand();
@@ -30,7 +31,7 @@ contractTask(command, async (context, contract) => {
3031

3132
const message = `${SOURCE_CHAIN_ID}${transactionHash}${TICKER}${amount}${DESTINATION_CHAIN_ID}${contract.address}${destinationAddress}`;
3233

33-
const signatures = await signMessage(message);
34+
const signatures = await signMessage(message, ONLY_ONE_SIGNER);
3435

3536
const res = await contract.execute({
3637
receive: {

tasks/src/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export const SOURCE_CHAIN_ID = "gaialocal-1";
22
export const DESTINATION_CHAIN_ID = "test-1";
33
export const TICKER = "ROIDS";
4+
export const ONLY_ONE_SIGNER = true;

0 commit comments

Comments
 (0)