@wormhole-foundation/sdk-definitions
Advanced tools
Comparing version 1.1.1 to 1.1.2-alpha.0
import type { CustomizableBytes } from "@wormhole-foundation/sdk-base"; | ||
import { layout } from "@wormhole-foundation/sdk-base"; | ||
import type { RegisterPayloadTypes } from "./../../vaa/index.js"; | ||
@@ -54,3 +53,3 @@ export declare const depositWithPayloadLayout: <const P extends CustomizableBytes = undefined>(customPayload?: P) => readonly [{ | ||
readonly name: "mintRecipient"; | ||
}, layout.CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -132,3 +131,3 @@ readonly lengthSize: 2; | ||
readonly name: "mintRecipient"; | ||
}, layout.CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -186,3 +185,3 @@ readonly lengthSize: 2; | ||
readonly name: "mintRecipient"; | ||
}, layout.CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -189,0 +188,0 @@ readonly lengthSize: 2; |
@@ -23,3 +23,3 @@ "use strict"; | ||
{ name: "mintRecipient", ...index_js_1.universalAddressItem }, | ||
sdk_base_1.layout.customizableBytes({ name: "payload", lengthSize: 2 }, customPayload), | ||
(0, sdk_base_1.customizableBytes)({ name: "payload", lengthSize: 2 }, customPayload), | ||
]; | ||
@@ -26,0 +26,0 @@ exports.depositWithPayloadLayout = depositWithPayloadLayout; |
@@ -30,4 +30,4 @@ import type { RegisterPayloadTypes } from "./../../vaa/index.js"; | ||
readonly custom: { | ||
to: (encoded: number) => import("@wormhole-foundation/sdk-base").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>; | ||
from: (obj: import("@wormhole-foundation/sdk-base").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>) => number; | ||
to: (encoded: number) => import("binary-layout").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>; | ||
from: (obj: import("binary-layout").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>) => number; | ||
}; | ||
@@ -67,4 +67,4 @@ readonly name: "flags"; | ||
readonly custom: { | ||
to: (encoded: number) => import("@wormhole-foundation/sdk-base").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>; | ||
from: (obj: import("@wormhole-foundation/sdk-base").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>) => number; | ||
to: (encoded: number) => import("binary-layout").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>; | ||
from: (obj: import("binary-layout").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>) => number; | ||
}; | ||
@@ -157,4 +157,4 @@ readonly name: "flags"; | ||
readonly custom: { | ||
to: (encoded: number) => import("@wormhole-foundation/sdk-base").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>; | ||
from: (obj: import("@wormhole-foundation/sdk-base").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>) => number; | ||
to: (encoded: number) => import("binary-layout").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>; | ||
from: (obj: import("binary-layout").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>) => number; | ||
}; | ||
@@ -250,3 +250,3 @@ readonly name: "flags"; | ||
readonly name: "from"; | ||
}, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -284,4 +284,4 @@ }, readonly [{ | ||
readonly custom: { | ||
to: (encoded: number) => import("@wormhole-foundation/sdk-base").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>; | ||
from: (obj: import("@wormhole-foundation/sdk-base").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>) => number; | ||
to: (encoded: number) => import("binary-layout").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>; | ||
from: (obj: import("binary-layout").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>) => number; | ||
}; | ||
@@ -288,0 +288,0 @@ readonly name: "flags"; |
@@ -29,3 +29,3 @@ import type { CustomizableBytes } from "@wormhole-foundation/sdk-base"; | ||
readonly name: "target"; | ||
}, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -186,3 +186,3 @@ readonly lengthSize: 4; | ||
readonly name: "target"; | ||
}, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -189,0 +189,0 @@ readonly lengthSize: 4; |
@@ -83,3 +83,3 @@ import type { RegisterPayloadTypes } from "./../../vaa/index.js"; | ||
readonly name: "from"; | ||
}, import("@wormhole-foundation/sdk-base/dist/cjs").CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -86,0 +86,0 @@ }, readonly [{ |
@@ -61,3 +61,3 @@ import type { CustomizableBytes } from "@wormhole-foundation/sdk-base"; | ||
readonly name: "from"; | ||
}, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -223,3 +223,3 @@ }, P>]; | ||
readonly name: "from"; | ||
}, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -226,0 +226,0 @@ }, undefined>]]]; |
@@ -85,3 +85,3 @@ "use strict"; | ||
data = sdk_base_1.encoding.hex.decode(data); | ||
const [header, envelopeOffset] = (0, sdk_base_1.deserializeLayout)(vaa_js_1.headerLayout, data, { consumeAll: false }); | ||
const [header, headerSize] = (0, sdk_base_1.deserializeLayout)(vaa_js_1.headerLayout, data, false); | ||
//ensure that guardian signature indicies are unique and in ascending order - see: | ||
@@ -92,12 +92,11 @@ //https://github.com/wormhole-foundation/wormhole/blob/8e0cf4c31f39b5ba06b0f6cdb6e690d3adf3d6a3/ethereum/contracts/Messages.sol#L121 | ||
throw new Error("Guardian signatures must be in ascending order of guardian set index"); | ||
const [envelope, payloadOffset] = (0, sdk_base_1.deserializeLayout)(vaa_js_1.envelopeLayout, data, { | ||
offset: envelopeOffset, | ||
consumeAll: false, | ||
}); | ||
const envelopeOffset = headerSize; | ||
const [envelope, envelopeSize] = (0, sdk_base_1.deserializeLayout)(vaa_js_1.envelopeLayout, data.subarray(envelopeOffset), false); | ||
const payloadOffset = envelopeOffset + envelopeSize; | ||
const [payloadLiteral, payload] = typeof payloadDet === "string" | ||
? [ | ||
payloadDet, | ||
deserializePayload(payloadDet, data, payloadOffset), | ||
deserializePayload(payloadDet, data.subarray(payloadOffset)), | ||
] | ||
: deserializePayload(payloadDet, data, payloadOffset); | ||
: deserializePayload(payloadDet, data.subarray(payloadOffset)); | ||
const [protocolName, payloadName] = (0, vaa_js_1.decomposeLiteral)(payloadLiteral); | ||
@@ -132,3 +131,3 @@ const hash = (0, utils_js_1.keccak256)(data.slice(envelopeOffset)); | ||
if (typeof payloadDet === "string") | ||
return (0, sdk_base_1.deserializeLayout)(getPayloadLayout(payloadDet), data, { offset }); | ||
return (0, sdk_base_1.deserializeLayout)(getPayloadLayout(payloadDet), data.subarray(offset)); | ||
//kinda unfortunate that we have to slice here, future improvement would be passing an optional | ||
@@ -139,3 +138,6 @@ // offset to the discriminator | ||
throw new Error(`Encoded data does not match any of the given payload types - ${data}`); | ||
return [candidate, (0, sdk_base_1.deserializeLayout)(getPayloadLayout(candidate), data, { offset })]; | ||
return [ | ||
candidate, | ||
(0, sdk_base_1.deserializeLayout)(getPayloadLayout(candidate), data.subarray(offset)) | ||
]; | ||
})(); | ||
@@ -218,7 +220,4 @@ } | ||
]; | ||
const [header, offset] = (0, sdk_base_1.deserializeLayout)(vaa_js_1.headerLayout, data, { consumeAll: false }); | ||
const [envelope, offset2] = (0, sdk_base_1.deserializeLayout)(envelopeLayout, data, { | ||
offset: offset, | ||
consumeAll: false, | ||
}); | ||
const [header, offset] = (0, sdk_base_1.deserializeLayout)(vaa_js_1.headerLayout, data, false); | ||
const [envelope, offset2] = (0, sdk_base_1.deserializeLayout)(envelopeLayout, data.subarray(offset), false); | ||
return { | ||
@@ -225,0 +224,0 @@ ...header, |
import type { CustomizableBytes } from "@wormhole-foundation/sdk-base"; | ||
import { layout } from "@wormhole-foundation/sdk-base"; | ||
import type { RegisterPayloadTypes } from "./../../vaa/index.js"; | ||
@@ -54,3 +53,3 @@ export declare const depositWithPayloadLayout: <const P extends CustomizableBytes = undefined>(customPayload?: P) => readonly [{ | ||
readonly name: "mintRecipient"; | ||
}, layout.CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -132,3 +131,3 @@ readonly lengthSize: 2; | ||
readonly name: "mintRecipient"; | ||
}, layout.CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -186,3 +185,3 @@ readonly lengthSize: 2; | ||
readonly name: "mintRecipient"; | ||
}, layout.CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -189,0 +188,0 @@ readonly lengthSize: 2; |
@@ -1,2 +0,2 @@ | ||
import { layout } from "@wormhole-foundation/sdk-base"; | ||
import { customizableBytes } from "@wormhole-foundation/sdk-base"; | ||
import { payloadIdItem, universalAddressItem, amountItem, circleDomainItem, circleNonceItem, } from "./../../layout-items/index.js"; | ||
@@ -20,3 +20,3 @@ import { registerPayloadTypes } from "./../../vaa/index.js"; | ||
{ name: "mintRecipient", ...universalAddressItem }, | ||
layout.customizableBytes({ name: "payload", lengthSize: 2 }, customPayload), | ||
customizableBytes({ name: "payload", lengthSize: 2 }, customPayload), | ||
]; | ||
@@ -23,0 +23,0 @@ //from here: |
@@ -30,4 +30,4 @@ import type { RegisterPayloadTypes } from "./../../vaa/index.js"; | ||
readonly custom: { | ||
to: (encoded: number) => import("@wormhole-foundation/sdk-base").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>; | ||
from: (obj: import("@wormhole-foundation/sdk-base").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>) => number; | ||
to: (encoded: number) => import("binary-layout").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>; | ||
from: (obj: import("binary-layout").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>) => number; | ||
}; | ||
@@ -67,4 +67,4 @@ readonly name: "flags"; | ||
readonly custom: { | ||
to: (encoded: number) => import("@wormhole-foundation/sdk-base").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>; | ||
from: (obj: import("@wormhole-foundation/sdk-base").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>) => number; | ||
to: (encoded: number) => import("binary-layout").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>; | ||
from: (obj: import("binary-layout").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>) => number; | ||
}; | ||
@@ -157,4 +157,4 @@ readonly name: "flags"; | ||
readonly custom: { | ||
to: (encoded: number) => import("@wormhole-foundation/sdk-base").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>; | ||
from: (obj: import("@wormhole-foundation/sdk-base").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>) => number; | ||
to: (encoded: number) => import("binary-layout").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>; | ||
from: (obj: import("binary-layout").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>) => number; | ||
}; | ||
@@ -250,3 +250,3 @@ readonly name: "flags"; | ||
readonly name: "from"; | ||
}, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -284,4 +284,4 @@ }, readonly [{ | ||
readonly custom: { | ||
to: (encoded: number) => import("@wormhole-foundation/sdk-base").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>; | ||
from: (obj: import("@wormhole-foundation/sdk-base").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>) => number; | ||
to: (encoded: number) => import("binary-layout").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>; | ||
from: (obj: import("binary-layout").Bitset<readonly ["shouldWrapNative", "shouldUnwrapNative"]>) => number; | ||
}; | ||
@@ -288,0 +288,0 @@ readonly name: "flags"; |
@@ -29,3 +29,3 @@ import type { CustomizableBytes } from "@wormhole-foundation/sdk-base"; | ||
readonly name: "target"; | ||
}, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -186,3 +186,3 @@ readonly lengthSize: 4; | ||
readonly name: "target"; | ||
}, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -189,0 +189,0 @@ readonly lengthSize: 4; |
@@ -83,3 +83,3 @@ import type { RegisterPayloadTypes } from "./../../vaa/index.js"; | ||
readonly name: "from"; | ||
}, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -86,0 +86,0 @@ }, readonly [{ |
@@ -61,3 +61,3 @@ import type { CustomizableBytes } from "@wormhole-foundation/sdk-base"; | ||
readonly name: "from"; | ||
}, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -223,3 +223,3 @@ }, P>]; | ||
readonly name: "from"; | ||
}, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{ | ||
}, import("binary-layout").CustomizableBytesReturn<{ | ||
readonly name: "payload"; | ||
@@ -226,0 +226,0 @@ }, undefined>]]]; |
@@ -77,3 +77,3 @@ import { deserializeLayout, encoding, layoutDiscriminator, serializeLayout, } from "@wormhole-foundation/sdk-base"; | ||
data = encoding.hex.decode(data); | ||
const [header, envelopeOffset] = deserializeLayout(headerLayout, data, { consumeAll: false }); | ||
const [header, headerSize] = deserializeLayout(headerLayout, data, false); | ||
//ensure that guardian signature indicies are unique and in ascending order - see: | ||
@@ -84,12 +84,11 @@ //https://github.com/wormhole-foundation/wormhole/blob/8e0cf4c31f39b5ba06b0f6cdb6e690d3adf3d6a3/ethereum/contracts/Messages.sol#L121 | ||
throw new Error("Guardian signatures must be in ascending order of guardian set index"); | ||
const [envelope, payloadOffset] = deserializeLayout(envelopeLayout, data, { | ||
offset: envelopeOffset, | ||
consumeAll: false, | ||
}); | ||
const envelopeOffset = headerSize; | ||
const [envelope, envelopeSize] = deserializeLayout(envelopeLayout, data.subarray(envelopeOffset), false); | ||
const payloadOffset = envelopeOffset + envelopeSize; | ||
const [payloadLiteral, payload] = typeof payloadDet === "string" | ||
? [ | ||
payloadDet, | ||
deserializePayload(payloadDet, data, payloadOffset), | ||
deserializePayload(payloadDet, data.subarray(payloadOffset)), | ||
] | ||
: deserializePayload(payloadDet, data, payloadOffset); | ||
: deserializePayload(payloadDet, data.subarray(payloadOffset)); | ||
const [protocolName, payloadName] = decomposeLiteral(payloadLiteral); | ||
@@ -123,3 +122,3 @@ const hash = keccak256(data.slice(envelopeOffset)); | ||
if (typeof payloadDet === "string") | ||
return deserializeLayout(getPayloadLayout(payloadDet), data, { offset }); | ||
return deserializeLayout(getPayloadLayout(payloadDet), data.subarray(offset)); | ||
//kinda unfortunate that we have to slice here, future improvement would be passing an optional | ||
@@ -130,3 +129,6 @@ // offset to the discriminator | ||
throw new Error(`Encoded data does not match any of the given payload types - ${data}`); | ||
return [candidate, deserializeLayout(getPayloadLayout(candidate), data, { offset })]; | ||
return [ | ||
candidate, | ||
deserializeLayout(getPayloadLayout(candidate), data.subarray(offset)) | ||
]; | ||
})(); | ||
@@ -208,7 +210,4 @@ } | ||
]; | ||
const [header, offset] = deserializeLayout(headerLayout, data, { consumeAll: false }); | ||
const [envelope, offset2] = deserializeLayout(envelopeLayout, data, { | ||
offset: offset, | ||
consumeAll: false, | ||
}); | ||
const [header, offset] = deserializeLayout(headerLayout, data, false); | ||
const [envelope, offset2] = deserializeLayout(envelopeLayout, data.subarray(offset), false); | ||
return { | ||
@@ -215,0 +214,0 @@ ...header, |
{ | ||
"name": "@wormhole-foundation/sdk-definitions", | ||
"version": "1.1.1", | ||
"version": "1.1.2-alpha.0", | ||
"repository": { | ||
@@ -89,5 +89,5 @@ "type": "git", | ||
"@noble/curves": "^1.4.0", | ||
"@wormhole-foundation/sdk-base": "1.1.1" | ||
"@wormhole-foundation/sdk-base": "1.1.2-alpha.0" | ||
}, | ||
"type": "module" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1016903
14475
1
+ Added@wormhole-foundation/sdk-base@1.1.2-alpha.0(transitive)
+ Addedbinary-layout@1.0.3(transitive)
- Removed@wormhole-foundation/sdk-base@1.1.1(transitive)