@layerzerolabs/lz-core 2.3.41 → 2.3.43
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/README.md +5 -4
- package/dist/index.cjs +120 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +43 -1
- package/dist/index.d.ts +43 -1
- package/dist/index.mjs +92 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -4
- package/CHANGELOG.md +0 -342
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# layerzero-core
|
|
2
2
|
|
|
3
|
-
This package defines the core interface for the tooling stack.
|
|
3
|
+
This package defines the core interface for the tooling stack, containing only neutral interfaces that are unrelated to the LayerZero protocol.
|
|
4
4
|
|
|
5
|
-
- Transaction
|
|
6
|
-
- Provider
|
|
7
|
-
- Signer
|
|
5
|
+
- `Transaction` Interface: Used for expressing transactions in different stages.
|
|
6
|
+
- `Provider` Interface: Defines the connectors to a chain node.
|
|
7
|
+
- `Signer` Interface: Handles message and transaction signing.
|
|
8
|
+
- The `signHash` function is implemented in this package instead of `lz-utilities` or `lz-foundation` to minimize dependencies.
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,117 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var blake2b$1 = require('@noble/hashes/blake2b');
|
|
4
|
+
var sha256 = require('@noble/hashes/sha256');
|
|
5
|
+
var sha3 = require('@noble/hashes/sha3');
|
|
6
|
+
var ed25519 = require('@noble/ed25519');
|
|
7
|
+
var secp256k1 = require('@noble/secp256k1');
|
|
8
|
+
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var ed25519__namespace = /*#__PURE__*/_interopNamespace(ed25519);
|
|
28
|
+
var secp256k1__namespace = /*#__PURE__*/_interopNamespace(secp256k1);
|
|
29
|
+
|
|
30
|
+
var __defProp = Object.defineProperty;
|
|
31
|
+
var __export = (target, all) => {
|
|
32
|
+
for (var name in all)
|
|
33
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
34
|
+
};
|
|
35
|
+
function keccak_256(message) {
|
|
36
|
+
return sha3.keccak_256(message);
|
|
37
|
+
}
|
|
38
|
+
function blake2b(message) {
|
|
39
|
+
return blake2b$1.blake2b(message);
|
|
40
|
+
}
|
|
41
|
+
function sha3_256(message) {
|
|
42
|
+
return sha3.sha3_256(message);
|
|
43
|
+
}
|
|
44
|
+
function sha2_256(message) {
|
|
45
|
+
return sha256.sha256(message);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/sign/constant.ts
|
|
49
|
+
var SignAlgorithm = /* @__PURE__ */ ((SignAlgorithm2) => {
|
|
50
|
+
SignAlgorithm2[SignAlgorithm2["NATIVE"] = 0] = "NATIVE";
|
|
51
|
+
SignAlgorithm2[SignAlgorithm2["SECP256K1"] = 1] = "SECP256K1";
|
|
52
|
+
SignAlgorithm2[SignAlgorithm2["ED25519"] = 2] = "ED25519";
|
|
53
|
+
return SignAlgorithm2;
|
|
54
|
+
})(SignAlgorithm || {});
|
|
55
|
+
|
|
56
|
+
// src/sign/ed25519.ts
|
|
57
|
+
var ed25519_exports = {};
|
|
58
|
+
__export(ed25519_exports, {
|
|
59
|
+
signHash: () => signHash
|
|
60
|
+
});
|
|
61
|
+
async function signHash(hash, privateKey) {
|
|
62
|
+
if (hash.length !== 32) {
|
|
63
|
+
throw new Error("Hash must be 32 bytes long");
|
|
64
|
+
}
|
|
65
|
+
const pubKey = await ed25519__namespace.getPublicKey(privateKey);
|
|
66
|
+
const signature = await ed25519__namespace.sign(hash, privateKey);
|
|
67
|
+
const isValid = await ed25519__namespace.verify(signature, hash, pubKey);
|
|
68
|
+
if (!isValid) {
|
|
69
|
+
throw new Error("Invalid signature");
|
|
70
|
+
}
|
|
71
|
+
return signature;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// src/sign/secp256k1.ts
|
|
75
|
+
var secp256k1_exports = {};
|
|
76
|
+
__export(secp256k1_exports, {
|
|
77
|
+
signHash: () => signHash2
|
|
78
|
+
});
|
|
79
|
+
async function signHash2(hash, privateKey) {
|
|
80
|
+
if (hash.length !== 32) {
|
|
81
|
+
throw new Error("Hash must be 32 bytes long");
|
|
82
|
+
}
|
|
83
|
+
const privKey = privateKey.replace("0x", "");
|
|
84
|
+
const pubKey = secp256k1__namespace.getPublicKey(privKey, false);
|
|
85
|
+
const [signature, recoveryId] = await secp256k1__namespace.sign(hash, privKey, {
|
|
86
|
+
// recovered - true indicates the recovered bit should be included in the result
|
|
87
|
+
recovered: true,
|
|
88
|
+
// canonical - true makes signatures compatible with libsecp256k1, false makes signatures compatible with openssl
|
|
89
|
+
canonical: true,
|
|
90
|
+
// der - whether the returned signature should be in DER format. If false, it would be in Compact format (32-byte r + 32-byte s)
|
|
91
|
+
der: false,
|
|
92
|
+
// extraEntropy - When true, it would automatically be filled with 32 bytes of cryptographically secure entropy. Strongly recommended to pass true to improve security:
|
|
93
|
+
extraEntropy: true
|
|
94
|
+
});
|
|
95
|
+
const isValid = secp256k1__namespace.verify(signature, hash, pubKey, { strict: true });
|
|
96
|
+
if (!isValid) {
|
|
97
|
+
throw new Error("Invalid signature");
|
|
98
|
+
}
|
|
99
|
+
return signature;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// src/sign/index.ts
|
|
103
|
+
async function signHash3(hash, privateKey, algorithm) {
|
|
104
|
+
const privKey = typeof privateKey === "string" ? privateKey.replace(/^0x/, "") : Buffer.from(privateKey).toString("hex");
|
|
105
|
+
switch (algorithm) {
|
|
106
|
+
case 1 /* SECP256K1 */:
|
|
107
|
+
return signHash2(hash, privKey);
|
|
108
|
+
case 2 /* ED25519 */:
|
|
109
|
+
return signHash(hash, privKey);
|
|
110
|
+
default:
|
|
111
|
+
throw new Error(`Unsupported algorithm: ${algorithm}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
3
115
|
// src/transaction.ts
|
|
4
116
|
var Block = class _Block {
|
|
5
117
|
constructor(block) {
|
|
@@ -75,11 +187,19 @@ function isConnectable(obj) {
|
|
|
75
187
|
|
|
76
188
|
exports.Block = Block;
|
|
77
189
|
exports.BlockWithTransactions = BlockWithTransactions;
|
|
190
|
+
exports.SignAlgorithm = SignAlgorithm;
|
|
78
191
|
exports.SignedTransaction = SignedTransaction;
|
|
79
192
|
exports.TransactionPending = TransactionPending;
|
|
80
193
|
exports.TransactionReceipt = TransactionReceipt;
|
|
81
194
|
exports.TransactionRequest = TransactionRequest;
|
|
82
195
|
exports.TransactionResponse = TransactionResponse;
|
|
196
|
+
exports.blake2b = blake2b;
|
|
197
|
+
exports.ed25519 = ed25519_exports;
|
|
83
198
|
exports.isConnectable = isConnectable;
|
|
199
|
+
exports.keccak_256 = keccak_256;
|
|
200
|
+
exports.secp256k1 = secp256k1_exports;
|
|
201
|
+
exports.sha2_256 = sha2_256;
|
|
202
|
+
exports.sha3_256 = sha3_256;
|
|
203
|
+
exports.signHash = signHash3;
|
|
84
204
|
//# sourceMappingURL=out.js.map
|
|
85
205
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/transaction.ts","../src/signer.ts"],"names":[],"mappings":";AAmBO,IAAM,QAAN,MAAM,OAAM;AAAA,EAEP,YAAmB,OAAgB;AAAh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;;;AC7DO,SAAS,cAAiB,KAAqC;AAClE,MAAI,OAAO,QAAQ,YAAY,QAAQ;AAAM,WAAO;AACpD,QAAM,KAAM,IAA8B;AAC1C,SAAO,OAAO,OAAO,cAAc,OAAO,GAAG,WAAW,YAAY,GAAG,WAAW;AACtF","sourcesContent":["import { NonPromise } from './promise'\n\n/**\n * By declare a unique field `type` in each class, it ensure that the instance of one class can not\n * be assigned to a variable of another class. Furthermore, it also help to distinguish the type of\n * the instance at runtime.\n * By private the constructor, it ensure that the instance of the class can only be created by the\n * static method `from`, and which can enforce the type of the input parameter should not be a promise.\n * Finally, it will be helpful for the compiler to infer the type of the instance and avoid the mistake.\n */\n\n/**\n * TransactionHash represents a transaction hash.\n */\nexport type TransactionHash = string | number\n\n/**\n * Block represents a block.\n */\nexport class Block {\n readonly type = 'Block'\n private constructor(public block: unknown) {}\n static from<T>(raw: NonPromise<T>): Block {\n return new Block(raw)\n }\n}\n\n/**\n * BlockWithTransactions represents a block with transactions.\n */\nexport class BlockWithTransactions {\n readonly type = 'BlockWithTransactions'\n private constructor(public block: unknown) {}\n static from<T>(raw: NonPromise<T>): BlockWithTransactions {\n return new BlockWithTransactions(raw)\n }\n}\n\n/**\n * BlockTag represents a block tag.\n */\nexport type BlockTag = string | number\n\n/**\n * Finality represents the finality of a block.\n */\nexport type Finality = 'confirmed' | 'finalized'\n\n/**\n * A union type to represent all the possible types of a transaction.\n */\ntype TransactionTypes =\n | TransactionRequest\n | TransactionResponse\n | TransactionReceipt\n | SignedTransaction\n | TransactionPending\n\n/**\n * TransactionRequest represents the request of a transaction.\n */\nexport class TransactionRequest {\n readonly type = 'TransactionRequest'\n private constructor(public request: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionRequest {\n return new TransactionRequest(raw)\n }\n}\n\n/**\n * TransactionResponse represents the response of a transaction.\n */\nexport class TransactionResponse {\n readonly type = 'TransactionResponse'\n private constructor(public response: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionResponse {\n return new TransactionResponse(raw)\n }\n}\n\n/**\n * TransactionReceipt represents the receipt of a transaction.\n */\nexport class TransactionReceipt {\n readonly type = 'TransactionReceipt'\n private constructor(public receipt: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionReceipt {\n return new TransactionReceipt(raw)\n }\n}\n\n/**\n * SignedTransaction represents a signed transaction.\n */\nexport class SignedTransaction {\n readonly type = 'SignedTransaction'\n private constructor(public signed: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): SignedTransaction {\n return new SignedTransaction(raw)\n }\n}\n\n/**\n * TransactionPending represents a pending transaction.\n */\nexport class TransactionPending {\n readonly type = 'TransactionPending'\n private constructor(public pending: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionPending {\n return new TransactionPending(raw)\n }\n}\n","import { Provider } from './provider'\nimport { SignedTransaction, TransactionPending, TransactionReceipt, TransactionRequest } from './transaction'\n\nexport interface Signer {\n /**\n * Connect to a provider\n * @param provider\n */\n connect(provider: Provider): Signer\n\n /**\n * Sign a transaction\n * @param transaction\n */\n signTransaction(transaction: TransactionRequest): Promise<SignedTransaction>\n\n /**\n * Send a transaction\n * @param transaction\n * @param sendOptions\n */\n sendTransaction(transaction: SignedTransaction, sendOptions?: unknown): Promise<TransactionPending>\n\n /**\n * Send a transaction and wait for confirmation\n * @param transaction\n * @param opts\n */\n sendAndConfirm(transaction: SignedTransaction, opts?: unknown): Promise<TransactionReceipt>\n\n /**\n * Sign a buffer (e.g. a message hash)\n */\n signBuffer(buffer: Uint8Array): Promise<Uint8Array>\n\n /**\n * returns the address of the signer\n */\n getAddress(): Promise<string>\n\n /**\n * Native signer object\n */\n native: unknown\n}\n\nexport interface Connectable<T> {\n connect<U>(provider: U): T\n}\n\nexport function isConnectable<T>(obj: unknown): obj is Connectable<T> {\n if (typeof obj !== 'object' || obj === null) return false\n const fn = (obj as { connect?: unknown }).connect\n return typeof fn === 'function' && typeof fn.length === 'number' && fn.length === 1\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/hash/index.ts","../src/sign/constant.ts","../src/sign/ed25519.ts","../src/sign/secp256k1.ts","../src/sign/index.ts","../src/transaction.ts","../src/signer.ts"],"names":["SignAlgorithm","signHash"],"mappings":";;;;;;;AAAA,SAAS,WAAW,gBAAgB;AACpC,SAAS,UAAU,eAAe;AAClC,SAAS,cAAc,aAAa,YAAY,iBAAiB;AAE1D,SAAS,WAAW,SAA0C;AACjE,SAAO,YAAY,OAAO;AAC9B;AAEO,SAAS,QAAQ,SAA0C;AAC9D,SAAO,SAAS,OAAO;AAC3B;AAEO,SAAS,SAAS,SAA0C;AAC/D,SAAO,UAAU,OAAO;AAC5B;AAEO,SAAS,SAAS,SAA0C;AAC/D,SAAO,QAAQ,OAAO;AAC1B;;;AClBO,IAAK,gBAAL,kBAAKA,mBAAL;AACH,EAAAA,8BAAA;AACA,EAAAA,8BAAA;AACA,EAAAA,8BAAA;AAHQ,SAAAA;AAAA,GAAA;;;ACAZ;AAAA;AAAA;AAAA;AAAA,YAAY,aAAa;AAQzB,eAAsB,SAAS,MAAkB,YAAyC;AACtF,MAAI,KAAK,WAAW,IAAI;AACpB,UAAM,IAAI,MAAM,4BAA4B;AAAA,EAChD;AAEA,QAAM,SAAS,MAAc,qBAAa,UAAU;AACpD,QAAM,YAAY,MAAc,aAAK,MAAM,UAAU;AACrD,QAAM,UAAU,MAAc,eAAO,WAAW,MAAM,MAAM;AAC5D,MAAI,CAAC,SAAS;AACV,UAAM,IAAI,MAAM,mBAAmB;AAAA,EACvC;AAEA,SAAO;AACX;;;ACrBA;AAAA;AAAA,kBAAAC;AAAA;AAAA,YAAY,eAAe;AAQ3B,eAAsBA,UAAS,MAAkB,YAAyC;AACtF,MAAI,KAAK,WAAW,IAAI;AACpB,UAAM,IAAI,MAAM,4BAA4B;AAAA,EAChD;AAEA,QAAM,UAAU,WAAW,QAAQ,MAAM,EA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BAAmB,GAAG;AAAA,EACrC;AACJ;AAKO,IAAM,sBAAN,MAAM,qBAAoB;AAAA,EAErB,YAAmB,UAAmB;AAAnB;AAD3B,SAAS,OAAO;AAAA,EAC+B;AAAA,EAC/C,OAAO,KAAQ,KAAoE;AAC/E,WAAO,IAAI,qBAAoB,GAAG;AAAA,EACtC;AACJ;AAKO,IAAM,qBAAN,MAAM,oBAAmB;AAAA,EAEpB,YAAmB,SAAkB;AAAlB;AAD3B,SAAS,OAAO;AAAA,EAC8B;AAAA,EAC9C,OAAO,KAAQ,KAAmE;AAC9E,WAAO,IAAI,oBAAmB,GAAG;AAAA,EACrC;AACJ;AAKO,IAAM,oBAAN,MAAM,mBAAkB;AAAA,EAEnB,YAAmB,QAAiB;AAAjB;AAD3B,SAAS,OAAO;AAAA,EAC6B;AAAA,EAC7C,OAAO,KAAQ,KAAkE;AAC7E,WAAO,IAAI,mBAAkB,GAAG;AAAA,EACpC;AACJ;AAKO,IAAM,qBAAN,MAAM,oBAAmB;AAAA,EAEpB,YAAmB,SAAkB;AAAlB;AAD3B,SAAS,OAAO;AAAA,EAC8B;AAAA,EAC9C,OAAO,KAAQ,KAAmE;AAC9E,WAAO,IAAI,oBAAmB,GAAG;AAAA,EACrC;AACJ;;;AC7DO,SAAS,cAAiB,KAAqC;AAClE,MAAI,OAAO,QAAQ,YAAY,QAAQ;AAAM,WAAO;AACpD,QAAM,KAAM,IAA8B;AAC1C,SAAO,OAAO,OAAO,cAAc,OAAO,GAAG,WAAW,YAAY,GAAG,WAAW;AACtF","sourcesContent":["import { blake2b as _blake2b } from '@noble/hashes/blake2b'\nimport { sha256 as _sha256 } from '@noble/hashes/sha256'\nimport { keccak_256 as _keccak_256, sha3_256 as _sha3_256 } from '@noble/hashes/sha3'\n\nexport function keccak_256(message: Uint8Array | string): Uint8Array {\n return _keccak_256(message)\n}\n\nexport function blake2b(message: Uint8Array | string): Uint8Array {\n return _blake2b(message)\n}\n\nexport function sha3_256(message: Uint8Array | string): Uint8Array {\n return _sha3_256(message)\n}\n\nexport function sha2_256(message: Uint8Array | string): Uint8Array {\n return _sha256(message)\n}\n","export enum SignAlgorithm {\n NATIVE,\n SECP256K1,\n ED25519,\n}\n","import * as ed25519 from '@noble/ed25519'\n\n/**\n * Sign a hash using ed25519\n * @param hash - 32 bytes long\n * @param privateKey - private key in hex format\n * @returns\n */\nexport async function signHash(hash: Uint8Array, privateKey: string): Promise<Uint8Array> {\n if (hash.length !== 32) {\n throw new Error('Hash must be 32 bytes long')\n }\n\n const pubKey = await ed25519.getPublicKey(privateKey)\n const signature = await ed25519.sign(hash, privateKey)\n const isValid = await ed25519.verify(signature, hash, pubKey)\n if (!isValid) {\n throw new Error('Invalid signature')\n }\n\n return signature\n}\n","import * as secp256k1 from '@noble/secp256k1'\n\n/**\n * Sign a hash using secp256k1\n * @param hash - 32 bytes long\n * @param privateKey - private key in hex format\n * @returns\n */\nexport async function signHash(hash: Uint8Array, privateKey: string): Promise<Uint8Array> {\n if (hash.length !== 32) {\n throw new Error('Hash must be 32 bytes long')\n }\n\n const privKey = privateKey.replace('0x', '')\n const pubKey = secp256k1.getPublicKey(privKey, false)\n\n // refer to: https://github.com/paulmillr/noble-secp256k1/tree/1.7.1#signmsghash-privatekey\n const [signature, recoveryId] = await secp256k1.sign(hash, privKey, {\n // recovered - true indicates the recovered bit should be included in the result\n recovered: true,\n // canonical - true makes signatures compatible with libsecp256k1, false makes signatures compatible with openssl\n canonical: true,\n // der - whether the returned signature should be in DER format. If false, it would be in Compact format (32-byte r + 32-byte s)\n der: false,\n // extraEntropy - When true, it would automatically be filled with 32 bytes of cryptographically secure entropy. Strongly recommended to pass true to improve security:\n extraEntropy: true,\n })\n\n const isValid = secp256k1.verify(signature, hash, pubKey, { strict: true })\n if (!isValid) {\n throw new Error('Invalid signature')\n }\n\n return signature\n}\n","import { SignAlgorithm } from './constant'\nexport * from './constant'\nimport * as ed25519 from './ed25519'\nimport * as secp256k1 from './secp256k1'\n\nexport async function signHash(\n hash: Uint8Array,\n privateKey: string | Uint8Array,\n algorithm: SignAlgorithm\n): Promise<Uint8Array> {\n // privKey should be a hex string without 0x prefix\n // refer to: https://github.com/paulmillr/noble-secp256k1/blob/5ed251242bf065aeb22a54bb42eee1f67e7c77ce/index.ts#L130\n const privKey =\n typeof privateKey === 'string' ? privateKey.replace(/^0x/, '') : Buffer.from(privateKey).toString('hex')\n switch (algorithm) {\n case SignAlgorithm.SECP256K1:\n return secp256k1.signHash(hash, privKey)\n break\n case SignAlgorithm.ED25519:\n return ed25519.signHash(hash, privKey)\n break\n default:\n throw new Error(`Unsupported algorithm: ${algorithm}`)\n }\n}\n\nexport { secp256k1, ed25519 }\n","import { NonPromise } from './promise'\n\n/**\n * By declare a unique field `type` in each class, it ensure that the instance of one class can not\n * be assigned to a variable of another class. Furthermore, it also help to distinguish the type of\n * the instance at runtime.\n * By private the constructor, it ensure that the instance of the class can only be created by the\n * static method `from`, and which can enforce the type of the input parameter should not be a promise.\n * Finally, it will be helpful for the compiler to infer the type of the instance and avoid the mistake.\n */\n\n/**\n * TransactionHash represents a transaction hash.\n */\nexport type TransactionHash = string | number\n\n/**\n * Block represents a block.\n */\nexport class Block {\n readonly type = 'Block'\n private constructor(public block: unknown) {}\n static from<T>(raw: NonPromise<T>): Block {\n return new Block(raw)\n }\n}\n\n/**\n * BlockWithTransactions represents a block with transactions.\n */\nexport class BlockWithTransactions {\n readonly type = 'BlockWithTransactions'\n private constructor(public block: unknown) {}\n static from<T>(raw: NonPromise<T>): BlockWithTransactions {\n return new BlockWithTransactions(raw)\n }\n}\n\n/**\n * BlockTag represents a block tag.\n */\nexport type BlockTag = string | number\n\n/**\n * Finality represents the finality of a block.\n */\nexport type Finality = 'confirmed' | 'finalized'\n\n/**\n * A union type to represent all the possible types of a transaction.\n */\ntype TransactionTypes =\n | TransactionRequest\n | TransactionResponse\n | TransactionReceipt\n | SignedTransaction\n | TransactionPending\n\n/**\n * TransactionRequest represents the request of a transaction.\n */\nexport class TransactionRequest {\n readonly type = 'TransactionRequest'\n private constructor(public request: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionRequest {\n return new TransactionRequest(raw)\n }\n}\n\n/**\n * TransactionResponse represents the response of a transaction.\n */\nexport class TransactionResponse {\n readonly type = 'TransactionResponse'\n private constructor(public response: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionResponse {\n return new TransactionResponse(raw)\n }\n}\n\n/**\n * TransactionReceipt represents the receipt of a transaction.\n */\nexport class TransactionReceipt {\n readonly type = 'TransactionReceipt'\n private constructor(public receipt: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionReceipt {\n return new TransactionReceipt(raw)\n }\n}\n\n/**\n * SignedTransaction represents a signed transaction.\n */\nexport class SignedTransaction {\n readonly type = 'SignedTransaction'\n private constructor(public signed: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): SignedTransaction {\n return new SignedTransaction(raw)\n }\n}\n\n/**\n * TransactionPending represents a pending transaction.\n */\nexport class TransactionPending {\n readonly type = 'TransactionPending'\n private constructor(public pending: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionPending {\n return new TransactionPending(raw)\n }\n}\n","import { Provider } from './provider'\nimport { SignedTransaction, TransactionPending, TransactionReceipt, TransactionRequest } from './transaction'\n\nexport interface Signer {\n /**\n * Connect to a provider\n * @param provider\n */\n connect(provider: Provider): Signer\n\n /**\n * Sign a transaction\n * @param transaction\n */\n signTransaction(transaction: TransactionRequest): Promise<SignedTransaction>\n\n /**\n * Send a transaction\n * @param transaction\n * @param sendOptions\n */\n sendTransaction(transaction: SignedTransaction, sendOptions?: unknown): Promise<TransactionPending>\n\n /**\n * Send a transaction and wait for confirmation\n * @param transaction\n * @param opts\n */\n sendAndConfirm(transaction: SignedTransaction, opts?: unknown): Promise<TransactionReceipt>\n\n /**\n * Sign a buffer (e.g. a message hash)\n */\n signBuffer(buffer: Uint8Array): Promise<Uint8Array>\n\n /**\n * returns the address of the signer\n */\n getAddress(): Promise<string>\n\n /**\n * Native signer object\n */\n native: unknown\n}\n\nexport interface Connectable<T> {\n connect<U>(provider: U): T\n}\n\nexport function isConnectable<T>(obj: unknown): obj is Connectable<T> {\n if (typeof obj !== 'object' || obj === null) return false\n const fn = (obj as { connect?: unknown }).connect\n return typeof fn === 'function' && typeof fn.length === 'number' && fn.length === 1\n}\n"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
declare function keccak_256(message: Uint8Array | string): Uint8Array;
|
|
2
|
+
declare function blake2b(message: Uint8Array | string): Uint8Array;
|
|
3
|
+
declare function sha3_256(message: Uint8Array | string): Uint8Array;
|
|
4
|
+
declare function sha2_256(message: Uint8Array | string): Uint8Array;
|
|
5
|
+
|
|
6
|
+
declare enum SignAlgorithm {
|
|
7
|
+
NATIVE = 0,
|
|
8
|
+
SECP256K1 = 1,
|
|
9
|
+
ED25519 = 2
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Sign a hash using ed25519
|
|
14
|
+
* @param hash - 32 bytes long
|
|
15
|
+
* @param privateKey - private key in hex format
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
declare function signHash$2(hash: Uint8Array, privateKey: string): Promise<Uint8Array>;
|
|
19
|
+
|
|
20
|
+
declare namespace ed25519 {
|
|
21
|
+
export { signHash$2 as signHash };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Sign a hash using secp256k1
|
|
26
|
+
* @param hash - 32 bytes long
|
|
27
|
+
* @param privateKey - private key in hex format
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
declare function signHash$1(hash: Uint8Array, privateKey: string): Promise<Uint8Array>;
|
|
31
|
+
|
|
32
|
+
declare namespace secp256k1 {
|
|
33
|
+
export { signHash$1 as signHash };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare function signHash(hash: Uint8Array, privateKey: string | Uint8Array, algorithm: SignAlgorithm): Promise<Uint8Array>;
|
|
37
|
+
|
|
1
38
|
type NonPromise<T> = T extends Promise<unknown> ? never : T;
|
|
2
39
|
|
|
3
40
|
/**
|
|
@@ -89,6 +126,11 @@ declare class TransactionPending {
|
|
|
89
126
|
}
|
|
90
127
|
|
|
91
128
|
interface Provider {
|
|
129
|
+
/**
|
|
130
|
+
* the url of the provider
|
|
131
|
+
* @returns string
|
|
132
|
+
*/
|
|
133
|
+
url: string;
|
|
92
134
|
/**
|
|
93
135
|
* Get the block specified by blockTag
|
|
94
136
|
* @param {BlockTag} [blockTag]
|
|
@@ -192,4 +234,4 @@ interface Connectable<T> {
|
|
|
192
234
|
}
|
|
193
235
|
declare function isConnectable<T>(obj: unknown): obj is Connectable<T>;
|
|
194
236
|
|
|
195
|
-
export { Block, type BlockTag, BlockWithTransactions, type Connectable, type Finality, type Provider, SignedTransaction, type Signer, type TransactionHash, TransactionPending, TransactionReceipt, TransactionRequest, TransactionResponse, isConnectable };
|
|
237
|
+
export { Block, type BlockTag, BlockWithTransactions, type Connectable, type Finality, type Provider, SignAlgorithm, SignedTransaction, type Signer, type TransactionHash, TransactionPending, TransactionReceipt, TransactionRequest, TransactionResponse, blake2b, ed25519, isConnectable, keccak_256, secp256k1, sha2_256, sha3_256, signHash };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
declare function keccak_256(message: Uint8Array | string): Uint8Array;
|
|
2
|
+
declare function blake2b(message: Uint8Array | string): Uint8Array;
|
|
3
|
+
declare function sha3_256(message: Uint8Array | string): Uint8Array;
|
|
4
|
+
declare function sha2_256(message: Uint8Array | string): Uint8Array;
|
|
5
|
+
|
|
6
|
+
declare enum SignAlgorithm {
|
|
7
|
+
NATIVE = 0,
|
|
8
|
+
SECP256K1 = 1,
|
|
9
|
+
ED25519 = 2
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Sign a hash using ed25519
|
|
14
|
+
* @param hash - 32 bytes long
|
|
15
|
+
* @param privateKey - private key in hex format
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
declare function signHash$2(hash: Uint8Array, privateKey: string): Promise<Uint8Array>;
|
|
19
|
+
|
|
20
|
+
declare namespace ed25519 {
|
|
21
|
+
export { signHash$2 as signHash };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Sign a hash using secp256k1
|
|
26
|
+
* @param hash - 32 bytes long
|
|
27
|
+
* @param privateKey - private key in hex format
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
declare function signHash$1(hash: Uint8Array, privateKey: string): Promise<Uint8Array>;
|
|
31
|
+
|
|
32
|
+
declare namespace secp256k1 {
|
|
33
|
+
export { signHash$1 as signHash };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare function signHash(hash: Uint8Array, privateKey: string | Uint8Array, algorithm: SignAlgorithm): Promise<Uint8Array>;
|
|
37
|
+
|
|
1
38
|
type NonPromise<T> = T extends Promise<unknown> ? never : T;
|
|
2
39
|
|
|
3
40
|
/**
|
|
@@ -89,6 +126,11 @@ declare class TransactionPending {
|
|
|
89
126
|
}
|
|
90
127
|
|
|
91
128
|
interface Provider {
|
|
129
|
+
/**
|
|
130
|
+
* the url of the provider
|
|
131
|
+
* @returns string
|
|
132
|
+
*/
|
|
133
|
+
url: string;
|
|
92
134
|
/**
|
|
93
135
|
* Get the block specified by blockTag
|
|
94
136
|
* @param {BlockTag} [blockTag]
|
|
@@ -192,4 +234,4 @@ interface Connectable<T> {
|
|
|
192
234
|
}
|
|
193
235
|
declare function isConnectable<T>(obj: unknown): obj is Connectable<T>;
|
|
194
236
|
|
|
195
|
-
export { Block, type BlockTag, BlockWithTransactions, type Connectable, type Finality, type Provider, SignedTransaction, type Signer, type TransactionHash, TransactionPending, TransactionReceipt, TransactionRequest, TransactionResponse, isConnectable };
|
|
237
|
+
export { Block, type BlockTag, BlockWithTransactions, type Connectable, type Finality, type Provider, SignAlgorithm, SignedTransaction, type Signer, type TransactionHash, TransactionPending, TransactionReceipt, TransactionRequest, TransactionResponse, blake2b, ed25519, isConnectable, keccak_256, secp256k1, sha2_256, sha3_256, signHash };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,94 @@
|
|
|
1
|
+
import { blake2b as blake2b$1 } from '@noble/hashes/blake2b';
|
|
2
|
+
import { sha256 } from '@noble/hashes/sha256';
|
|
3
|
+
import { keccak_256 as keccak_256$1, sha3_256 as sha3_256$1 } from '@noble/hashes/sha3';
|
|
4
|
+
import * as ed25519 from '@noble/ed25519';
|
|
5
|
+
import * as secp256k1 from '@noble/secp256k1';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
function keccak_256(message) {
|
|
13
|
+
return keccak_256$1(message);
|
|
14
|
+
}
|
|
15
|
+
function blake2b(message) {
|
|
16
|
+
return blake2b$1(message);
|
|
17
|
+
}
|
|
18
|
+
function sha3_256(message) {
|
|
19
|
+
return sha3_256$1(message);
|
|
20
|
+
}
|
|
21
|
+
function sha2_256(message) {
|
|
22
|
+
return sha256(message);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/sign/constant.ts
|
|
26
|
+
var SignAlgorithm = /* @__PURE__ */ ((SignAlgorithm2) => {
|
|
27
|
+
SignAlgorithm2[SignAlgorithm2["NATIVE"] = 0] = "NATIVE";
|
|
28
|
+
SignAlgorithm2[SignAlgorithm2["SECP256K1"] = 1] = "SECP256K1";
|
|
29
|
+
SignAlgorithm2[SignAlgorithm2["ED25519"] = 2] = "ED25519";
|
|
30
|
+
return SignAlgorithm2;
|
|
31
|
+
})(SignAlgorithm || {});
|
|
32
|
+
|
|
33
|
+
// src/sign/ed25519.ts
|
|
34
|
+
var ed25519_exports = {};
|
|
35
|
+
__export(ed25519_exports, {
|
|
36
|
+
signHash: () => signHash
|
|
37
|
+
});
|
|
38
|
+
async function signHash(hash, privateKey) {
|
|
39
|
+
if (hash.length !== 32) {
|
|
40
|
+
throw new Error("Hash must be 32 bytes long");
|
|
41
|
+
}
|
|
42
|
+
const pubKey = await ed25519.getPublicKey(privateKey);
|
|
43
|
+
const signature = await ed25519.sign(hash, privateKey);
|
|
44
|
+
const isValid = await ed25519.verify(signature, hash, pubKey);
|
|
45
|
+
if (!isValid) {
|
|
46
|
+
throw new Error("Invalid signature");
|
|
47
|
+
}
|
|
48
|
+
return signature;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/sign/secp256k1.ts
|
|
52
|
+
var secp256k1_exports = {};
|
|
53
|
+
__export(secp256k1_exports, {
|
|
54
|
+
signHash: () => signHash2
|
|
55
|
+
});
|
|
56
|
+
async function signHash2(hash, privateKey) {
|
|
57
|
+
if (hash.length !== 32) {
|
|
58
|
+
throw new Error("Hash must be 32 bytes long");
|
|
59
|
+
}
|
|
60
|
+
const privKey = privateKey.replace("0x", "");
|
|
61
|
+
const pubKey = secp256k1.getPublicKey(privKey, false);
|
|
62
|
+
const [signature, recoveryId] = await secp256k1.sign(hash, privKey, {
|
|
63
|
+
// recovered - true indicates the recovered bit should be included in the result
|
|
64
|
+
recovered: true,
|
|
65
|
+
// canonical - true makes signatures compatible with libsecp256k1, false makes signatures compatible with openssl
|
|
66
|
+
canonical: true,
|
|
67
|
+
// der - whether the returned signature should be in DER format. If false, it would be in Compact format (32-byte r + 32-byte s)
|
|
68
|
+
der: false,
|
|
69
|
+
// extraEntropy - When true, it would automatically be filled with 32 bytes of cryptographically secure entropy. Strongly recommended to pass true to improve security:
|
|
70
|
+
extraEntropy: true
|
|
71
|
+
});
|
|
72
|
+
const isValid = secp256k1.verify(signature, hash, pubKey, { strict: true });
|
|
73
|
+
if (!isValid) {
|
|
74
|
+
throw new Error("Invalid signature");
|
|
75
|
+
}
|
|
76
|
+
return signature;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// src/sign/index.ts
|
|
80
|
+
async function signHash3(hash, privateKey, algorithm) {
|
|
81
|
+
const privKey = typeof privateKey === "string" ? privateKey.replace(/^0x/, "") : Buffer.from(privateKey).toString("hex");
|
|
82
|
+
switch (algorithm) {
|
|
83
|
+
case 1 /* SECP256K1 */:
|
|
84
|
+
return signHash2(hash, privKey);
|
|
85
|
+
case 2 /* ED25519 */:
|
|
86
|
+
return signHash(hash, privKey);
|
|
87
|
+
default:
|
|
88
|
+
throw new Error(`Unsupported algorithm: ${algorithm}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
1
92
|
// src/transaction.ts
|
|
2
93
|
var Block = class _Block {
|
|
3
94
|
constructor(block) {
|
|
@@ -71,6 +162,6 @@ function isConnectable(obj) {
|
|
|
71
162
|
return typeof fn === "function" && typeof fn.length === "number" && fn.length === 1;
|
|
72
163
|
}
|
|
73
164
|
|
|
74
|
-
export { Block, BlockWithTransactions, SignedTransaction, TransactionPending, TransactionReceipt, TransactionRequest, TransactionResponse, isConnectable };
|
|
165
|
+
export { Block, BlockWithTransactions, SignAlgorithm, SignedTransaction, TransactionPending, TransactionReceipt, TransactionRequest, TransactionResponse, blake2b, ed25519_exports as ed25519, isConnectable, keccak_256, secp256k1_exports as secp256k1, sha2_256, sha3_256, signHash3 as signHash };
|
|
75
166
|
//# sourceMappingURL=out.js.map
|
|
76
167
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/transaction.ts","../src/signer.ts"],"names":[],"mappings":";AAmBO,IAAM,QAAN,MAAM,OAAM;AAAA,EAEP,YAAmB,OAAgB;AAAhB;AAD3B,SAAS,OAAO;AAAA,EAC4B;AAAA,EAC5C,OAAO,KAAQ,KAA2B;AACtC,WAAO,IAAI,O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,QAAM,KAAM,IAA8B;AAC1C,SAAO,OAAO,OAAO,cAAc,OAAO,GAAG,WAAW,YAAY,GAAG,WAAW;AACtF","sourcesContent":["import { NonPromise } from './promise'\n\n/**\n * By declare a unique field `type` in each class, it ensure that the instance of one class can not\n * be assigned to a variable of another class. Furthermore, it also help to distinguish the type of\n * the instance at runtime.\n * By private the constructor, it ensure that the instance of the class can only be created by the\n * static method `from`, and which can enforce the type of the input parameter should not be a promise.\n * Finally, it will be helpful for the compiler to infer the type of the instance and avoid the mistake.\n */\n\n/**\n * TransactionHash represents a transaction hash.\n */\nexport type TransactionHash = string | number\n\n/**\n * Block represents a block.\n */\nexport class Block {\n readonly type = 'Block'\n private constructor(public block: unknown) {}\n static from<T>(raw: NonPromise<T>): Block {\n return new Block(raw)\n }\n}\n\n/**\n * BlockWithTransactions represents a block with transactions.\n */\nexport class BlockWithTransactions {\n readonly type = 'BlockWithTransactions'\n private constructor(public block: unknown) {}\n static from<T>(raw: NonPromise<T>): BlockWithTransactions {\n return new BlockWithTransactions(raw)\n }\n}\n\n/**\n * BlockTag represents a block tag.\n */\nexport type BlockTag = string | number\n\n/**\n * Finality represents the finality of a block.\n */\nexport type Finality = 'confirmed' | 'finalized'\n\n/**\n * A union type to represent all the possible types of a transaction.\n */\ntype TransactionTypes =\n | TransactionRequest\n | TransactionResponse\n | TransactionReceipt\n | SignedTransaction\n | TransactionPending\n\n/**\n * TransactionRequest represents the request of a transaction.\n */\nexport class TransactionRequest {\n readonly type = 'TransactionRequest'\n private constructor(public request: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionRequest {\n return new TransactionRequest(raw)\n }\n}\n\n/**\n * TransactionResponse represents the response of a transaction.\n */\nexport class TransactionResponse {\n readonly type = 'TransactionResponse'\n private constructor(public response: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionResponse {\n return new TransactionResponse(raw)\n }\n}\n\n/**\n * TransactionReceipt represents the receipt of a transaction.\n */\nexport class TransactionReceipt {\n readonly type = 'TransactionReceipt'\n private constructor(public receipt: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionReceipt {\n return new TransactionReceipt(raw)\n }\n}\n\n/**\n * SignedTransaction represents a signed transaction.\n */\nexport class SignedTransaction {\n readonly type = 'SignedTransaction'\n private constructor(public signed: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): SignedTransaction {\n return new SignedTransaction(raw)\n }\n}\n\n/**\n * TransactionPending represents a pending transaction.\n */\nexport class TransactionPending {\n readonly type = 'TransactionPending'\n private constructor(public pending: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionPending {\n return new TransactionPending(raw)\n }\n}\n","import { Provider } from './provider'\nimport { SignedTransaction, TransactionPending, TransactionReceipt, TransactionRequest } from './transaction'\n\nexport interface Signer {\n /**\n * Connect to a provider\n * @param provider\n */\n connect(provider: Provider): Signer\n\n /**\n * Sign a transaction\n * @param transaction\n */\n signTransaction(transaction: TransactionRequest): Promise<SignedTransaction>\n\n /**\n * Send a transaction\n * @param transaction\n * @param sendOptions\n */\n sendTransaction(transaction: SignedTransaction, sendOptions?: unknown): Promise<TransactionPending>\n\n /**\n * Send a transaction and wait for confirmation\n * @param transaction\n * @param opts\n */\n sendAndConfirm(transaction: SignedTransaction, opts?: unknown): Promise<TransactionReceipt>\n\n /**\n * Sign a buffer (e.g. a message hash)\n */\n signBuffer(buffer: Uint8Array): Promise<Uint8Array>\n\n /**\n * returns the address of the signer\n */\n getAddress(): Promise<string>\n\n /**\n * Native signer object\n */\n native: unknown\n}\n\nexport interface Connectable<T> {\n connect<U>(provider: U): T\n}\n\nexport function isConnectable<T>(obj: unknown): obj is Connectable<T> {\n if (typeof obj !== 'object' || obj === null) return false\n const fn = (obj as { connect?: unknown }).connect\n return typeof fn === 'function' && typeof fn.length === 'number' && fn.length === 1\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/hash/index.ts","../src/sign/constant.ts","../src/sign/ed25519.ts","../src/sign/secp256k1.ts","../src/sign/index.ts","../src/transaction.ts","../src/signer.ts"],"names":["SignAlgorithm","signHash"],"mappings":";;;;;;;AAAA,SAAS,WAAW,gBAAgB;AACpC,SAAS,UAAU,eAAe;AAClC,SAAS,cAAc,aAAa,YAAY,iBAAiB;AAE1D,SAAS,WAAW,SAA0C;AACjE,SAAO,YAAY,OAAO;AAC9B;AAEO,SAAS,QAAQ,SAA0C;AAC9D,SAAO,SAAS,OAAO;AAC3B;AAEO,SAAS,SAAS,SAA0C;AAC/D,SAAO,UAAU,OAAO;AAC5B;AAEO,SAAS,SAAS,SAA0C;AAC/D,SAAO,QAAQ,OAAO;AAC1B;;;AClBO,IAAK,gBAAL,kBAAKA,mBAAL;AACH,EAAAA,8BAAA;AACA,EAAAA,8BAAA;AACA,EAAAA,8BAAA;AAHQ,SAAAA;AAAA,GAAA;;;ACAZ;AAAA;AAAA;AAAA;AAAA,YAAY,aAAa;AAQzB,eAAsB,SAAS,MAAkB,YAAyC;AACtF,MAAI,KAAK,WAAW,IAAI;AACpB,UAAM,IAAI,MAAM,4BAA4B;AAAA,EAChD;AAEA,QAAM,SAAS,MAAc,qBAAa,UAAU;AACpD,QAAM,YAAY,MAAc,aAAK,MAAM,UAAU;AACrD,QAAM,UAAU,MAAc,eAAO,WAAW,MAAM,MAAM;AAC5D,MAAI,CAAC,SAAS;AACV,UAAM,IAAI,MAAM,mBAAmB;AAAA,EACvC;AAEA,SAAO;AACX;;;ACrBA;AAAA;AAAA,kBAAAC;AAAA;AAAA,YAAY,eAAe;AAQ3B,eAAsBA,UAAS,MAAkB,YAAyC;AACtF,MAAI,KAAK,WAAW,IAAI;AACpB,UAAM,IAAI,MAAM,4BAA4B;AAAA,EAChD;AAEA,QAAM,UAAU,WAAW,QAAQ,MAAM,EAAE;AAC3C,QAAM,SAAmB,uBAAa,SAAS,KAAK;AAGpD,QAAM,CAAC,WAAW,UAAU,IAAI,MAAgB,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mB;AAAnB;AAD3B,SAAS,OAAO;AAAA,EAC+B;AAAA,EAC/C,OAAO,KAAQ,KAAoE;AAC/E,WAAO,IAAI,qBAAoB,GAAG;AAAA,EACtC;AACJ;AAKO,IAAM,qBAAN,MAAM,oBAAmB;AAAA,EAEpB,YAAmB,SAAkB;AAAlB;AAD3B,SAAS,OAAO;AAAA,EAC8B;AAAA,EAC9C,OAAO,KAAQ,KAAmE;AAC9E,WAAO,IAAI,oBAAmB,GAAG;AAAA,EACrC;AACJ;AAKO,IAAM,oBAAN,MAAM,mBAAkB;AAAA,EAEnB,YAAmB,QAAiB;AAAjB;AAD3B,SAAS,OAAO;AAAA,EAC6B;AAAA,EAC7C,OAAO,KAAQ,KAAkE;AAC7E,WAAO,IAAI,mBAAkB,GAAG;AAAA,EACpC;AACJ;AAKO,IAAM,qBAAN,MAAM,oBAAmB;AAAA,EAEpB,YAAmB,SAAkB;AAAlB;AAD3B,SAAS,OAAO;AAAA,EAC8B;AAAA,EAC9C,OAAO,KAAQ,KAAmE;AAC9E,WAAO,IAAI,oBAAmB,GAAG;AAAA,EACrC;AACJ;;;AC7DO,SAAS,cAAiB,KAAqC;AAClE,MAAI,OAAO,QAAQ,YAAY,QAAQ;AAAM,WAAO;AACpD,QAAM,KAAM,IAA8B;AAC1C,SAAO,OAAO,OAAO,cAAc,OAAO,GAAG,WAAW,YAAY,GAAG,WAAW;AACtF","sourcesContent":["import { blake2b as _blake2b } from '@noble/hashes/blake2b'\nimport { sha256 as _sha256 } from '@noble/hashes/sha256'\nimport { keccak_256 as _keccak_256, sha3_256 as _sha3_256 } from '@noble/hashes/sha3'\n\nexport function keccak_256(message: Uint8Array | string): Uint8Array {\n return _keccak_256(message)\n}\n\nexport function blake2b(message: Uint8Array | string): Uint8Array {\n return _blake2b(message)\n}\n\nexport function sha3_256(message: Uint8Array | string): Uint8Array {\n return _sha3_256(message)\n}\n\nexport function sha2_256(message: Uint8Array | string): Uint8Array {\n return _sha256(message)\n}\n","export enum SignAlgorithm {\n NATIVE,\n SECP256K1,\n ED25519,\n}\n","import * as ed25519 from '@noble/ed25519'\n\n/**\n * Sign a hash using ed25519\n * @param hash - 32 bytes long\n * @param privateKey - private key in hex format\n * @returns\n */\nexport async function signHash(hash: Uint8Array, privateKey: string): Promise<Uint8Array> {\n if (hash.length !== 32) {\n throw new Error('Hash must be 32 bytes long')\n }\n\n const pubKey = await ed25519.getPublicKey(privateKey)\n const signature = await ed25519.sign(hash, privateKey)\n const isValid = await ed25519.verify(signature, hash, pubKey)\n if (!isValid) {\n throw new Error('Invalid signature')\n }\n\n return signature\n}\n","import * as secp256k1 from '@noble/secp256k1'\n\n/**\n * Sign a hash using secp256k1\n * @param hash - 32 bytes long\n * @param privateKey - private key in hex format\n * @returns\n */\nexport async function signHash(hash: Uint8Array, privateKey: string): Promise<Uint8Array> {\n if (hash.length !== 32) {\n throw new Error('Hash must be 32 bytes long')\n }\n\n const privKey = privateKey.replace('0x', '')\n const pubKey = secp256k1.getPublicKey(privKey, false)\n\n // refer to: https://github.com/paulmillr/noble-secp256k1/tree/1.7.1#signmsghash-privatekey\n const [signature, recoveryId] = await secp256k1.sign(hash, privKey, {\n // recovered - true indicates the recovered bit should be included in the result\n recovered: true,\n // canonical - true makes signatures compatible with libsecp256k1, false makes signatures compatible with openssl\n canonical: true,\n // der - whether the returned signature should be in DER format. If false, it would be in Compact format (32-byte r + 32-byte s)\n der: false,\n // extraEntropy - When true, it would automatically be filled with 32 bytes of cryptographically secure entropy. Strongly recommended to pass true to improve security:\n extraEntropy: true,\n })\n\n const isValid = secp256k1.verify(signature, hash, pubKey, { strict: true })\n if (!isValid) {\n throw new Error('Invalid signature')\n }\n\n return signature\n}\n","import { SignAlgorithm } from './constant'\nexport * from './constant'\nimport * as ed25519 from './ed25519'\nimport * as secp256k1 from './secp256k1'\n\nexport async function signHash(\n hash: Uint8Array,\n privateKey: string | Uint8Array,\n algorithm: SignAlgorithm\n): Promise<Uint8Array> {\n // privKey should be a hex string without 0x prefix\n // refer to: https://github.com/paulmillr/noble-secp256k1/blob/5ed251242bf065aeb22a54bb42eee1f67e7c77ce/index.ts#L130\n const privKey =\n typeof privateKey === 'string' ? privateKey.replace(/^0x/, '') : Buffer.from(privateKey).toString('hex')\n switch (algorithm) {\n case SignAlgorithm.SECP256K1:\n return secp256k1.signHash(hash, privKey)\n break\n case SignAlgorithm.ED25519:\n return ed25519.signHash(hash, privKey)\n break\n default:\n throw new Error(`Unsupported algorithm: ${algorithm}`)\n }\n}\n\nexport { secp256k1, ed25519 }\n","import { NonPromise } from './promise'\n\n/**\n * By declare a unique field `type` in each class, it ensure that the instance of one class can not\n * be assigned to a variable of another class. Furthermore, it also help to distinguish the type of\n * the instance at runtime.\n * By private the constructor, it ensure that the instance of the class can only be created by the\n * static method `from`, and which can enforce the type of the input parameter should not be a promise.\n * Finally, it will be helpful for the compiler to infer the type of the instance and avoid the mistake.\n */\n\n/**\n * TransactionHash represents a transaction hash.\n */\nexport type TransactionHash = string | number\n\n/**\n * Block represents a block.\n */\nexport class Block {\n readonly type = 'Block'\n private constructor(public block: unknown) {}\n static from<T>(raw: NonPromise<T>): Block {\n return new Block(raw)\n }\n}\n\n/**\n * BlockWithTransactions represents a block with transactions.\n */\nexport class BlockWithTransactions {\n readonly type = 'BlockWithTransactions'\n private constructor(public block: unknown) {}\n static from<T>(raw: NonPromise<T>): BlockWithTransactions {\n return new BlockWithTransactions(raw)\n }\n}\n\n/**\n * BlockTag represents a block tag.\n */\nexport type BlockTag = string | number\n\n/**\n * Finality represents the finality of a block.\n */\nexport type Finality = 'confirmed' | 'finalized'\n\n/**\n * A union type to represent all the possible types of a transaction.\n */\ntype TransactionTypes =\n | TransactionRequest\n | TransactionResponse\n | TransactionReceipt\n | SignedTransaction\n | TransactionPending\n\n/**\n * TransactionRequest represents the request of a transaction.\n */\nexport class TransactionRequest {\n readonly type = 'TransactionRequest'\n private constructor(public request: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionRequest {\n return new TransactionRequest(raw)\n }\n}\n\n/**\n * TransactionResponse represents the response of a transaction.\n */\nexport class TransactionResponse {\n readonly type = 'TransactionResponse'\n private constructor(public response: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionResponse {\n return new TransactionResponse(raw)\n }\n}\n\n/**\n * TransactionReceipt represents the receipt of a transaction.\n */\nexport class TransactionReceipt {\n readonly type = 'TransactionReceipt'\n private constructor(public receipt: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionReceipt {\n return new TransactionReceipt(raw)\n }\n}\n\n/**\n * SignedTransaction represents a signed transaction.\n */\nexport class SignedTransaction {\n readonly type = 'SignedTransaction'\n private constructor(public signed: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): SignedTransaction {\n return new SignedTransaction(raw)\n }\n}\n\n/**\n * TransactionPending represents a pending transaction.\n */\nexport class TransactionPending {\n readonly type = 'TransactionPending'\n private constructor(public pending: unknown) {}\n static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionPending {\n return new TransactionPending(raw)\n }\n}\n","import { Provider } from './provider'\nimport { SignedTransaction, TransactionPending, TransactionReceipt, TransactionRequest } from './transaction'\n\nexport interface Signer {\n /**\n * Connect to a provider\n * @param provider\n */\n connect(provider: Provider): Signer\n\n /**\n * Sign a transaction\n * @param transaction\n */\n signTransaction(transaction: TransactionRequest): Promise<SignedTransaction>\n\n /**\n * Send a transaction\n * @param transaction\n * @param sendOptions\n */\n sendTransaction(transaction: SignedTransaction, sendOptions?: unknown): Promise<TransactionPending>\n\n /**\n * Send a transaction and wait for confirmation\n * @param transaction\n * @param opts\n */\n sendAndConfirm(transaction: SignedTransaction, opts?: unknown): Promise<TransactionReceipt>\n\n /**\n * Sign a buffer (e.g. a message hash)\n */\n signBuffer(buffer: Uint8Array): Promise<Uint8Array>\n\n /**\n * returns the address of the signer\n */\n getAddress(): Promise<string>\n\n /**\n * Native signer object\n */\n native: unknown\n}\n\nexport interface Connectable<T> {\n connect<U>(provider: U): T\n}\n\nexport function isConnectable<T>(obj: unknown): obj is Connectable<T> {\n if (typeof obj !== 'object' || obj === null) return false\n const fn = (obj as { connect?: unknown }).connect\n return typeof fn === 'function' && typeof fn.length === 'number' && fn.length === 1\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/lz-core",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.43",
|
|
4
4
|
"description": "LayerZero Core Library",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"exports": {
|
|
@@ -23,12 +23,15 @@
|
|
|
23
23
|
"clean-prebuild": "rimraf dist"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
+
"@noble/ed25519": "^1.7.1",
|
|
27
|
+
"@noble/hashes": "^1.3.2",
|
|
28
|
+
"@noble/secp256k1": "^1.7.1",
|
|
26
29
|
"tiny-invariant": "^1.3.1"
|
|
27
30
|
},
|
|
28
31
|
"devDependencies": {
|
|
29
32
|
"@jest/globals": "^29.7.0",
|
|
30
|
-
"@layerzerolabs/tsup-config-next": "
|
|
31
|
-
"@layerzerolabs/typescript-config-next": "
|
|
33
|
+
"@layerzerolabs/tsup-config-next": "workspace:^",
|
|
34
|
+
"@layerzerolabs/typescript-config-next": "workspace:^",
|
|
32
35
|
"@types/jest": "^29.5.10",
|
|
33
36
|
"jest": "^29.7.0",
|
|
34
37
|
"rimraf": "^5.0.5",
|
|
@@ -39,4 +42,4 @@
|
|
|
39
42
|
"publishConfig": {
|
|
40
43
|
"access": "public"
|
|
41
44
|
}
|
|
42
|
-
}
|
|
45
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
# @layerzerolabs/lz-core
|
|
2
|
-
|
|
3
|
-
## 2.3.41
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- b01c51c: mainnet: Reya
|
|
8
|
-
|
|
9
|
-
## 2.3.40
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- c631c6e: mainnet: Ape chain endpoint
|
|
14
|
-
|
|
15
|
-
## 2.3.39
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- 01a6cb7: testnets: bitlayer, dm2verse, story
|
|
20
|
-
|
|
21
|
-
## 2.3.38
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- 5ddfb3b: remove `OFT_DEFAULT_PROGRAM_ID` from soalan sdk
|
|
26
|
-
|
|
27
|
-
## 2.3.37
|
|
28
|
-
|
|
29
|
-
### Patch Changes
|
|
30
|
-
|
|
31
|
-
- 883c143: mainnet endpoints: Lyra, Codex, testnets: root redeploy, reya
|
|
32
|
-
|
|
33
|
-
## 2.3.36
|
|
34
|
-
|
|
35
|
-
### Patch Changes
|
|
36
|
-
|
|
37
|
-
- 291ef75: fix solana sdk
|
|
38
|
-
|
|
39
|
-
## 2.3.35
|
|
40
|
-
|
|
41
|
-
### Patch Changes
|
|
42
|
-
|
|
43
|
-
- 9913f53: new endpoints
|
|
44
|
-
- 21a267f: testnets: otherworld, abstract, root
|
|
45
|
-
|
|
46
|
-
## 2.3.35-aptos.0
|
|
47
|
-
|
|
48
|
-
### Patch Changes
|
|
49
|
-
|
|
50
|
-
- 7744b25: Add Aptos v1 support in testify, all tests passed.
|
|
51
|
-
|
|
52
|
-
## 2.3.34
|
|
53
|
-
|
|
54
|
-
### Patch Changes
|
|
55
|
-
|
|
56
|
-
- 5a99681: Fix an issue in Solana
|
|
57
|
-
|
|
58
|
-
## 2.3.33
|
|
59
|
-
|
|
60
|
-
### Patch Changes
|
|
61
|
-
|
|
62
|
-
- d9c0c10: testnets: new solana devnet, codex(evm), bahamut (evm)
|
|
63
|
-
- 1099b5f: testnets: lif3,iota,lyra,lightlink
|
|
64
|
-
|
|
65
|
-
## 2.3.32
|
|
66
|
-
|
|
67
|
-
### Patch Changes
|
|
68
|
-
|
|
69
|
-
- e846939: testnets: lif3,iota,lyra,lightlink
|
|
70
|
-
- 334b51e: endpoints, including flare mainnet
|
|
71
|
-
- 334b51e: zklink mainnet, and testnets
|
|
72
|
-
- 334b51e: testnet endpoints
|
|
73
|
-
|
|
74
|
-
## 2.3.31
|
|
75
|
-
|
|
76
|
-
### Patch Changes
|
|
77
|
-
|
|
78
|
-
- 29fecfc: testnets: zksyncsep v2 redeploy, curtis
|
|
79
|
-
|
|
80
|
-
## 2.3.30
|
|
81
|
-
|
|
82
|
-
### Patch Changes
|
|
83
|
-
|
|
84
|
-
- 32f8ebd: peaq,zircuit mainnet, and plume testnet
|
|
85
|
-
- b602b9f: peaq,zircuit mainnet, and plume testnet
|
|
86
|
-
|
|
87
|
-
## 2.3.29
|
|
88
|
-
|
|
89
|
-
### Patch Changes
|
|
90
|
-
|
|
91
|
-
- a42fff0: endpoints, including flare mainnet
|
|
92
|
-
- a42fff0: zklink mainnet, and testnets
|
|
93
|
-
- a42fff0: testnet endpoints
|
|
94
|
-
|
|
95
|
-
## 2.3.28
|
|
96
|
-
|
|
97
|
-
### Patch Changes
|
|
98
|
-
|
|
99
|
-
- 23d7ea0: endpoints, including flare mainnet
|
|
100
|
-
- 23d7ea0: zklink mainnet, and testnets
|
|
101
|
-
- 8a40261: Fix some known issues in Solana
|
|
102
|
-
- 23d7ea0: testnet endpoints
|
|
103
|
-
|
|
104
|
-
## 2.3.27
|
|
105
|
-
|
|
106
|
-
### Patch Changes
|
|
107
|
-
|
|
108
|
-
- e382bef: Update the access property of the `hardhat-tron` package
|
|
109
|
-
- d41cbe9: endpoints, including flare mainnet
|
|
110
|
-
- d41cbe9: testnet endpoints
|
|
111
|
-
|
|
112
|
-
## 2.3.26
|
|
113
|
-
|
|
114
|
-
### Patch Changes
|
|
115
|
-
|
|
116
|
-
- 92a9a2e: upgrade solana mainnet executor/uln
|
|
117
|
-
|
|
118
|
-
## 2.3.25
|
|
119
|
-
|
|
120
|
-
### Patch Changes
|
|
121
|
-
|
|
122
|
-
- 003371b: endpoints, including flare mainnet
|
|
123
|
-
- 003371b: testnet endpoints
|
|
124
|
-
|
|
125
|
-
## 2.3.24
|
|
126
|
-
|
|
127
|
-
### Patch Changes
|
|
128
|
-
|
|
129
|
-
- 255da39: Fix some known issues in the OFT SDK
|
|
130
|
-
|
|
131
|
-
## 2.3.23
|
|
132
|
-
|
|
133
|
-
### Patch Changes
|
|
134
|
-
|
|
135
|
-
- 1e42a63: bump version: default distribution tag is `latest`
|
|
136
|
-
- 43c0e8f: endpoints: bouncebit, gravity ... testnet: bartio bera chain
|
|
137
|
-
|
|
138
|
-
## 2.3.22
|
|
139
|
-
|
|
140
|
-
### Patch Changes
|
|
141
|
-
|
|
142
|
-
- 571e2c2: update oft sdk
|
|
143
|
-
|
|
144
|
-
## 2.3.21
|
|
145
|
-
|
|
146
|
-
### Patch Changes
|
|
147
|
-
|
|
148
|
-
- 2a5e6c8: fix some bugs & public lz-solana-sdk-v2 & upgrade @solana/web3.js
|
|
149
|
-
|
|
150
|
-
## 2.3.20
|
|
151
|
-
|
|
152
|
-
### Patch Changes
|
|
153
|
-
|
|
154
|
-
- 1b332c1: endpoints: taiko,joc,xchain,etherlink, testnet:bouncebit
|
|
155
|
-
|
|
156
|
-
## 2.3.19
|
|
157
|
-
|
|
158
|
-
### Patch Changes
|
|
159
|
-
|
|
160
|
-
- 5fce234: minor update & fix some bugs
|
|
161
|
-
|
|
162
|
-
## 2.3.18
|
|
163
|
-
|
|
164
|
-
### Patch Changes
|
|
165
|
-
|
|
166
|
-
- d7ddb1e: Make `solana-sdk` compatible with browsers
|
|
167
|
-
|
|
168
|
-
## 2.3.17
|
|
169
|
-
|
|
170
|
-
### Patch Changes
|
|
171
|
-
|
|
172
|
-
- 7e1d72a: minor update & fix some bugs
|
|
173
|
-
- a255697: SEI mainnet
|
|
174
|
-
|
|
175
|
-
## 2.3.16
|
|
176
|
-
|
|
177
|
-
### Patch Changes
|
|
178
|
-
|
|
179
|
-
- b0ac3fe: deploy & config oft
|
|
180
|
-
|
|
181
|
-
## 2.3.15
|
|
182
|
-
|
|
183
|
-
### Patch Changes
|
|
184
|
-
|
|
185
|
-
- 66c554b: minor update & fix some bugs
|
|
186
|
-
|
|
187
|
-
## 2.3.14
|
|
188
|
-
|
|
189
|
-
### Patch Changes
|
|
190
|
-
|
|
191
|
-
- minor update
|
|
192
|
-
|
|
193
|
-
## 2.3.13
|
|
194
|
-
|
|
195
|
-
### Patch Changes
|
|
196
|
-
|
|
197
|
-
- c294e0e: add missing artifacts
|
|
198
|
-
|
|
199
|
-
## 2.3.12
|
|
200
|
-
|
|
201
|
-
### Patch Changes
|
|
202
|
-
|
|
203
|
-
- 2761d43: minor update & fix some bugs
|
|
204
|
-
|
|
205
|
-
## 2.3.11
|
|
206
|
-
|
|
207
|
-
### Patch Changes
|
|
208
|
-
|
|
209
|
-
- a7ee3c1: mainnet endpoints, cyber, iota
|
|
210
|
-
|
|
211
|
-
## 2.3.10
|
|
212
|
-
|
|
213
|
-
### Patch Changes
|
|
214
|
-
|
|
215
|
-
- b9804e1: export tron and zksync artifacts to sdk
|
|
216
|
-
|
|
217
|
-
## 2.3.9
|
|
218
|
-
|
|
219
|
-
### Patch Changes
|
|
220
|
-
|
|
221
|
-
- c208955: minor update & fix some bugs
|
|
222
|
-
|
|
223
|
-
## 2.3.8
|
|
224
|
-
|
|
225
|
-
### Patch Changes
|
|
226
|
-
|
|
227
|
-
- e0f5d04: deploy contracts to Ebi mainnet
|
|
228
|
-
|
|
229
|
-
## 2.3.7
|
|
230
|
-
|
|
231
|
-
### Patch Changes
|
|
232
|
-
|
|
233
|
-
- 5fa1b78: fix some solana bugs
|
|
234
|
-
|
|
235
|
-
## 2.3.6
|
|
236
|
-
|
|
237
|
-
### Patch Changes
|
|
238
|
-
|
|
239
|
-
- 4a92ba6: send and receive with ULN on solana
|
|
240
|
-
|
|
241
|
-
## 2.3.5
|
|
242
|
-
|
|
243
|
-
### Patch Changes
|
|
244
|
-
|
|
245
|
-
- 20c33bb: tron v2
|
|
246
|
-
|
|
247
|
-
## 2.3.4
|
|
248
|
-
|
|
249
|
-
### Patch Changes
|
|
250
|
-
|
|
251
|
-
- efcf65d: testnet endpoint deployments: Botanix, xchain, ebi
|
|
252
|
-
|
|
253
|
-
## 2.3.3
|
|
254
|
-
|
|
255
|
-
### Patch Changes
|
|
256
|
-
|
|
257
|
-
- 44f13a2: endpoints (mainnet): Skale, Bob, Sanko
|
|
258
|
-
|
|
259
|
-
## 2.3.2
|
|
260
|
-
|
|
261
|
-
### Patch Changes
|
|
262
|
-
|
|
263
|
-
- bd47f83: testnet endpoints: Bob, Cyber
|
|
264
|
-
|
|
265
|
-
## 2.3.1
|
|
266
|
-
|
|
267
|
-
### Patch Changes
|
|
268
|
-
|
|
269
|
-
- c467a80: update RUST_TOOL version and catch errors when checking if chain is ready
|
|
270
|
-
|
|
271
|
-
## 2.3.0
|
|
272
|
-
|
|
273
|
-
### Minor Changes
|
|
274
|
-
|
|
275
|
-
- 211e282: add solana to belowzero & build solana snapshot image
|
|
276
|
-
|
|
277
|
-
## 2.2.6
|
|
278
|
-
|
|
279
|
-
### Patch Changes
|
|
280
|
-
|
|
281
|
-
- 8ecd2dc: endpoints
|
|
282
|
-
|
|
283
|
-
## 2.2.5
|
|
284
|
-
|
|
285
|
-
### Patch Changes
|
|
286
|
-
|
|
287
|
-
- fc047bc: endpoints
|
|
288
|
-
|
|
289
|
-
## 2.2.4
|
|
290
|
-
|
|
291
|
-
### Patch Changes
|
|
292
|
-
|
|
293
|
-
- f525086: add non-tron chain back to testify
|
|
294
|
-
|
|
295
|
-
## 2.2.3
|
|
296
|
-
|
|
297
|
-
### Patch Changes
|
|
298
|
-
|
|
299
|
-
- 4c53623: empty version
|
|
300
|
-
|
|
301
|
-
## 2.2.2
|
|
302
|
-
|
|
303
|
-
### Patch Changes
|
|
304
|
-
|
|
305
|
-
- b04320e: empty version
|
|
306
|
-
|
|
307
|
-
## 2.2.1
|
|
308
|
-
|
|
309
|
-
### Patch Changes
|
|
310
|
-
|
|
311
|
-
- fb15753: new endpoints. 4 testnets xlayer, form, ll1, mantasep, 2 mainnet Merlin, Degen
|
|
312
|
-
|
|
313
|
-
## 2.2.0
|
|
314
|
-
|
|
315
|
-
### Minor Changes
|
|
316
|
-
|
|
317
|
-
- aa51c78: updated sandbox chain keys for frontend
|
|
318
|
-
|
|
319
|
-
## 2.1.27
|
|
320
|
-
|
|
321
|
-
### Patch Changes
|
|
322
|
-
|
|
323
|
-
- 099e19b: internalize common functions and add public onlyOwner passthroughs
|
|
324
|
-
|
|
325
|
-
## 2.1.25
|
|
326
|
-
|
|
327
|
-
### Patch Changes
|
|
328
|
-
|
|
329
|
-
- 57fe209: wire ulnv2 during snapshot build
|
|
330
|
-
|
|
331
|
-
## 2.1.24
|
|
332
|
-
|
|
333
|
-
### Patch Changes
|
|
334
|
-
|
|
335
|
-
- c663d78: remove duplicate `sleep` func
|
|
336
|
-
|
|
337
|
-
## 2.1.23
|
|
338
|
-
|
|
339
|
-
### Patch Changes
|
|
340
|
-
|
|
341
|
-
- c2fc9fe: - update dvn config on blast chain for some dvn partners
|
|
342
|
-
- update OApp, OFT contracts
|