@layerzerolabs/lz-core 3.0.16 → 3.0.18-movement.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @layerzerolabs/lz-core
2
2
 
3
+ ## 3.0.17
4
+
5
+ ### Patch Changes
6
+
7
+ - 40f2269: islander mainnet
8
+ - 40f2269: testnets
9
+
3
10
  ## 3.0.16
4
11
 
5
12
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -109,8 +109,7 @@ var TransactionPending = class _TransactionPending {
109
109
 
110
110
  // src/signer.ts
111
111
  function isConnectable(obj) {
112
- if (typeof obj !== "object" || obj === null)
113
- return false;
112
+ if (typeof obj !== "object" || obj === null) return false;
114
113
  const fn = obj.connect;
115
114
  return typeof fn === "function" && typeof fn.length === "number" && fn.length === 1;
116
115
  }
@@ -123,5 +122,5 @@ exports.TransactionReceipt = TransactionReceipt;
123
122
  exports.TransactionRequest = TransactionRequest;
124
123
  exports.TransactionResponse = TransactionResponse;
125
124
  exports.isConnectable = isConnectable;
126
- //# sourceMappingURL=out.js.map
125
+ //# sourceMappingURL=index.cjs.map
127
126
  //# sourceMappingURL=index.cjs.map
@@ -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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ5C,OAAO,KAAQ,KAA2B;AACtC,WAAO,IAAI,OAAM,GAAG;AAAA,EACxB;AACJ;AAKO,IAAM,wBAAN,MAAM,uBAAsB;AAAA,EAEvB,YAAmB,OAAgB;AAAhB;AAD3B,SAAS,OAAO;AAAA,EAC4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ5C,OAAO,KAAQ,KAA2C;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AQ;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\n /**\n * Creates an instance of Block from a non-promise value.\n *\n * @param {NonPromise<T>} raw - The raw value to create the Block from.\n * @returns {Block} The created Block instance.\n */\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\n /**\n * Creates an instance of BlockWithTransactions from a non-promise value.\n *\n * @param {NonPromise<T>} raw - The raw value to create the BlockWithTransactions from.\n * @returns {BlockWithTransactions} The created BlockWithTransactions instance.\n */\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\n /**\n * Creates an instance of TransactionRequest from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the TransactionRequest from.\n * @returns {TransactionRequest} The created TransactionRequest instance.\n */\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\n /**\n * Creates an instance of TransactionResponse from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the TransactionResponse from.\n * @returns {TransactionResponse} The created TransactionResponse instance.\n */\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\n /**\n * Creates an instance of TransactionReceipt from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the TransactionReceipt from.\n * @returns {TransactionReceipt} The created TransactionReceipt instance.\n */\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\n /**\n * Creates an instance of SignedTransaction from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the SignedTransaction from.\n * @returns {SignedTransaction} The created SignedTransaction instance.\n */\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\n /**\n * Creates an instance of TransactionPending from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the TransactionPending from.\n * @returns {TransactionPending} The created TransactionPending instance.\n */\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\n/**\n * Interface representing a signer.\n *\n * @template T - The type of the transaction request.\n */\nexport interface Signer<T = unknown> {\n /**\n * Connect to a provider.\n *\n * @param {Provider} provider - The provider to connect to.\n * @returns {Signer<T>} The connected signer.\n */\n connect(provider: Provider): Signer<T>\n\n /**\n * Build a transaction.\n *\n * @param {T} buildTxRequest - The transaction request to build.\n * @returns {Promise<TransactionRequest>} A promise that resolves to the built transaction request.\n */\n buildTransaction(buildTxRequest: T): Promise<TransactionRequest>\n\n /**\n * Sign a transaction.\n *\n * @param {TransactionRequest} transaction - The transaction request to sign.\n * @returns {Promise<SignedTransaction>} A promise that resolves to the signed transaction.\n */\n signTransaction(transaction: TransactionRequest): Promise<SignedTransaction>\n\n /**\n * Send a transaction.\n *\n * @param {SignedTransaction} transaction - The signed transaction to send.\n * @param {unknown} [sendOptions] - Optional parameters for sending the transaction.\n * @returns {Promise<TransactionPending>} A promise that resolves to the pending transaction.\n */\n sendTransaction(transaction: SignedTransaction, sendOptions?: unknown): Promise<TransactionPending>\n\n /**\n * Send a transaction and wait for confirmation.\n *\n * @param {SignedTransaction} transaction - The signed transaction to send.\n * @param {unknown} [opts] - Optional parameters for sending and confirming the transaction.\n * @returns {Promise<TransactionReceipt>} A promise that resolves to the transaction receipt.\n */\n sendAndConfirm(transaction: SignedTransaction, opts?: unknown): Promise<TransactionReceipt>\n\n /**\n * Sign a buffer (e.g. a message hash).\n *\n * @param {Uint8Array} buffer - The buffer to sign.\n * @returns {Promise<Uint8Array>} A promise that resolves to the signed buffer.\n */\n signBuffer(buffer: Uint8Array): Promise<Uint8Array>\n\n /**\n * Get the address of the signer.\n * this function NEED to return a Promise because ethers.Signer.getAddress() return a Promise<string>\n *\n * @returns {Promise<string>} A promise that resolves to the address of the signer.\n */\n getAddress(): Promise<string>\n\n /**\n * Native signer object\n */\n native: unknown\n}\n\n/**\n * Interface representing a connectable object.\n *\n * @template T - The type of the connectable object.\n */\nexport interface Connectable<T> {\n /**\n * Connect to a provider.\n *\n * @template U - The type of the provider.\n * @param {U} provider - The provider to connect to.\n * @returns {T} The connected object.\n */\n connect<U>(provider: U): T\n}\n\n/**\n * Check if an object is connectable.\n *\n * @template T - The type of the connectable object.\n * @param {unknown} obj - The object to check.\n * @returns {obj is Connectable<T>} True if the object is connectable, false otherwise.\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/transaction.ts","../src/signer.ts"],"names":[],"mappings":";;;AAmBa,IAAA,KAAA,GAAN,MAAM,MAAM,CAAA;AAAA,EAEP,YAAmB,KAAgB,EAAA;AAAhB,IAAA,IAAA,CAAA,KAAA,GAAA,KAAA;AAD3B,IAAA,IAAA,CAAS,IAAO,GAAA,OAAA;AAAA;AAC4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ5C,OAAO,KAAQ,GAA2B,EAAA;AACtC,IAAO,OAAA,IAAI,OAAM,GAAG,CAAA;AAAA;AAE5B;AAKa,IAAA,qBAAA,GAAN,MAAM,sBAAsB,CAAA;AAAA,EAEvB,YAAmB,KAAgB,EAAA;AAAhB,IAAA,IAAA,CAAA,KAAA,GAAA,KAAA;AAD3B,IAAA,IAAA,CAAS,IAAO,GAAA,uBAAA;AAAA;AAC4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ5C,OAAO,KAAQ,GAA2C,EAAA;AACtD,IAAO,OAAA,IAAI,uBAAsB,GAAG,CAAA;AAAA;AAE5C;AAyBa,IAA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Ka,IAAA,kBAAA,GAAN,MAAM,mBAAmB,CAAA;AAAA,EAEpB,YAAmB,OAAkB,EAAA;AAAlB,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAD3B,IAAA,IAAA,CAAS,IAAO,GAAA,oBAAA;AAAA;AAC8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ9C,OAAO,KAAQ,GAAmE,EAAA;AAC9E,IAAO,OAAA,IAAI,oBAAmB,GAAG,CAAA;AAAA;AAEzC;;;ACzEO,SAAS,cAAiB,GAAqC,EAAA;AAClE,EAAA,IAAI,OAAO,GAAA,KAAQ,QAAY,IAAA,GAAA,KAAQ,MAAa,OAAA,KAAA;AACpD,EAAA,MAAM,KAAM,GAA8B,CAAA,OAAA;AAC1C,EAAO,OAAA,OAAO,OAAO,UAAc,IAAA,OAAO,GAAG,MAAW,KAAA,QAAA,IAAY,GAAG,MAAW,KAAA,CAAA;AACtF","file":"index.cjs","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\n /**\n * Creates an instance of Block from a non-promise value.\n *\n * @param {NonPromise<T>} raw - The raw value to create the Block from.\n * @returns {Block} The created Block instance.\n */\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\n /**\n * Creates an instance of BlockWithTransactions from a non-promise value.\n *\n * @param {NonPromise<T>} raw - The raw value to create the BlockWithTransactions from.\n * @returns {BlockWithTransactions} The created BlockWithTransactions instance.\n */\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\n /**\n * Creates an instance of TransactionRequest from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the TransactionRequest from.\n * @returns {TransactionRequest} The created TransactionRequest instance.\n */\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\n /**\n * Creates an instance of TransactionResponse from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the TransactionResponse from.\n * @returns {TransactionResponse} The created TransactionResponse instance.\n */\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\n /**\n * Creates an instance of TransactionReceipt from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the TransactionReceipt from.\n * @returns {TransactionReceipt} The created TransactionReceipt instance.\n */\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\n /**\n * Creates an instance of SignedTransaction from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the SignedTransaction from.\n * @returns {SignedTransaction} The created SignedTransaction instance.\n */\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\n /**\n * Creates an instance of TransactionPending from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the TransactionPending from.\n * @returns {TransactionPending} The created TransactionPending instance.\n */\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\n/**\n * Interface representing a signer.\n *\n */\nexport interface Signer {\n /**\n * Connect to a provider.\n *\n * @param {Provider} provider - The provider to connect to.\n * @returns {Signer} The connected signer.\n */\n connect(provider: Provider): Signer\n\n /**\n * Sign a transaction.\n *\n * @param {TransactionRequest} transaction - The transaction request to sign.\n * @returns {Promise<SignedTransaction>} A promise that resolves to the signed transaction.\n */\n signTransaction(transaction: TransactionRequest): Promise<SignedTransaction>\n\n /**\n * Send a transaction.\n *\n * @param {SignedTransaction} transaction - The signed transaction to send.\n * @param {unknown} [sendOptions] - Optional parameters for sending the transaction.\n * @returns {Promise<TransactionPending>} A promise that resolves to the pending transaction.\n */\n sendTransaction(transaction: SignedTransaction, sendOptions?: unknown): Promise<TransactionPending>\n\n /**\n * Send a transaction and wait for confirmation.\n *\n * @param {SignedTransaction} transaction - The signed transaction to send.\n * @param {unknown} [opts] - Optional parameters for sending and confirming the transaction.\n * @returns {Promise<TransactionReceipt>} A promise that resolves to the transaction receipt.\n */\n sendAndConfirm(transaction: SignedTransaction, opts?: unknown): Promise<TransactionReceipt>\n\n /**\n * Sign a buffer (e.g. a message hash).\n *\n * @param {Uint8Array} buffer - The buffer to sign.\n * @returns {Promise<Uint8Array>} A promise that resolves to the signed buffer.\n */\n signBuffer(buffer: Uint8Array): Promise<Uint8Array>\n\n /**\n * Get the address of the signer.\n * this function NEED to return a Promise because ethers.Signer.getAddress() return a Promise<string>\n *\n * @returns {Promise<string>} A promise that resolves to the address of the signer.\n */\n getAddress(): Promise<string>\n\n /**\n * Native signer object\n */\n native: unknown\n}\n\n/**\n * Interface representing a connectable object.\n *\n * @template T - The type of the connectable object.\n */\nexport interface Connectable<T> {\n /**\n * Connect to a provider.\n *\n * @template U - The type of the provider.\n * @param {U} provider - The provider to connect to.\n * @returns {T} The connected object.\n */\n connect<U>(provider: U): T\n}\n\n/**\n * Check if an object is connectable.\n *\n * @template T - The type of the connectable object.\n * @param {unknown} obj - The object to check.\n * @returns {obj is Connectable<T>} True if the object is connectable, false otherwise.\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
@@ -232,23 +232,15 @@ interface Provider {
232
232
  /**
233
233
  * Interface representing a signer.
234
234
  *
235
- * @template T - The type of the transaction request.
236
235
  */
237
- interface Signer<T = unknown> {
236
+ interface Signer {
238
237
  /**
239
238
  * Connect to a provider.
240
239
  *
241
240
  * @param {Provider} provider - The provider to connect to.
242
- * @returns {Signer<T>} The connected signer.
241
+ * @returns {Signer} The connected signer.
243
242
  */
244
- connect(provider: Provider): Signer<T>;
245
- /**
246
- * Build a transaction.
247
- *
248
- * @param {T} buildTxRequest - The transaction request to build.
249
- * @returns {Promise<TransactionRequest>} A promise that resolves to the built transaction request.
250
- */
251
- buildTransaction(buildTxRequest: T): Promise<TransactionRequest>;
243
+ connect(provider: Provider): Signer;
252
244
  /**
253
245
  * Sign a transaction.
254
246
  *
package/dist/index.d.ts CHANGED
@@ -232,23 +232,15 @@ interface Provider {
232
232
  /**
233
233
  * Interface representing a signer.
234
234
  *
235
- * @template T - The type of the transaction request.
236
235
  */
237
- interface Signer<T = unknown> {
236
+ interface Signer {
238
237
  /**
239
238
  * Connect to a provider.
240
239
  *
241
240
  * @param {Provider} provider - The provider to connect to.
242
- * @returns {Signer<T>} The connected signer.
241
+ * @returns {Signer} The connected signer.
243
242
  */
244
- connect(provider: Provider): Signer<T>;
245
- /**
246
- * Build a transaction.
247
- *
248
- * @param {T} buildTxRequest - The transaction request to build.
249
- * @returns {Promise<TransactionRequest>} A promise that resolves to the built transaction request.
250
- */
251
- buildTransaction(buildTxRequest: T): Promise<TransactionRequest>;
243
+ connect(provider: Provider): Signer;
252
244
  /**
253
245
  * Sign a transaction.
254
246
  *
package/dist/index.mjs CHANGED
@@ -107,12 +107,11 @@ var TransactionPending = class _TransactionPending {
107
107
 
108
108
  // src/signer.ts
109
109
  function isConnectable(obj) {
110
- if (typeof obj !== "object" || obj === null)
111
- return false;
110
+ if (typeof obj !== "object" || obj === null) return false;
112
111
  const fn = obj.connect;
113
112
  return typeof fn === "function" && typeof fn.length === "number" && fn.length === 1;
114
113
  }
115
114
 
116
115
  export { Block, BlockWithTransactions, SignedTransaction, TransactionPending, TransactionReceipt, TransactionRequest, TransactionResponse, isConnectable };
117
- //# sourceMappingURL=out.js.map
116
+ //# sourceMappingURL=index.mjs.map
118
117
  //# sourceMappingURL=index.mjs.map
@@ -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;AAAA;A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AM,qBAAN,MAAM,oBAAmB;AAAA,EAEpB,YAAmB,SAAkB;AAAlB;AAD3B,SAAS,OAAO;AAAA,EAC8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ9C,OAAO,KAAQ,KAAmE;AAC9E,WAAO,IAAI,oBAAmB,GAAG;AAAA,EACrC;AACJ;;;AChEO,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\n /**\n * Creates an instance of Block from a non-promise value.\n *\n * @param {NonPromise<T>} raw - The raw value to create the Block from.\n * @returns {Block} The created Block instance.\n */\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\n /**\n * Creates an instance of BlockWithTransactions from a non-promise value.\n *\n * @param {NonPromise<T>} raw - The raw value to create the BlockWithTransactions from.\n * @returns {BlockWithTransactions} The created BlockWithTransactions instance.\n */\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\n /**\n * Creates an instance of TransactionRequest from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the TransactionRequest from.\n * @returns {TransactionRequest} The created TransactionRequest instance.\n */\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\n /**\n * Creates an instance of TransactionResponse from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the TransactionResponse from.\n * @returns {TransactionResponse} The created TransactionResponse instance.\n */\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\n /**\n * Creates an instance of TransactionReceipt from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the TransactionReceipt from.\n * @returns {TransactionReceipt} The created TransactionReceipt instance.\n */\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\n /**\n * Creates an instance of SignedTransaction from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the SignedTransaction from.\n * @returns {SignedTransaction} The created SignedTransaction instance.\n */\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\n /**\n * Creates an instance of TransactionPending from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the TransactionPending from.\n * @returns {TransactionPending} The created TransactionPending instance.\n */\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\n/**\n * Interface representing a signer.\n *\n * @template T - The type of the transaction request.\n */\nexport interface Signer<T = unknown> {\n /**\n * Connect to a provider.\n *\n * @param {Provider} provider - The provider to connect to.\n * @returns {Signer<T>} The connected signer.\n */\n connect(provider: Provider): Signer<T>\n\n /**\n * Build a transaction.\n *\n * @param {T} buildTxRequest - The transaction request to build.\n * @returns {Promise<TransactionRequest>} A promise that resolves to the built transaction request.\n */\n buildTransaction(buildTxRequest: T): Promise<TransactionRequest>\n\n /**\n * Sign a transaction.\n *\n * @param {TransactionRequest} transaction - The transaction request to sign.\n * @returns {Promise<SignedTransaction>} A promise that resolves to the signed transaction.\n */\n signTransaction(transaction: TransactionRequest): Promise<SignedTransaction>\n\n /**\n * Send a transaction.\n *\n * @param {SignedTransaction} transaction - The signed transaction to send.\n * @param {unknown} [sendOptions] - Optional parameters for sending the transaction.\n * @returns {Promise<TransactionPending>} A promise that resolves to the pending transaction.\n */\n sendTransaction(transaction: SignedTransaction, sendOptions?: unknown): Promise<TransactionPending>\n\n /**\n * Send a transaction and wait for confirmation.\n *\n * @param {SignedTransaction} transaction - The signed transaction to send.\n * @param {unknown} [opts] - Optional parameters for sending and confirming the transaction.\n * @returns {Promise<TransactionReceipt>} A promise that resolves to the transaction receipt.\n */\n sendAndConfirm(transaction: SignedTransaction, opts?: unknown): Promise<TransactionReceipt>\n\n /**\n * Sign a buffer (e.g. a message hash).\n *\n * @param {Uint8Array} buffer - The buffer to sign.\n * @returns {Promise<Uint8Array>} A promise that resolves to the signed buffer.\n */\n signBuffer(buffer: Uint8Array): Promise<Uint8Array>\n\n /**\n * Get the address of the signer.\n * this function NEED to return a Promise because ethers.Signer.getAddress() return a Promise<string>\n *\n * @returns {Promise<string>} A promise that resolves to the address of the signer.\n */\n getAddress(): Promise<string>\n\n /**\n * Native signer object\n */\n native: unknown\n}\n\n/**\n * Interface representing a connectable object.\n *\n * @template T - The type of the connectable object.\n */\nexport interface Connectable<T> {\n /**\n * Connect to a provider.\n *\n * @template U - The type of the provider.\n * @param {U} provider - The provider to connect to.\n * @returns {T} The connected object.\n */\n connect<U>(provider: U): T\n}\n\n/**\n * Check if an object is connectable.\n *\n * @template T - The type of the connectable object.\n * @param {unknown} obj - The object to check.\n * @returns {obj is Connectable<T>} True if the object is connectable, false otherwise.\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/transaction.ts","../src/signer.ts"],"names":[],"mappings":";AAmBa,IAAA,KAAA,GAAN,MAAM,MAAM,CAAA;AAAA,EAEP,YAAmB,KAAgB,EAAA;AAAhB,IAAA,IAAA,CAAA,KAAA,GAAA,KAAA;AAD3B,IAAA,IAAA,CAAS,IAAO,GAAA,OAAA;AAAA;AAC4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ5C,OAAO,KAAQ,GAA2B,EAAA;AACtC,IAAO,OAAA,IAAI,OAAM,GAAG,CAAA;AAAA;AAE5B;AAKa,IAAA,qBAAA,GAAN,MAAM,sBAAsB,CAAA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kB,CAAA;AAAA,EAEnB,YAAmB,MAAiB,EAAA;AAAjB,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAD3B,IAAA,IAAA,CAAS,IAAO,GAAA,mBAAA;AAAA;AAC6B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7C,OAAO,KAAQ,GAAkE,EAAA;AAC7E,IAAO,OAAA,IAAI,mBAAkB,GAAG,CAAA;AAAA;AAExC;AAKa,IAAA,kBAAA,GAAN,MAAM,mBAAmB,CAAA;AAAA,EAEpB,YAAmB,OAAkB,EAAA;AAAlB,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAD3B,IAAA,IAAA,CAAS,IAAO,GAAA,oBAAA;AAAA;AAC8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ9C,OAAO,KAAQ,GAAmE,EAAA;AAC9E,IAAO,OAAA,IAAI,oBAAmB,GAAG,CAAA;AAAA;AAEzC;;;ACzEO,SAAS,cAAiB,GAAqC,EAAA;AAClE,EAAA,IAAI,OAAO,GAAA,KAAQ,QAAY,IAAA,GAAA,KAAQ,MAAa,OAAA,KAAA;AACpD,EAAA,MAAM,KAAM,GAA8B,CAAA,OAAA;AAC1C,EAAO,OAAA,OAAO,OAAO,UAAc,IAAA,OAAO,GAAG,MAAW,KAAA,QAAA,IAAY,GAAG,MAAW,KAAA,CAAA;AACtF","file":"index.mjs","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\n /**\n * Creates an instance of Block from a non-promise value.\n *\n * @param {NonPromise<T>} raw - The raw value to create the Block from.\n * @returns {Block} The created Block instance.\n */\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\n /**\n * Creates an instance of BlockWithTransactions from a non-promise value.\n *\n * @param {NonPromise<T>} raw - The raw value to create the BlockWithTransactions from.\n * @returns {BlockWithTransactions} The created BlockWithTransactions instance.\n */\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\n /**\n * Creates an instance of TransactionRequest from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the TransactionRequest from.\n * @returns {TransactionRequest} The created TransactionRequest instance.\n */\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\n /**\n * Creates an instance of TransactionResponse from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the TransactionResponse from.\n * @returns {TransactionResponse} The created TransactionResponse instance.\n */\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\n /**\n * Creates an instance of TransactionReceipt from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the TransactionReceipt from.\n * @returns {TransactionReceipt} The created TransactionReceipt instance.\n */\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\n /**\n * Creates an instance of SignedTransaction from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the SignedTransaction from.\n * @returns {SignedTransaction} The created SignedTransaction instance.\n */\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\n /**\n * Creates an instance of TransactionPending from a non-promise value.\n *\n * @param {Exclude<NonPromise<T>, TransactionTypes>} raw - The raw value to create the TransactionPending from.\n * @returns {TransactionPending} The created TransactionPending instance.\n */\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\n/**\n * Interface representing a signer.\n *\n */\nexport interface Signer {\n /**\n * Connect to a provider.\n *\n * @param {Provider} provider - The provider to connect to.\n * @returns {Signer} The connected signer.\n */\n connect(provider: Provider): Signer\n\n /**\n * Sign a transaction.\n *\n * @param {TransactionRequest} transaction - The transaction request to sign.\n * @returns {Promise<SignedTransaction>} A promise that resolves to the signed transaction.\n */\n signTransaction(transaction: TransactionRequest): Promise<SignedTransaction>\n\n /**\n * Send a transaction.\n *\n * @param {SignedTransaction} transaction - The signed transaction to send.\n * @param {unknown} [sendOptions] - Optional parameters for sending the transaction.\n * @returns {Promise<TransactionPending>} A promise that resolves to the pending transaction.\n */\n sendTransaction(transaction: SignedTransaction, sendOptions?: unknown): Promise<TransactionPending>\n\n /**\n * Send a transaction and wait for confirmation.\n *\n * @param {SignedTransaction} transaction - The signed transaction to send.\n * @param {unknown} [opts] - Optional parameters for sending and confirming the transaction.\n * @returns {Promise<TransactionReceipt>} A promise that resolves to the transaction receipt.\n */\n sendAndConfirm(transaction: SignedTransaction, opts?: unknown): Promise<TransactionReceipt>\n\n /**\n * Sign a buffer (e.g. a message hash).\n *\n * @param {Uint8Array} buffer - The buffer to sign.\n * @returns {Promise<Uint8Array>} A promise that resolves to the signed buffer.\n */\n signBuffer(buffer: Uint8Array): Promise<Uint8Array>\n\n /**\n * Get the address of the signer.\n * this function NEED to return a Promise because ethers.Signer.getAddress() return a Promise<string>\n *\n * @returns {Promise<string>} A promise that resolves to the address of the signer.\n */\n getAddress(): Promise<string>\n\n /**\n * Native signer object\n */\n native: unknown\n}\n\n/**\n * Interface representing a connectable object.\n *\n * @template T - The type of the connectable object.\n */\nexport interface Connectable<T> {\n /**\n * Connect to a provider.\n *\n * @template U - The type of the provider.\n * @param {U} provider - The provider to connect to.\n * @returns {T} The connected object.\n */\n connect<U>(provider: U): T\n}\n\n/**\n * Check if an object is connectable.\n *\n * @template T - The type of the connectable object.\n * @param {unknown} obj - The object to check.\n * @returns {obj is Connectable<T>} True if the object is connectable, false otherwise.\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": "3.0.16",
3
+ "version": "3.0.18-movement.0",
4
4
  "description": "LayerZero Core Library",
5
5
  "license": "BUSL-1.1",
6
6
  "exports": {
@@ -24,13 +24,13 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@jest/globals": "^29.7.0",
27
- "@layerzerolabs/tsup-config-next": "^3.0.16",
28
- "@layerzerolabs/typescript-config-next": "^3.0.16",
27
+ "@layerzerolabs/tsup-config-next": "^3.0.18-movement.0",
28
+ "@layerzerolabs/typescript-config-next": "^3.0.18-movement.0",
29
29
  "@types/jest": "^29.5.10",
30
30
  "jest": "^29.7.0",
31
31
  "rimraf": "^5.0.5",
32
32
  "ts-jest": "^29.1.1",
33
- "tsup": "^8.0.1",
33
+ "tsup": "^8.3.5",
34
34
  "typescript": "~5.2.2"
35
35
  },
36
36
  "publishConfig": {