Skip to content

Commit

Permalink
feat: added a new argument to signProxySubmitCheckpointWithIdentity (#67
Browse files Browse the repository at this point in the history
)

* feat: added a new argument to signProxySubmitCheckpointWithIdentity

* fix: added the checkpointOrignId to submitCheckpoint function

* feat: new query to get checkpoint by origin id
  • Loading branch information
ivan-cholakov authored Jan 31, 2025
1 parent a07a6a4 commit 9c18ec5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/apis/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ async function signProxyRegisterChainHandler({ relayer, name, signerAddress, api
return await signData(api, signerAddress, encodedDataToSign);
}

async function signProxySubmitCheckpointWithIdentity({ relayer, signerAddress, checkpoint, chainId, nonce, api }) {
async function signProxySubmitCheckpointWithIdentity({ relayer, signerAddress, checkpoint, chainId, nonce, checkpointOriginId, api }) {
const dataRelayer = AccountUtils.convertToPublicKeyIfNeeded(relayer);
const handler = AccountUtils.convertToPublicKeyIfNeeded(signerAddress);

Expand All @@ -458,7 +458,8 @@ async function signProxySubmitCheckpointWithIdentity({ relayer, signerAddress, c
{ AccountId: handler },
{ H256: checkpoint },
{ u32: chainId },
{ u64: nonce }
{ u64: nonce },
{ u64: checkpointOriginId }
];

const encodedDataToSign = encodeOrderedData(orderedData);
Expand Down
4 changes: 4 additions & 0 deletions lib/apis/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,8 @@ export class Query {
async getLiftStatus(txHash: string): Promise<string> {
return await this.postRequest<string>(this.api, 'getEthereumEventStatus', { txHash });
}

async getCheckpointByOriginId(chainId: string, originId:string): Promise<string> {
return await this.postRequest<string>(this.api, 'getCheckpointByOriginId', {chainId, originId})
}
}
4 changes: 2 additions & 2 deletions lib/apis/send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ export class Send {
return await this.proxyRequest(methodArgs, TxType.ProxyRegisterHander, NonceType.None);
}

async submitCheckpoint(handler: string, checkpoint: string, chainId: number): Promise<string> {
async submitCheckpoint(handler: string, checkpoint: string, chainId: number, checkpointOriginId: number): Promise<string> {
Utils.validateAccount(handler);
Utils.validateCheckpointFormat(checkpoint);
const methodArgs = { handler, checkpoint, chainId };
const methodArgs = { handler, checkpoint, chainId, checkpointOriginId };
return await this.proxyRequest(methodArgs, TxType.ProxySubmitCheckpoint, NonceType.Anchor);
}

Expand Down

0 comments on commit 9c18ec5

Please sign in to comment.