diff --git a/sdk/js-query/CHANGELOG.md b/sdk/js-query/CHANGELOG.md index 88cbe8a73..25255e258 100644 --- a/sdk/js-query/CHANGELOG.md +++ b/sdk/js-query/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.13 + +Add signaturesToSolanaArray + ## 0.0.12 Fix SolanaPda mock for bad rentEpoch parsing diff --git a/sdk/js-query/package-lock.json b/sdk/js-query/package-lock.json index 37a214a3e..d7796c8cd 100644 --- a/sdk/js-query/package-lock.json +++ b/sdk/js-query/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wormhole-foundation/wormhole-query-sdk", - "version": "0.0.12", + "version": "0.0.13", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@wormhole-foundation/wormhole-query-sdk", - "version": "0.0.12", + "version": "0.0.13", "license": "Apache-2.0", "dependencies": { "@ethersproject/keccak256": "^5.7.0", diff --git a/sdk/js-query/package.json b/sdk/js-query/package.json index a354a9784..93e07cc60 100644 --- a/sdk/js-query/package.json +++ b/sdk/js-query/package.json @@ -1,6 +1,6 @@ { "name": "@wormhole-foundation/wormhole-query-sdk", - "version": "0.0.12", + "version": "0.0.13", "description": "Wormhole cross-chain query SDK", "homepage": "https://wormhole.com", "main": "./lib/cjs/index.js", diff --git a/sdk/js-query/src/query/utils.ts b/sdk/js-query/src/query/utils.ts index 61d72f370..36df0cfa8 100644 --- a/sdk/js-query/src/query/utils.ts +++ b/sdk/js-query/src/query/utils.ts @@ -33,6 +33,16 @@ export function signaturesToEvmStruct(signatures: string[]) { })); } +// GuardianSetSig expects the guardian index before the signature, the inverse of what the Query Proxy returns. +// https://docs.rs/wormhole-raw-vaas/0.3.0-alpha.1/src/wormhole_raw_vaas/protocol.rs.html#220 +// https://github.com/wormhole-foundation/wormhole/blob/31b01629087c610c12fa8e84069786139dc0b6bd/node/cmd/ccq/http.go#L191 +export function signaturesToSolanaArray(signatures: string[]) { + return signatures.map((s) => [ + ...Buffer.from(s.substring(130, 132), "hex"), + ...Buffer.from(s.substring(0, 130), "hex"), + ]); +} + /** * @param key Private key used to sign `data` * @param data Data for signing