@layerzerolabs/onesig-core 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +29 -7
- package/dist/index.js +171 -39156
- package/package.json +11 -20
package/dist/index.d.ts
CHANGED
|
@@ -9,17 +9,39 @@ interface BaseLeafData<TargetAddressType = unknown, CallData = unknown> {
|
|
|
9
9
|
targetOneSigAddress: TargetAddressType;
|
|
10
10
|
calls: CallData[];
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
interface SigningOptions {
|
|
13
13
|
seed: string | Uint8Array;
|
|
14
14
|
expiry: number | string | BigNumber;
|
|
15
|
-
}
|
|
16
|
-
interface GenerateLeafsResult<Leaf extends BaseLeafData
|
|
15
|
+
}
|
|
16
|
+
interface GenerateLeafsResult<Leaf extends BaseLeafData = BaseLeafData<any, any>> {
|
|
17
17
|
encodeLeaf: (leaf: Leaf) => string;
|
|
18
18
|
leafs: Leaf[];
|
|
19
19
|
}
|
|
20
|
-
declare function makeOneSigTree(input: GenerateLeafsResult
|
|
20
|
+
declare function makeOneSigTree(input: GenerateLeafsResult[]): MerkleTree;
|
|
21
21
|
declare function compareAddresses(a: string, b: string): number;
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
type HexStringLike = `0x${string}`;
|
|
23
|
+
type SignatureLike = Buffer | string | Signature | HexStringLike;
|
|
24
|
+
declare class Signature {
|
|
25
|
+
#private;
|
|
26
|
+
constructor(input: SignatureLike);
|
|
27
|
+
get(): Buffer;
|
|
28
|
+
toHexString(): HexStringLike;
|
|
29
|
+
get signatureCount(): number;
|
|
30
|
+
/**
|
|
31
|
+
* Concatenate signatures without changing ordering
|
|
32
|
+
*/
|
|
33
|
+
static concatenateSignatures(input: SignatureLike[], sortMethod: false): Signature;
|
|
34
|
+
/**
|
|
35
|
+
* Concatenate signatures based on addresses provided, with each signature corresponding to the address in the same index
|
|
36
|
+
*/
|
|
37
|
+
static concatenateSignatures(input: SignatureLike[], addresses: string[]): Signature;
|
|
38
|
+
/**
|
|
39
|
+
* Concatenate signatures based on the signature data, ordering based on the recovered address
|
|
40
|
+
*/
|
|
41
|
+
static concatenateSignatures(input: SignatureLike[], digest: Buffer | string): Signature;
|
|
42
|
+
}
|
|
43
|
+
declare function getDigestToSign(tree: MerkleTree, options: SigningOptions): string;
|
|
44
|
+
declare function signOneSigTree(tree: MerkleTree, signers: TypedDataSigner[], options: SigningOptions, enc?: 'string'): Promise<string>;
|
|
45
|
+
declare function signOneSigTree(tree: MerkleTree, signers: TypedDataSigner[], options: SigningOptions, enc: 'signature'): Promise<Signature>;
|
|
24
46
|
|
|
25
|
-
export { type BaseLeafData, type GenerateLeafsResult, type SigningOptions, compareAddresses,
|
|
47
|
+
export { type BaseLeafData, type GenerateLeafsResult, Signature, type SigningOptions, compareAddresses, getDigestToSign, makeOneSigTree, signOneSigTree };
|