sdk/js-query: add signaturesToSolanaArray util
This commit is contained in:
parent
1f1a6df757
commit
cdc23d152a
|
@ -1,3 +1,7 @@
|
|||
## 0.0.13
|
||||
|
||||
Add signaturesToSolanaArray
|
||||
|
||||
## 0.0.12
|
||||
|
||||
Fix SolanaPda mock for bad rentEpoch parsing
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue