@0xsequence/relayer 1.4.9 → 1.6.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.
|
@@ -33,6 +33,10 @@ function isProviderRelayerOptions(obj) {
|
|
|
33
33
|
}
|
|
34
34
|
class ProviderRelayer {
|
|
35
35
|
constructor(options) {
|
|
36
|
+
this.provider = void 0;
|
|
37
|
+
this.waitPollRate = void 0;
|
|
38
|
+
this.deltaBlocksLog = void 0;
|
|
39
|
+
this.fromBlockLog = void 0;
|
|
36
40
|
const opts = _extends({}, ProviderRelayerDefaults, options);
|
|
37
41
|
this.provider = opts.provider;
|
|
38
42
|
}
|
|
@@ -179,6 +183,8 @@ class LocalRelayer extends ProviderRelayer {
|
|
|
179
183
|
} : _extends({}, options, {
|
|
180
184
|
provider: options.signer.provider
|
|
181
185
|
}));
|
|
186
|
+
this.signer = void 0;
|
|
187
|
+
this.txnOptions = void 0;
|
|
182
188
|
this.signer = ethers.Signer.isSigner(options) ? options : options.signer;
|
|
183
189
|
if (!this.signer.provider) throw new Error('Signer must have a provider');
|
|
184
190
|
}
|
|
@@ -283,6 +289,8 @@ let SortOrder = /*#__PURE__*/function (SortOrder) {
|
|
|
283
289
|
//
|
|
284
290
|
class Relayer {
|
|
285
291
|
constructor(hostname, fetch) {
|
|
292
|
+
this.hostname = void 0;
|
|
293
|
+
this.fetch = void 0;
|
|
286
294
|
this.path = '/rpc/Relayer/';
|
|
287
295
|
this.ping = headers => {
|
|
288
296
|
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
|
|
@@ -579,7 +587,6 @@ const buildResponse = res => {
|
|
|
579
587
|
if (!res.ok) {
|
|
580
588
|
throw data; // webrpc error response
|
|
581
589
|
}
|
|
582
|
-
|
|
583
590
|
return data;
|
|
584
591
|
});
|
|
585
592
|
};
|
|
@@ -606,6 +613,9 @@ const fetch = typeof global === 'object' ? global.fetch : window.fetch;
|
|
|
606
613
|
// TODO: rename to SequenceRelayer
|
|
607
614
|
class RpcRelayer {
|
|
608
615
|
constructor(options) {
|
|
616
|
+
this.options = options;
|
|
617
|
+
this.service = void 0;
|
|
618
|
+
this.provider = void 0;
|
|
609
619
|
this._fetch = (input, init) => {
|
|
610
620
|
// automatically include jwt and access key auth header to requests
|
|
611
621
|
// if its been set on the api client
|
|
@@ -625,7 +635,6 @@ class RpcRelayer {
|
|
|
625
635
|
init.headers = _extends({}, init.headers, headers);
|
|
626
636
|
return fetch(input, init);
|
|
627
637
|
};
|
|
628
|
-
this.options = options;
|
|
629
638
|
this.service = new Relayer(options.url, this._fetch);
|
|
630
639
|
if (ethers.ethers.providers.Provider.isProvider(options.provider)) {
|
|
631
640
|
this.provider = options.provider;
|
|
@@ -843,6 +852,7 @@ class MetaTransactionResponseException {
|
|
|
843
852
|
//
|
|
844
853
|
// This interface exists for type-safety purposes to protect against passing non-FeeQuotes to
|
|
845
854
|
// Relayer.relay(), or any other functions that call it indirectly (e.g. Account.sendTransaction).
|
|
855
|
+
|
|
846
856
|
function isRelayer(cand) {
|
|
847
857
|
return typeof cand === 'object' && typeof cand.simulate === 'function' && typeof cand.getFeeOptions === 'function' && typeof cand.gasRefundOptions === 'function' && typeof cand.getNonce === 'function' && typeof cand.relay === 'function' && typeof cand.wait === 'function';
|
|
848
858
|
}
|
|
@@ -33,6 +33,10 @@ function isProviderRelayerOptions(obj) {
|
|
|
33
33
|
}
|
|
34
34
|
class ProviderRelayer {
|
|
35
35
|
constructor(options) {
|
|
36
|
+
this.provider = void 0;
|
|
37
|
+
this.waitPollRate = void 0;
|
|
38
|
+
this.deltaBlocksLog = void 0;
|
|
39
|
+
this.fromBlockLog = void 0;
|
|
36
40
|
const opts = _extends({}, ProviderRelayerDefaults, options);
|
|
37
41
|
this.provider = opts.provider;
|
|
38
42
|
}
|
|
@@ -179,6 +183,8 @@ class LocalRelayer extends ProviderRelayer {
|
|
|
179
183
|
} : _extends({}, options, {
|
|
180
184
|
provider: options.signer.provider
|
|
181
185
|
}));
|
|
186
|
+
this.signer = void 0;
|
|
187
|
+
this.txnOptions = void 0;
|
|
182
188
|
this.signer = ethers.Signer.isSigner(options) ? options : options.signer;
|
|
183
189
|
if (!this.signer.provider) throw new Error('Signer must have a provider');
|
|
184
190
|
}
|
|
@@ -283,6 +289,8 @@ let SortOrder = /*#__PURE__*/function (SortOrder) {
|
|
|
283
289
|
//
|
|
284
290
|
class Relayer {
|
|
285
291
|
constructor(hostname, fetch) {
|
|
292
|
+
this.hostname = void 0;
|
|
293
|
+
this.fetch = void 0;
|
|
286
294
|
this.path = '/rpc/Relayer/';
|
|
287
295
|
this.ping = headers => {
|
|
288
296
|
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
|
|
@@ -579,7 +587,6 @@ const buildResponse = res => {
|
|
|
579
587
|
if (!res.ok) {
|
|
580
588
|
throw data; // webrpc error response
|
|
581
589
|
}
|
|
582
|
-
|
|
583
590
|
return data;
|
|
584
591
|
});
|
|
585
592
|
};
|
|
@@ -606,6 +613,9 @@ const fetch = typeof global === 'object' ? global.fetch : window.fetch;
|
|
|
606
613
|
// TODO: rename to SequenceRelayer
|
|
607
614
|
class RpcRelayer {
|
|
608
615
|
constructor(options) {
|
|
616
|
+
this.options = options;
|
|
617
|
+
this.service = void 0;
|
|
618
|
+
this.provider = void 0;
|
|
609
619
|
this._fetch = (input, init) => {
|
|
610
620
|
// automatically include jwt and access key auth header to requests
|
|
611
621
|
// if its been set on the api client
|
|
@@ -625,7 +635,6 @@ class RpcRelayer {
|
|
|
625
635
|
init.headers = _extends({}, init.headers, headers);
|
|
626
636
|
return fetch(input, init);
|
|
627
637
|
};
|
|
628
|
-
this.options = options;
|
|
629
638
|
this.service = new Relayer(options.url, this._fetch);
|
|
630
639
|
if (ethers.ethers.providers.Provider.isProvider(options.provider)) {
|
|
631
640
|
this.provider = options.provider;
|
|
@@ -843,6 +852,7 @@ class MetaTransactionResponseException {
|
|
|
843
852
|
//
|
|
844
853
|
// This interface exists for type-safety purposes to protect against passing non-FeeQuotes to
|
|
845
854
|
// Relayer.relay(), or any other functions that call it indirectly (e.g. Account.sendTransaction).
|
|
855
|
+
|
|
846
856
|
function isRelayer(cand) {
|
|
847
857
|
return typeof cand === 'object' && typeof cand.simulate === 'function' && typeof cand.getFeeOptions === 'function' && typeof cand.gasRefundOptions === 'function' && typeof cand.getNonce === 'function' && typeof cand.relay === 'function' && typeof cand.wait === 'function';
|
|
848
858
|
}
|
|
@@ -29,6 +29,10 @@ function isProviderRelayerOptions(obj) {
|
|
|
29
29
|
}
|
|
30
30
|
class ProviderRelayer {
|
|
31
31
|
constructor(options) {
|
|
32
|
+
this.provider = void 0;
|
|
33
|
+
this.waitPollRate = void 0;
|
|
34
|
+
this.deltaBlocksLog = void 0;
|
|
35
|
+
this.fromBlockLog = void 0;
|
|
32
36
|
const opts = _extends({}, ProviderRelayerDefaults, options);
|
|
33
37
|
this.provider = opts.provider;
|
|
34
38
|
}
|
|
@@ -175,6 +179,8 @@ class LocalRelayer extends ProviderRelayer {
|
|
|
175
179
|
} : _extends({}, options, {
|
|
176
180
|
provider: options.signer.provider
|
|
177
181
|
}));
|
|
182
|
+
this.signer = void 0;
|
|
183
|
+
this.txnOptions = void 0;
|
|
178
184
|
this.signer = Signer.isSigner(options) ? options : options.signer;
|
|
179
185
|
if (!this.signer.provider) throw new Error('Signer must have a provider');
|
|
180
186
|
}
|
|
@@ -279,6 +285,8 @@ let SortOrder = /*#__PURE__*/function (SortOrder) {
|
|
|
279
285
|
//
|
|
280
286
|
class Relayer {
|
|
281
287
|
constructor(hostname, fetch) {
|
|
288
|
+
this.hostname = void 0;
|
|
289
|
+
this.fetch = void 0;
|
|
282
290
|
this.path = '/rpc/Relayer/';
|
|
283
291
|
this.ping = headers => {
|
|
284
292
|
return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
|
|
@@ -575,7 +583,6 @@ const buildResponse = res => {
|
|
|
575
583
|
if (!res.ok) {
|
|
576
584
|
throw data; // webrpc error response
|
|
577
585
|
}
|
|
578
|
-
|
|
579
586
|
return data;
|
|
580
587
|
});
|
|
581
588
|
};
|
|
@@ -602,6 +609,9 @@ const fetch = typeof global === 'object' ? global.fetch : window.fetch;
|
|
|
602
609
|
// TODO: rename to SequenceRelayer
|
|
603
610
|
class RpcRelayer {
|
|
604
611
|
constructor(options) {
|
|
612
|
+
this.options = options;
|
|
613
|
+
this.service = void 0;
|
|
614
|
+
this.provider = void 0;
|
|
605
615
|
this._fetch = (input, init) => {
|
|
606
616
|
// automatically include jwt and access key auth header to requests
|
|
607
617
|
// if its been set on the api client
|
|
@@ -621,7 +631,6 @@ class RpcRelayer {
|
|
|
621
631
|
init.headers = _extends({}, init.headers, headers);
|
|
622
632
|
return fetch(input, init);
|
|
623
633
|
};
|
|
624
|
-
this.options = options;
|
|
625
634
|
this.service = new Relayer(options.url, this._fetch);
|
|
626
635
|
if (ethers.providers.Provider.isProvider(options.provider)) {
|
|
627
636
|
this.provider = options.provider;
|
|
@@ -839,6 +848,7 @@ class MetaTransactionResponseException {
|
|
|
839
848
|
//
|
|
840
849
|
// This interface exists for type-safety purposes to protect against passing non-FeeQuotes to
|
|
841
850
|
// Relayer.relay(), or any other functions that call it indirectly (e.g. Account.sendTransaction).
|
|
851
|
+
|
|
842
852
|
function isRelayer(cand) {
|
|
843
853
|
return typeof cand === 'object' && typeof cand.simulate === 'function' && typeof cand.getFeeOptions === 'function' && typeof cand.gasRefundOptions === 'function' && typeof cand.getNonce === 'function' && typeof cand.relay === 'function' && typeof cand.wait === 'function';
|
|
844
854
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/relayer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "relayer sub-package for Sequence",
|
|
5
5
|
"repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/relayer",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"author": "Horizon Blockchain Games",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@0xsequence/abi": "1.
|
|
13
|
-
"@0xsequence/core": "1.
|
|
14
|
-
"@0xsequence/utils": "1.
|
|
12
|
+
"@0xsequence/abi": "1.6.0",
|
|
13
|
+
"@0xsequence/core": "1.6.0",
|
|
14
|
+
"@0xsequence/utils": "1.6.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"ethers": ">=5.5 < 6"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@0xsequence/wallet-contracts": "^1.10.0",
|
|
21
21
|
"ethers": "^5.7.2",
|
|
22
|
-
"@0xsequence/signhub": "1.
|
|
23
|
-
"@0xsequence/tests": "1.
|
|
22
|
+
"@0xsequence/signhub": "1.6.0",
|
|
23
|
+
"@0xsequence/tests": "1.6.0"
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"src",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"scripts": {
|
|
30
30
|
"test": "pnpm test:concurrently 'pnpm test:run'",
|
|
31
31
|
"test:run": "pnpm test:file tests/**/*.spec.ts",
|
|
32
|
-
"test:file": "NODE_OPTIONS='--
|
|
32
|
+
"test:file": "NODE_OPTIONS='--import tsx' mocha --timeout 30000",
|
|
33
33
|
"test:concurrently": "concurrently -k --success first 'pnpm start:hardhat > /dev/null' ",
|
|
34
34
|
"start:hardhat": "pnpm hardhat node --port 9547",
|
|
35
35
|
"typecheck": "tsc --noEmit"
|