@layerzerolabs/lz-core 2.1.23 → 2.1.25
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 +12 -0
- package/dist/index.cjs +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +21 -14
- package/dist/index.d.ts +21 -14
- package/dist/index.mjs +4 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -66,16 +66,17 @@ var TransactionPending = class _TransactionPending {
|
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
// src/signer.ts
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
function isConnectable(obj) {
|
|
70
|
+
return typeof obj.connect === "function" && obj.connect.length === 1;
|
|
71
|
+
}
|
|
71
72
|
|
|
72
73
|
exports.Block = Block;
|
|
73
74
|
exports.BlockWithTransactions = BlockWithTransactions;
|
|
74
75
|
exports.SignedTransaction = SignedTransaction;
|
|
75
|
-
exports.Signer = Signer;
|
|
76
76
|
exports.TransactionPending = TransactionPending;
|
|
77
77
|
exports.TransactionReceipt = TransactionReceipt;
|
|
78
78
|
exports.TransactionRequest = TransactionRequest;
|
|
79
79
|
exports.TransactionResponse = TransactionResponse;
|
|
80
|
+
exports.isConnectable = isConnectable;
|
|
80
81
|
//# sourceMappingURL=out.js.map
|
|
81
82
|
//# 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;AAAhB;AAD3B,SAAS,OAAO;AAAA,EAC4B;AAAA,EAC5C,OAAO,KAAQ,KAA2B;AACtC,WAAO,IAAI,OAAM,GAAG;AAAA,EACxB;AACJ;AAKO,IAAM,wBAAN,MAAM,uBAAsB;A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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,KAAiC;AAC9D,SAAO,OAAO,IAAI,YAAY,cAAc,IAAI,QAAQ,WAAW;AACvE","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?: any): Promise<TransactionPending>\n\n /**\n * Send a transaction and wait for confirmation\n * @param transaction\n * @param opts\n */\n sendAndConfirm(transaction: SignedTransaction, opts?: any): 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: any): obj is Connectable<T> {\n return typeof obj.connect === 'function' && obj.connect.length === 1\n}\n"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -38,6 +38,10 @@ type BlockTag = string | number;
|
|
|
38
38
|
* Finality represents the finality of a block.
|
|
39
39
|
*/
|
|
40
40
|
type Finality = 'confirmed' | 'finalized';
|
|
41
|
+
/**
|
|
42
|
+
* A union type to represent all the possible types of a transaction.
|
|
43
|
+
*/
|
|
44
|
+
type TransactionTypes = TransactionRequest | TransactionResponse | TransactionReceipt | SignedTransaction | TransactionPending;
|
|
41
45
|
/**
|
|
42
46
|
* TransactionRequest represents the request of a transaction.
|
|
43
47
|
*/
|
|
@@ -45,7 +49,7 @@ declare class TransactionRequest {
|
|
|
45
49
|
request: unknown;
|
|
46
50
|
readonly type = "TransactionRequest";
|
|
47
51
|
private constructor();
|
|
48
|
-
static from<T>(raw: NonPromise<T>): TransactionRequest;
|
|
52
|
+
static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionRequest;
|
|
49
53
|
}
|
|
50
54
|
/**
|
|
51
55
|
* TransactionResponse represents the response of a transaction.
|
|
@@ -54,7 +58,7 @@ declare class TransactionResponse {
|
|
|
54
58
|
response: unknown;
|
|
55
59
|
readonly type = "TransactionResponse";
|
|
56
60
|
private constructor();
|
|
57
|
-
static from<T>(raw: NonPromise<T>): TransactionResponse;
|
|
61
|
+
static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionResponse;
|
|
58
62
|
}
|
|
59
63
|
/**
|
|
60
64
|
* TransactionReceipt represents the receipt of a transaction.
|
|
@@ -63,7 +67,7 @@ declare class TransactionReceipt {
|
|
|
63
67
|
receipt: unknown;
|
|
64
68
|
readonly type = "TransactionReceipt";
|
|
65
69
|
private constructor();
|
|
66
|
-
static from<T>(raw: NonPromise<T>): TransactionReceipt;
|
|
70
|
+
static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionReceipt;
|
|
67
71
|
}
|
|
68
72
|
/**
|
|
69
73
|
* SignedTransaction represents a signed transaction.
|
|
@@ -72,7 +76,7 @@ declare class SignedTransaction {
|
|
|
72
76
|
signed: unknown;
|
|
73
77
|
readonly type = "SignedTransaction";
|
|
74
78
|
private constructor();
|
|
75
|
-
static from<T>(raw: NonPromise<T>): SignedTransaction;
|
|
79
|
+
static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): SignedTransaction;
|
|
76
80
|
}
|
|
77
81
|
/**
|
|
78
82
|
* TransactionPending represents a pending transaction.
|
|
@@ -81,7 +85,7 @@ declare class TransactionPending {
|
|
|
81
85
|
pending: unknown;
|
|
82
86
|
readonly type = "TransactionPending";
|
|
83
87
|
private constructor();
|
|
84
|
-
static from<T>(raw: NonPromise<T>): TransactionPending;
|
|
88
|
+
static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionPending;
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
interface Provider {
|
|
@@ -145,44 +149,47 @@ interface Provider {
|
|
|
145
149
|
*/
|
|
146
150
|
sendAndConfirm(transaction: SignedTransaction, opts?: any): Promise<TransactionReceipt>;
|
|
147
151
|
readonly native: unknown;
|
|
148
|
-
connectedTo<T>(item: T): T;
|
|
149
152
|
}
|
|
150
153
|
|
|
151
|
-
|
|
154
|
+
interface Signer {
|
|
152
155
|
/**
|
|
153
156
|
* Connect to a provider
|
|
154
157
|
* @param provider
|
|
155
158
|
*/
|
|
156
|
-
|
|
159
|
+
connect(provider: Provider): Signer;
|
|
157
160
|
/**
|
|
158
161
|
* Sign a transaction
|
|
159
162
|
* @param transaction
|
|
160
163
|
*/
|
|
161
|
-
|
|
164
|
+
signTransaction(transaction: TransactionRequest): Promise<SignedTransaction>;
|
|
162
165
|
/**
|
|
163
166
|
* Send a transaction
|
|
164
167
|
* @param transaction
|
|
165
168
|
* @param sendOptions
|
|
166
169
|
*/
|
|
167
|
-
|
|
170
|
+
sendTransaction(transaction: SignedTransaction, sendOptions?: any): Promise<TransactionPending>;
|
|
168
171
|
/**
|
|
169
172
|
* Send a transaction and wait for confirmation
|
|
170
173
|
* @param transaction
|
|
171
174
|
* @param opts
|
|
172
175
|
*/
|
|
173
|
-
|
|
176
|
+
sendAndConfirm(transaction: SignedTransaction, opts?: any): Promise<TransactionReceipt>;
|
|
174
177
|
/**
|
|
175
178
|
* Sign a buffer (e.g. a message hash)
|
|
176
179
|
*/
|
|
177
|
-
|
|
180
|
+
signBuffer(buffer: Uint8Array): Promise<Uint8Array>;
|
|
178
181
|
/**
|
|
179
182
|
* returns the address of the signer
|
|
180
183
|
*/
|
|
181
|
-
|
|
184
|
+
getAddress(): Promise<string>;
|
|
182
185
|
/**
|
|
183
186
|
* Native signer object
|
|
184
187
|
*/
|
|
185
188
|
native: unknown;
|
|
186
189
|
}
|
|
190
|
+
interface Connectable<T> {
|
|
191
|
+
connect<U>(provider: U): T;
|
|
192
|
+
}
|
|
193
|
+
declare function isConnectable<T>(obj: any): obj is Connectable<T>;
|
|
187
194
|
|
|
188
|
-
export { Block, type BlockTag, BlockWithTransactions, type Finality, type Provider, SignedTransaction, Signer, type TransactionHash, TransactionPending, TransactionReceipt, TransactionRequest, TransactionResponse };
|
|
195
|
+
export { Block, type BlockTag, BlockWithTransactions, type Connectable, type Finality, type Provider, SignedTransaction, type Signer, type TransactionHash, TransactionPending, TransactionReceipt, TransactionRequest, TransactionResponse, isConnectable };
|
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +38,10 @@ type BlockTag = string | number;
|
|
|
38
38
|
* Finality represents the finality of a block.
|
|
39
39
|
*/
|
|
40
40
|
type Finality = 'confirmed' | 'finalized';
|
|
41
|
+
/**
|
|
42
|
+
* A union type to represent all the possible types of a transaction.
|
|
43
|
+
*/
|
|
44
|
+
type TransactionTypes = TransactionRequest | TransactionResponse | TransactionReceipt | SignedTransaction | TransactionPending;
|
|
41
45
|
/**
|
|
42
46
|
* TransactionRequest represents the request of a transaction.
|
|
43
47
|
*/
|
|
@@ -45,7 +49,7 @@ declare class TransactionRequest {
|
|
|
45
49
|
request: unknown;
|
|
46
50
|
readonly type = "TransactionRequest";
|
|
47
51
|
private constructor();
|
|
48
|
-
static from<T>(raw: NonPromise<T>): TransactionRequest;
|
|
52
|
+
static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionRequest;
|
|
49
53
|
}
|
|
50
54
|
/**
|
|
51
55
|
* TransactionResponse represents the response of a transaction.
|
|
@@ -54,7 +58,7 @@ declare class TransactionResponse {
|
|
|
54
58
|
response: unknown;
|
|
55
59
|
readonly type = "TransactionResponse";
|
|
56
60
|
private constructor();
|
|
57
|
-
static from<T>(raw: NonPromise<T>): TransactionResponse;
|
|
61
|
+
static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionResponse;
|
|
58
62
|
}
|
|
59
63
|
/**
|
|
60
64
|
* TransactionReceipt represents the receipt of a transaction.
|
|
@@ -63,7 +67,7 @@ declare class TransactionReceipt {
|
|
|
63
67
|
receipt: unknown;
|
|
64
68
|
readonly type = "TransactionReceipt";
|
|
65
69
|
private constructor();
|
|
66
|
-
static from<T>(raw: NonPromise<T>): TransactionReceipt;
|
|
70
|
+
static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionReceipt;
|
|
67
71
|
}
|
|
68
72
|
/**
|
|
69
73
|
* SignedTransaction represents a signed transaction.
|
|
@@ -72,7 +76,7 @@ declare class SignedTransaction {
|
|
|
72
76
|
signed: unknown;
|
|
73
77
|
readonly type = "SignedTransaction";
|
|
74
78
|
private constructor();
|
|
75
|
-
static from<T>(raw: NonPromise<T>): SignedTransaction;
|
|
79
|
+
static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): SignedTransaction;
|
|
76
80
|
}
|
|
77
81
|
/**
|
|
78
82
|
* TransactionPending represents a pending transaction.
|
|
@@ -81,7 +85,7 @@ declare class TransactionPending {
|
|
|
81
85
|
pending: unknown;
|
|
82
86
|
readonly type = "TransactionPending";
|
|
83
87
|
private constructor();
|
|
84
|
-
static from<T>(raw: NonPromise<T>): TransactionPending;
|
|
88
|
+
static from<T>(raw: Exclude<NonPromise<T>, TransactionTypes>): TransactionPending;
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
interface Provider {
|
|
@@ -145,44 +149,47 @@ interface Provider {
|
|
|
145
149
|
*/
|
|
146
150
|
sendAndConfirm(transaction: SignedTransaction, opts?: any): Promise<TransactionReceipt>;
|
|
147
151
|
readonly native: unknown;
|
|
148
|
-
connectedTo<T>(item: T): T;
|
|
149
152
|
}
|
|
150
153
|
|
|
151
|
-
|
|
154
|
+
interface Signer {
|
|
152
155
|
/**
|
|
153
156
|
* Connect to a provider
|
|
154
157
|
* @param provider
|
|
155
158
|
*/
|
|
156
|
-
|
|
159
|
+
connect(provider: Provider): Signer;
|
|
157
160
|
/**
|
|
158
161
|
* Sign a transaction
|
|
159
162
|
* @param transaction
|
|
160
163
|
*/
|
|
161
|
-
|
|
164
|
+
signTransaction(transaction: TransactionRequest): Promise<SignedTransaction>;
|
|
162
165
|
/**
|
|
163
166
|
* Send a transaction
|
|
164
167
|
* @param transaction
|
|
165
168
|
* @param sendOptions
|
|
166
169
|
*/
|
|
167
|
-
|
|
170
|
+
sendTransaction(transaction: SignedTransaction, sendOptions?: any): Promise<TransactionPending>;
|
|
168
171
|
/**
|
|
169
172
|
* Send a transaction and wait for confirmation
|
|
170
173
|
* @param transaction
|
|
171
174
|
* @param opts
|
|
172
175
|
*/
|
|
173
|
-
|
|
176
|
+
sendAndConfirm(transaction: SignedTransaction, opts?: any): Promise<TransactionReceipt>;
|
|
174
177
|
/**
|
|
175
178
|
* Sign a buffer (e.g. a message hash)
|
|
176
179
|
*/
|
|
177
|
-
|
|
180
|
+
signBuffer(buffer: Uint8Array): Promise<Uint8Array>;
|
|
178
181
|
/**
|
|
179
182
|
* returns the address of the signer
|
|
180
183
|
*/
|
|
181
|
-
|
|
184
|
+
getAddress(): Promise<string>;
|
|
182
185
|
/**
|
|
183
186
|
* Native signer object
|
|
184
187
|
*/
|
|
185
188
|
native: unknown;
|
|
186
189
|
}
|
|
190
|
+
interface Connectable<T> {
|
|
191
|
+
connect<U>(provider: U): T;
|
|
192
|
+
}
|
|
193
|
+
declare function isConnectable<T>(obj: any): obj is Connectable<T>;
|
|
187
194
|
|
|
188
|
-
export { Block, type BlockTag, BlockWithTransactions, type Finality, type Provider, SignedTransaction, Signer, type TransactionHash, TransactionPending, TransactionReceipt, TransactionRequest, TransactionResponse };
|
|
195
|
+
export { Block, type BlockTag, BlockWithTransactions, type Connectable, type Finality, type Provider, SignedTransaction, type Signer, type TransactionHash, TransactionPending, TransactionReceipt, TransactionRequest, TransactionResponse, isConnectable };
|
package/dist/index.mjs
CHANGED
|
@@ -64,9 +64,10 @@ var TransactionPending = class _TransactionPending {
|
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
// src/signer.ts
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
function isConnectable(obj) {
|
|
68
|
+
return typeof obj.connect === "function" && obj.connect.length === 1;
|
|
69
|
+
}
|
|
69
70
|
|
|
70
|
-
export { Block, BlockWithTransactions, SignedTransaction,
|
|
71
|
+
export { Block, BlockWithTransactions, SignedTransaction, TransactionPending, TransactionReceipt, TransactionRequest, TransactionResponse, isConnectable };
|
|
71
72
|
//# sourceMappingURL=out.js.map
|
|
72
73
|
//# 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,OAAM,GAAG;AAAA,EACxB;AACJ;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B;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,KAAiC;AAC9D,SAAO,OAAO,IAAI,YAAY,cAAc,IAAI,QAAQ,WAAW;AACvE","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?: any): Promise<TransactionPending>\n\n /**\n * Send a transaction and wait for confirmation\n * @param transaction\n * @param opts\n */\n sendAndConfirm(transaction: SignedTransaction, opts?: any): 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: any): obj is Connectable<T> {\n return typeof obj.connect === 'function' && obj.connect.length === 1\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/lz-core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.25",
|
|
4
4
|
"description": "LayerZero Core Library",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"exports": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@jest/globals": "^29.7.0",
|
|
30
|
-
"@layerzerolabs/tsup-config-next": "^2.1.
|
|
31
|
-
"@layerzerolabs/typescript-config-next": "^2.1.
|
|
30
|
+
"@layerzerolabs/tsup-config-next": "^2.1.25",
|
|
31
|
+
"@layerzerolabs/typescript-config-next": "^2.1.25",
|
|
32
32
|
"@types/jest": "^29.5.10",
|
|
33
33
|
"jest": "^29.7.0",
|
|
34
34
|
"rimraf": "^5.0.5",
|