sdk/js: remove batchVAA methods

This commit is contained in:
Evan Gray 2024-01-30 15:54:39 -05:00 committed by Evan Gray
parent a439bdb48c
commit 62ce7d48f3
4 changed files with 6 additions and 60 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## 0.10.11
### Removed
getSignedBatchVAA, getSignedBatchVAAWithRetry
## 0.10.10
### Changes

View File

@ -1,21 +0,0 @@
import { ChainId, ChainName, coalesceChainId } from "../utils/consts";
import { publicrpc } from "@certusone/wormhole-sdk-proto-web";
const { GrpcWebImpl, PublicRPCServiceClientImpl } = publicrpc;
export async function getSignedBatchVAA(
host: string,
emitterChain: ChainId | ChainName,
transactionId: Uint8Array,
nonce: number,
extraGrpcOpts = {}
) {
const rpc = new GrpcWebImpl(host, extraGrpcOpts);
const api = new PublicRPCServiceClientImpl(rpc);
return await api.GetSignedBatchVAA({
batchId: {
emitterChain: coalesceChainId(emitterChain),
txId: transactionId,
nonce,
},
});
}

View File

@ -1,37 +0,0 @@
import { ChainId, ChainName, getSignedBatchVAA } from "..";
import { coalesceChainId } from "../utils";
export async function getSignedBatchVAAWithRetry(
hosts: string[],
emitterChain: ChainId | ChainName,
transactionId: Uint8Array,
nonce: number,
extraGrpcOpts = {},
retryTimeout = 1000,
retryAttempts?: number
) {
let currentWormholeRpcHost = -1;
const getNextRpcHost = () => ++currentWormholeRpcHost % hosts.length;
let result;
let attempts = 0;
while (!result) {
attempts++;
await new Promise((resolve) => setTimeout(resolve, retryTimeout));
try {
result = await getSignedBatchVAA(
hosts[getNextRpcHost()],
coalesceChainId(emitterChain),
transactionId,
nonce,
extraGrpcOpts
);
} catch (e) {
if (retryAttempts !== undefined && attempts > retryAttempts) {
throw e;
}
}
}
return result;
}
export default getSignedBatchVAAWithRetry;

View File

@ -1,6 +1,4 @@
export * from "./getSignedVAA";
export { getSignedVAAWithRetry } from "./getSignedVAAWithRetry";
export * from "./getSignedBatchVAA";
export { getSignedBatchVAAWithRetry } from "./getSignedBatchVAAWithRetry";
export * from "./getGovernorIsVAAEnqueued";
export * from "./getGovernorIsVAAEnqueuedWithRetry";