@0xsequence/provider 0.0.0-20231205222341 → 0.0.0-20240111142017

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.
@@ -32,6 +32,8 @@ function isProviderTransport(transport) {
32
32
  // ProviderMessageCallback is used to respond to ProviderMessage requests. The error
33
33
  // argument is for exceptions during the execution, and response is the response payload
34
34
  // which may contain the result or an error payload from the wallet.
35
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
36
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
35
37
  class WindowSessionParams extends URLSearchParams {
36
38
  static new(init) {
37
39
  return new URLSearchParams(init);
@@ -93,8 +95,17 @@ class BaseProviderTransport {
93
95
  var _this = this;
94
96
  this.pendingMessageRequests = [];
95
97
  this.responseCallbacks = new Map();
98
+ this.state = void 0;
96
99
  this.confirmationOnly = false;
97
100
  this.events = new eventemitter2.EventEmitter2();
101
+ this.openPayload = void 0;
102
+ this.connectPayload = void 0;
103
+ this.accountsChangedPayload = void 0;
104
+ this.networksPayload = void 0;
105
+ this.walletContextPayload = void 0;
106
+ this._sessionId = void 0;
107
+ this._init = void 0;
108
+ this._registered = void 0;
98
109
  this.sendAsync = async function (request, callback, chainId) {
99
110
  // here, we receive the message from the dapp provider call
100
111
 
@@ -706,11 +717,18 @@ async function resolveArrayProperties(object) {
706
717
 
707
718
  const TRANSPORT_SESSION_LS_KEY = '@sequence.transportSession';
708
719
  class BaseWalletTransport {
709
- // appOrigin identifies the dapp's origin which opened the app. A transport
710
- // will auto-detect and set this value if it can. This is determined
711
- // as the parent app/window which opened the wallet.
712
720
  constructor(walletRequestHandler) {
713
721
  var _this = this;
722
+ this.walletRequestHandler = void 0;
723
+ this._sessionId = void 0;
724
+ this._registered = void 0;
725
+ this._init = void 0;
726
+ this._initNonce = void 0;
727
+ this._initCallback = void 0;
728
+ // appOrigin identifies the dapp's origin which opened the app. A transport
729
+ // will auto-detect and set this value if it can. This is determined
730
+ // as the parent app/window which opened the wallet.
731
+ this.appOrigin = void 0;
714
732
  this.sendAsync = async function (request, callback, chainId) {
715
733
  throw new Error('abstract method');
716
734
  };
@@ -1130,6 +1148,8 @@ class BaseWalletTransport {
1130
1148
 
1131
1149
  class ProxyMessageChannel {
1132
1150
  constructor() {
1151
+ this.app = void 0;
1152
+ this.wallet = void 0;
1133
1153
  const port1 = new ProxyMessageChannelPort();
1134
1154
  const port2 = new ProxyMessageChannelPort();
1135
1155
  port1.conn = port2;
@@ -1140,6 +1160,7 @@ class ProxyMessageChannel {
1140
1160
  }
1141
1161
  class ProxyMessageChannelPort {
1142
1162
  constructor() {
1163
+ this.conn = void 0;
1143
1164
  this.events = new eventemitter2.EventEmitter2();
1144
1165
  // handle messages which hit this port
1145
1166
  this.handleMessage = message => {
@@ -1175,6 +1196,7 @@ class ProxyMessageChannelPort {
1175
1196
  class ProxyMessageProvider extends BaseProviderTransport {
1176
1197
  constructor(port) {
1177
1198
  super();
1199
+ this.port = void 0;
1178
1200
  this.register = () => {
1179
1201
  this.port.handleMessage = message => {
1180
1202
  this.handleMessage(message);
@@ -1246,6 +1268,7 @@ class ProxyMessageProvider extends BaseProviderTransport {
1246
1268
  class ProxyMessageHandler extends BaseWalletTransport {
1247
1269
  constructor(walletRequestHandler, port) {
1248
1270
  super(walletRequestHandler);
1271
+ this.port = void 0;
1249
1272
  this.port = port;
1250
1273
  this._init = InitState.OK;
1251
1274
  }
@@ -1312,6 +1335,7 @@ let registeredUnrealMessageProvider;
1312
1335
  class UnrealMessageProvider extends BaseProviderTransport {
1313
1336
  constructor(walletAppURL) {
1314
1337
  super();
1338
+ this.walletURL = void 0;
1315
1339
  this.register = () => {
1316
1340
  var _window$ue;
1317
1341
  overrideLogs('dapp');
@@ -1503,6 +1527,7 @@ class ExtensionMessageHandler extends BaseWalletTransport {
1503
1527
  constructor(walletRequestHandler, runtime) {
1504
1528
  super(walletRequestHandler);
1505
1529
  this.runtime = runtime;
1530
+ this.port = void 0;
1506
1531
  this._init = InitState.OK;
1507
1532
  }
1508
1533
  register() {
@@ -1552,6 +1577,7 @@ class BaseInjectedTransport extends eventemitter2.EventEmitter2 {
1552
1577
  var _this;
1553
1578
  super();
1554
1579
  _this = this;
1580
+ this.stream = stream;
1555
1581
  this.responseCallbacks = new Map();
1556
1582
  this._messageIdx = 0;
1557
1583
  this.nextMessageIdx = () => ++this._messageIdx;
@@ -1612,7 +1638,6 @@ class BaseInjectedTransport extends eventemitter2.EventEmitter2 {
1612
1638
  _this.sendMessage(message);
1613
1639
  });
1614
1640
  };
1615
- this.stream = stream;
1616
1641
  this.stream.on('data', this.handleMessage);
1617
1642
  }
1618
1643
  sendMessage(message) {
@@ -1628,6 +1653,8 @@ let registeredWindowMessageProvider;
1628
1653
  class WindowMessageProvider extends BaseProviderTransport {
1629
1654
  constructor(walletAppURL) {
1630
1655
  super();
1656
+ this.walletURL = void 0;
1657
+ this.walletWindow = void 0;
1631
1658
  this.register = () => {
1632
1659
  if (registeredWindowMessageProvider) {
1633
1660
  // overriding the registered message provider
@@ -1797,6 +1824,7 @@ class WindowMessageHandler extends BaseWalletTransport {
1797
1824
  var _this;
1798
1825
  super(walletRequestHandler);
1799
1826
  _this = this;
1827
+ this.parentWindow = void 0;
1800
1828
  this._isPopup = false;
1801
1829
  // onmessage is called when (the wallet) receives request messages from the dapp
1802
1830
  // over the window post-messaging transport
@@ -1945,6 +1973,8 @@ function isMuxTransportTemplate(obj) {
1945
1973
  class MuxMessageProvider {
1946
1974
  constructor(...messageProviders) {
1947
1975
  var _this = this;
1976
+ this.messageProviders = void 0;
1977
+ this.provider = void 0;
1948
1978
  this.register = () => {
1949
1979
  if (this.messageProviders.length === 1) {
1950
1980
  this.provider = this.messageProviders[0];
@@ -2155,7 +2185,12 @@ class WalletRequestHandler {
2155
2185
  // signer interface of the wallet. A null value means there is no signer (ie. user not signed in). An undefined
2156
2186
  // value means the signer state is unknown, usually meaning the wallet app is booting up and initializing. Of course
2157
2187
  // a Signer value is the actually interface to a signed-in account
2188
+ this.account = void 0;
2158
2189
  this.signerReadyCallbacks = [];
2190
+ this.prompter = void 0;
2191
+ this.networks = void 0;
2192
+ this._openIntent = void 0;
2193
+ this._connectOptions = void 0;
2159
2194
  this.events = new eventemitter2.EventEmitter2();
2160
2195
  this.onConnectOptionsChange = undefined;
2161
2196
  this.promptConnect = async function (options) {
@@ -2644,6 +2679,10 @@ class WalletRequestHandler {
2644
2679
  }
2645
2680
  }
2646
2681
  signOut() {
2682
+ if (this.account) {
2683
+ this.notifyDisconnect();
2684
+ }
2685
+
2647
2686
  // signed out state
2648
2687
  this.setAccount(null);
2649
2688
  }
@@ -2898,11 +2937,11 @@ class SequenceSigner {
2898
2937
  return this.provider.utils;
2899
2938
  }
2900
2939
  constructor(client, provider) {
2940
+ this.client = client;
2941
+ this.provider = provider;
2901
2942
  this.singleNetworkSigners = {};
2902
2943
  this._isSigner = true;
2903
2944
  this._isSequenceSigner = true;
2904
- this.client = client;
2905
- this.provider = provider;
2906
2945
  }
2907
2946
  async getAddress() {
2908
2947
  return this.client.getAddress();
@@ -3060,8 +3099,8 @@ class SequenceSigner {
3060
3099
  class SingleNetworkSequenceSigner extends SequenceSigner {
3061
3100
  constructor(client, provider, chainId) {
3062
3101
  super(client, provider.getProvider(chainId));
3063
- this._isSingleNetworkSequenceSigner = true;
3064
3102
  this.chainId = chainId;
3103
+ this._isSingleNetworkSequenceSigner = true;
3065
3104
  }
3066
3105
  _useChainId(chainId) {
3067
3106
  const provided = this.provider.toChainId(chainId);
@@ -3169,11 +3208,13 @@ class SequenceProvider extends ethers.ethers.providers.BaseProvider {
3169
3208
  super(client.getChainId());
3170
3209
 
3171
3210
  // Emit events as defined by EIP-1193
3172
- this.singleNetworkProviders = {};
3173
- this._isSequenceProvider = true;
3174
3211
  this.client = client;
3175
3212
  this.providerFor = providerFor;
3176
3213
  this.networks = networks;
3214
+ this.singleNetworkProviders = {};
3215
+ this._isSequenceProvider = true;
3216
+ this.utils = void 0;
3217
+ this.signer = void 0;
3177
3218
  client.onConnect(details => {
3178
3219
  this.emit('connect', details);
3179
3220
  });
@@ -3484,8 +3525,8 @@ function normalizeChainId(chainId) {
3484
3525
  class SingleNetworkSequenceProvider extends SequenceProvider {
3485
3526
  constructor(client, providerFor, chainId) {
3486
3527
  super(client, providerFor);
3487
- this._isSingleNetworkSequenceProvider = true;
3488
3528
  this.chainId = chainId;
3529
+ this._isSingleNetworkSequenceProvider = true;
3489
3530
  }
3490
3531
  _useChainId(chainId) {
3491
3532
  const provided = this.toChainId(chainId);
@@ -3533,7 +3574,7 @@ class SingleNetworkSequenceProvider extends SequenceProvider {
3533
3574
 
3534
3575
  var packageJson = {
3535
3576
  name: "@0xsequence/provider",
3536
- version: "0.0.0-20231205222341",
3577
+ version: "0.0.0-20240111142017",
3537
3578
  description: "provider sub-package for Sequence",
3538
3579
  repository: "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
3539
3580
  source: "src/index.ts",
@@ -3544,7 +3585,7 @@ var packageJson = {
3544
3585
  scripts: {
3545
3586
  test: "pnpm test:concurrently 'pnpm test:run'",
3546
3587
  "test:run": "pnpm test:file tests/**/*.spec.ts",
3547
- "test:file": "NODE_OPTIONS='--loader tsx' mocha --timeout 30000",
3588
+ "test:file": "NODE_OPTIONS='--import tsx' mocha --timeout 30000",
3548
3589
  typecheck: "tsc --noEmit",
3549
3590
  "test:concurrently": "concurrently -k --success first 'pnpm start:hardhat1' 'pnpm start:hardhat2'",
3550
3591
  "start:hardhat1": "pnpm start:hardhat1:verbose > /dev/null 2>&1",
@@ -3626,9 +3667,9 @@ class SequenceClientSession {
3626
3667
  SequenceClientSession.SESSION_LOCALSTORE_KEY = '@sequence.session';
3627
3668
  class DefaultChainIdTracker {
3628
3669
  constructor(store, startingChainId = 1) {
3629
- this.callbacks = [];
3630
3670
  this.store = store;
3631
3671
  this.startingChainId = startingChainId;
3672
+ this.callbacks = [];
3632
3673
  store.onItemChange(DefaultChainIdTracker.SESSION_CHAIN_ID_KEY, value => {
3633
3674
  if (value) {
3634
3675
  const chainId = parseInt(value);
@@ -3665,8 +3706,12 @@ DefaultChainIdTracker.SESSION_CHAIN_ID_KEY = '@sequence.session.defaultChainId';
3665
3706
  class SequenceClient {
3666
3707
  constructor(transport, store, options, projectAccessKey) {
3667
3708
  var _options$defaultEIP;
3668
- this.callbacks = {};
3669
3709
  this.projectAccessKey = projectAccessKey;
3710
+ this.session = void 0;
3711
+ this.defaultChainId = void 0;
3712
+ this.callbacks = {};
3713
+ this.transport = void 0;
3714
+ this.defaultEIP6492 = void 0;
3670
3715
  if (isMuxTransportTemplate(transport)) {
3671
3716
  this.transport = MuxMessageProvider.new(transport);
3672
3717
  } else if (isProviderTransport(transport)) {
@@ -32,6 +32,8 @@ function isProviderTransport(transport) {
32
32
  // ProviderMessageCallback is used to respond to ProviderMessage requests. The error
33
33
  // argument is for exceptions during the execution, and response is the response payload
34
34
  // which may contain the result or an error payload from the wallet.
35
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
36
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
35
37
  class WindowSessionParams extends URLSearchParams {
36
38
  static new(init) {
37
39
  return new URLSearchParams(init);
@@ -93,8 +95,17 @@ class BaseProviderTransport {
93
95
  var _this = this;
94
96
  this.pendingMessageRequests = [];
95
97
  this.responseCallbacks = new Map();
98
+ this.state = void 0;
96
99
  this.confirmationOnly = false;
97
100
  this.events = new eventemitter2.EventEmitter2();
101
+ this.openPayload = void 0;
102
+ this.connectPayload = void 0;
103
+ this.accountsChangedPayload = void 0;
104
+ this.networksPayload = void 0;
105
+ this.walletContextPayload = void 0;
106
+ this._sessionId = void 0;
107
+ this._init = void 0;
108
+ this._registered = void 0;
98
109
  this.sendAsync = async function (request, callback, chainId) {
99
110
  // here, we receive the message from the dapp provider call
100
111
 
@@ -706,11 +717,18 @@ async function resolveArrayProperties(object) {
706
717
 
707
718
  const TRANSPORT_SESSION_LS_KEY = '@sequence.transportSession';
708
719
  class BaseWalletTransport {
709
- // appOrigin identifies the dapp's origin which opened the app. A transport
710
- // will auto-detect and set this value if it can. This is determined
711
- // as the parent app/window which opened the wallet.
712
720
  constructor(walletRequestHandler) {
713
721
  var _this = this;
722
+ this.walletRequestHandler = void 0;
723
+ this._sessionId = void 0;
724
+ this._registered = void 0;
725
+ this._init = void 0;
726
+ this._initNonce = void 0;
727
+ this._initCallback = void 0;
728
+ // appOrigin identifies the dapp's origin which opened the app. A transport
729
+ // will auto-detect and set this value if it can. This is determined
730
+ // as the parent app/window which opened the wallet.
731
+ this.appOrigin = void 0;
714
732
  this.sendAsync = async function (request, callback, chainId) {
715
733
  throw new Error('abstract method');
716
734
  };
@@ -1130,6 +1148,8 @@ class BaseWalletTransport {
1130
1148
 
1131
1149
  class ProxyMessageChannel {
1132
1150
  constructor() {
1151
+ this.app = void 0;
1152
+ this.wallet = void 0;
1133
1153
  const port1 = new ProxyMessageChannelPort();
1134
1154
  const port2 = new ProxyMessageChannelPort();
1135
1155
  port1.conn = port2;
@@ -1140,6 +1160,7 @@ class ProxyMessageChannel {
1140
1160
  }
1141
1161
  class ProxyMessageChannelPort {
1142
1162
  constructor() {
1163
+ this.conn = void 0;
1143
1164
  this.events = new eventemitter2.EventEmitter2();
1144
1165
  // handle messages which hit this port
1145
1166
  this.handleMessage = message => {
@@ -1175,6 +1196,7 @@ class ProxyMessageChannelPort {
1175
1196
  class ProxyMessageProvider extends BaseProviderTransport {
1176
1197
  constructor(port) {
1177
1198
  super();
1199
+ this.port = void 0;
1178
1200
  this.register = () => {
1179
1201
  this.port.handleMessage = message => {
1180
1202
  this.handleMessage(message);
@@ -1246,6 +1268,7 @@ class ProxyMessageProvider extends BaseProviderTransport {
1246
1268
  class ProxyMessageHandler extends BaseWalletTransport {
1247
1269
  constructor(walletRequestHandler, port) {
1248
1270
  super(walletRequestHandler);
1271
+ this.port = void 0;
1249
1272
  this.port = port;
1250
1273
  this._init = InitState.OK;
1251
1274
  }
@@ -1312,6 +1335,7 @@ let registeredUnrealMessageProvider;
1312
1335
  class UnrealMessageProvider extends BaseProviderTransport {
1313
1336
  constructor(walletAppURL) {
1314
1337
  super();
1338
+ this.walletURL = void 0;
1315
1339
  this.register = () => {
1316
1340
  var _window$ue;
1317
1341
  overrideLogs('dapp');
@@ -1503,6 +1527,7 @@ class ExtensionMessageHandler extends BaseWalletTransport {
1503
1527
  constructor(walletRequestHandler, runtime) {
1504
1528
  super(walletRequestHandler);
1505
1529
  this.runtime = runtime;
1530
+ this.port = void 0;
1506
1531
  this._init = InitState.OK;
1507
1532
  }
1508
1533
  register() {
@@ -1552,6 +1577,7 @@ class BaseInjectedTransport extends eventemitter2.EventEmitter2 {
1552
1577
  var _this;
1553
1578
  super();
1554
1579
  _this = this;
1580
+ this.stream = stream;
1555
1581
  this.responseCallbacks = new Map();
1556
1582
  this._messageIdx = 0;
1557
1583
  this.nextMessageIdx = () => ++this._messageIdx;
@@ -1612,7 +1638,6 @@ class BaseInjectedTransport extends eventemitter2.EventEmitter2 {
1612
1638
  _this.sendMessage(message);
1613
1639
  });
1614
1640
  };
1615
- this.stream = stream;
1616
1641
  this.stream.on('data', this.handleMessage);
1617
1642
  }
1618
1643
  sendMessage(message) {
@@ -1628,6 +1653,8 @@ let registeredWindowMessageProvider;
1628
1653
  class WindowMessageProvider extends BaseProviderTransport {
1629
1654
  constructor(walletAppURL) {
1630
1655
  super();
1656
+ this.walletURL = void 0;
1657
+ this.walletWindow = void 0;
1631
1658
  this.register = () => {
1632
1659
  if (registeredWindowMessageProvider) {
1633
1660
  // overriding the registered message provider
@@ -1797,6 +1824,7 @@ class WindowMessageHandler extends BaseWalletTransport {
1797
1824
  var _this;
1798
1825
  super(walletRequestHandler);
1799
1826
  _this = this;
1827
+ this.parentWindow = void 0;
1800
1828
  this._isPopup = false;
1801
1829
  // onmessage is called when (the wallet) receives request messages from the dapp
1802
1830
  // over the window post-messaging transport
@@ -1945,6 +1973,8 @@ function isMuxTransportTemplate(obj) {
1945
1973
  class MuxMessageProvider {
1946
1974
  constructor(...messageProviders) {
1947
1975
  var _this = this;
1976
+ this.messageProviders = void 0;
1977
+ this.provider = void 0;
1948
1978
  this.register = () => {
1949
1979
  if (this.messageProviders.length === 1) {
1950
1980
  this.provider = this.messageProviders[0];
@@ -2155,7 +2185,12 @@ class WalletRequestHandler {
2155
2185
  // signer interface of the wallet. A null value means there is no signer (ie. user not signed in). An undefined
2156
2186
  // value means the signer state is unknown, usually meaning the wallet app is booting up and initializing. Of course
2157
2187
  // a Signer value is the actually interface to a signed-in account
2188
+ this.account = void 0;
2158
2189
  this.signerReadyCallbacks = [];
2190
+ this.prompter = void 0;
2191
+ this.networks = void 0;
2192
+ this._openIntent = void 0;
2193
+ this._connectOptions = void 0;
2159
2194
  this.events = new eventemitter2.EventEmitter2();
2160
2195
  this.onConnectOptionsChange = undefined;
2161
2196
  this.promptConnect = async function (options) {
@@ -2644,6 +2679,10 @@ class WalletRequestHandler {
2644
2679
  }
2645
2680
  }
2646
2681
  signOut() {
2682
+ if (this.account) {
2683
+ this.notifyDisconnect();
2684
+ }
2685
+
2647
2686
  // signed out state
2648
2687
  this.setAccount(null);
2649
2688
  }
@@ -2898,11 +2937,11 @@ class SequenceSigner {
2898
2937
  return this.provider.utils;
2899
2938
  }
2900
2939
  constructor(client, provider) {
2940
+ this.client = client;
2941
+ this.provider = provider;
2901
2942
  this.singleNetworkSigners = {};
2902
2943
  this._isSigner = true;
2903
2944
  this._isSequenceSigner = true;
2904
- this.client = client;
2905
- this.provider = provider;
2906
2945
  }
2907
2946
  async getAddress() {
2908
2947
  return this.client.getAddress();
@@ -3060,8 +3099,8 @@ class SequenceSigner {
3060
3099
  class SingleNetworkSequenceSigner extends SequenceSigner {
3061
3100
  constructor(client, provider, chainId) {
3062
3101
  super(client, provider.getProvider(chainId));
3063
- this._isSingleNetworkSequenceSigner = true;
3064
3102
  this.chainId = chainId;
3103
+ this._isSingleNetworkSequenceSigner = true;
3065
3104
  }
3066
3105
  _useChainId(chainId) {
3067
3106
  const provided = this.provider.toChainId(chainId);
@@ -3169,11 +3208,13 @@ class SequenceProvider extends ethers.ethers.providers.BaseProvider {
3169
3208
  super(client.getChainId());
3170
3209
 
3171
3210
  // Emit events as defined by EIP-1193
3172
- this.singleNetworkProviders = {};
3173
- this._isSequenceProvider = true;
3174
3211
  this.client = client;
3175
3212
  this.providerFor = providerFor;
3176
3213
  this.networks = networks;
3214
+ this.singleNetworkProviders = {};
3215
+ this._isSequenceProvider = true;
3216
+ this.utils = void 0;
3217
+ this.signer = void 0;
3177
3218
  client.onConnect(details => {
3178
3219
  this.emit('connect', details);
3179
3220
  });
@@ -3484,8 +3525,8 @@ function normalizeChainId(chainId) {
3484
3525
  class SingleNetworkSequenceProvider extends SequenceProvider {
3485
3526
  constructor(client, providerFor, chainId) {
3486
3527
  super(client, providerFor);
3487
- this._isSingleNetworkSequenceProvider = true;
3488
3528
  this.chainId = chainId;
3529
+ this._isSingleNetworkSequenceProvider = true;
3489
3530
  }
3490
3531
  _useChainId(chainId) {
3491
3532
  const provided = this.toChainId(chainId);
@@ -3533,7 +3574,7 @@ class SingleNetworkSequenceProvider extends SequenceProvider {
3533
3574
 
3534
3575
  var packageJson = {
3535
3576
  name: "@0xsequence/provider",
3536
- version: "0.0.0-20231205222341",
3577
+ version: "0.0.0-20240111142017",
3537
3578
  description: "provider sub-package for Sequence",
3538
3579
  repository: "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
3539
3580
  source: "src/index.ts",
@@ -3544,7 +3585,7 @@ var packageJson = {
3544
3585
  scripts: {
3545
3586
  test: "pnpm test:concurrently 'pnpm test:run'",
3546
3587
  "test:run": "pnpm test:file tests/**/*.spec.ts",
3547
- "test:file": "NODE_OPTIONS='--loader tsx' mocha --timeout 30000",
3588
+ "test:file": "NODE_OPTIONS='--import tsx' mocha --timeout 30000",
3548
3589
  typecheck: "tsc --noEmit",
3549
3590
  "test:concurrently": "concurrently -k --success first 'pnpm start:hardhat1' 'pnpm start:hardhat2'",
3550
3591
  "start:hardhat1": "pnpm start:hardhat1:verbose > /dev/null 2>&1",
@@ -3626,9 +3667,9 @@ class SequenceClientSession {
3626
3667
  SequenceClientSession.SESSION_LOCALSTORE_KEY = '@sequence.session';
3627
3668
  class DefaultChainIdTracker {
3628
3669
  constructor(store, startingChainId = 1) {
3629
- this.callbacks = [];
3630
3670
  this.store = store;
3631
3671
  this.startingChainId = startingChainId;
3672
+ this.callbacks = [];
3632
3673
  store.onItemChange(DefaultChainIdTracker.SESSION_CHAIN_ID_KEY, value => {
3633
3674
  if (value) {
3634
3675
  const chainId = parseInt(value);
@@ -3665,8 +3706,12 @@ DefaultChainIdTracker.SESSION_CHAIN_ID_KEY = '@sequence.session.defaultChainId';
3665
3706
  class SequenceClient {
3666
3707
  constructor(transport, store, options, projectAccessKey) {
3667
3708
  var _options$defaultEIP;
3668
- this.callbacks = {};
3669
3709
  this.projectAccessKey = projectAccessKey;
3710
+ this.session = void 0;
3711
+ this.defaultChainId = void 0;
3712
+ this.callbacks = {};
3713
+ this.transport = void 0;
3714
+ this.defaultEIP6492 = void 0;
3670
3715
  if (isMuxTransportTemplate(transport)) {
3671
3716
  this.transport = MuxMessageProvider.new(transport);
3672
3717
  } else if (isProviderTransport(transport)) {
@@ -28,6 +28,8 @@ function isProviderTransport(transport) {
28
28
  // ProviderMessageCallback is used to respond to ProviderMessage requests. The error
29
29
  // argument is for exceptions during the execution, and response is the response payload
30
30
  // which may contain the result or an error payload from the wallet.
31
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
32
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
31
33
  class WindowSessionParams extends URLSearchParams {
32
34
  static new(init) {
33
35
  return new URLSearchParams(init);
@@ -89,8 +91,17 @@ class BaseProviderTransport {
89
91
  var _this = this;
90
92
  this.pendingMessageRequests = [];
91
93
  this.responseCallbacks = new Map();
94
+ this.state = void 0;
92
95
  this.confirmationOnly = false;
93
96
  this.events = new EventEmitter2();
97
+ this.openPayload = void 0;
98
+ this.connectPayload = void 0;
99
+ this.accountsChangedPayload = void 0;
100
+ this.networksPayload = void 0;
101
+ this.walletContextPayload = void 0;
102
+ this._sessionId = void 0;
103
+ this._init = void 0;
104
+ this._registered = void 0;
94
105
  this.sendAsync = async function (request, callback, chainId) {
95
106
  // here, we receive the message from the dapp provider call
96
107
 
@@ -702,11 +713,18 @@ async function resolveArrayProperties(object) {
702
713
 
703
714
  const TRANSPORT_SESSION_LS_KEY = '@sequence.transportSession';
704
715
  class BaseWalletTransport {
705
- // appOrigin identifies the dapp's origin which opened the app. A transport
706
- // will auto-detect and set this value if it can. This is determined
707
- // as the parent app/window which opened the wallet.
708
716
  constructor(walletRequestHandler) {
709
717
  var _this = this;
718
+ this.walletRequestHandler = void 0;
719
+ this._sessionId = void 0;
720
+ this._registered = void 0;
721
+ this._init = void 0;
722
+ this._initNonce = void 0;
723
+ this._initCallback = void 0;
724
+ // appOrigin identifies the dapp's origin which opened the app. A transport
725
+ // will auto-detect and set this value if it can. This is determined
726
+ // as the parent app/window which opened the wallet.
727
+ this.appOrigin = void 0;
710
728
  this.sendAsync = async function (request, callback, chainId) {
711
729
  throw new Error('abstract method');
712
730
  };
@@ -1126,6 +1144,8 @@ class BaseWalletTransport {
1126
1144
 
1127
1145
  class ProxyMessageChannel {
1128
1146
  constructor() {
1147
+ this.app = void 0;
1148
+ this.wallet = void 0;
1129
1149
  const port1 = new ProxyMessageChannelPort();
1130
1150
  const port2 = new ProxyMessageChannelPort();
1131
1151
  port1.conn = port2;
@@ -1136,6 +1156,7 @@ class ProxyMessageChannel {
1136
1156
  }
1137
1157
  class ProxyMessageChannelPort {
1138
1158
  constructor() {
1159
+ this.conn = void 0;
1139
1160
  this.events = new EventEmitter2();
1140
1161
  // handle messages which hit this port
1141
1162
  this.handleMessage = message => {
@@ -1171,6 +1192,7 @@ class ProxyMessageChannelPort {
1171
1192
  class ProxyMessageProvider extends BaseProviderTransport {
1172
1193
  constructor(port) {
1173
1194
  super();
1195
+ this.port = void 0;
1174
1196
  this.register = () => {
1175
1197
  this.port.handleMessage = message => {
1176
1198
  this.handleMessage(message);
@@ -1242,6 +1264,7 @@ class ProxyMessageProvider extends BaseProviderTransport {
1242
1264
  class ProxyMessageHandler extends BaseWalletTransport {
1243
1265
  constructor(walletRequestHandler, port) {
1244
1266
  super(walletRequestHandler);
1267
+ this.port = void 0;
1245
1268
  this.port = port;
1246
1269
  this._init = InitState.OK;
1247
1270
  }
@@ -1308,6 +1331,7 @@ let registeredUnrealMessageProvider;
1308
1331
  class UnrealMessageProvider extends BaseProviderTransport {
1309
1332
  constructor(walletAppURL) {
1310
1333
  super();
1334
+ this.walletURL = void 0;
1311
1335
  this.register = () => {
1312
1336
  var _window$ue;
1313
1337
  overrideLogs('dapp');
@@ -1499,6 +1523,7 @@ class ExtensionMessageHandler extends BaseWalletTransport {
1499
1523
  constructor(walletRequestHandler, runtime) {
1500
1524
  super(walletRequestHandler);
1501
1525
  this.runtime = runtime;
1526
+ this.port = void 0;
1502
1527
  this._init = InitState.OK;
1503
1528
  }
1504
1529
  register() {
@@ -1548,6 +1573,7 @@ class BaseInjectedTransport extends EventEmitter2 {
1548
1573
  var _this;
1549
1574
  super();
1550
1575
  _this = this;
1576
+ this.stream = stream;
1551
1577
  this.responseCallbacks = new Map();
1552
1578
  this._messageIdx = 0;
1553
1579
  this.nextMessageIdx = () => ++this._messageIdx;
@@ -1608,7 +1634,6 @@ class BaseInjectedTransport extends EventEmitter2 {
1608
1634
  _this.sendMessage(message);
1609
1635
  });
1610
1636
  };
1611
- this.stream = stream;
1612
1637
  this.stream.on('data', this.handleMessage);
1613
1638
  }
1614
1639
  sendMessage(message) {
@@ -1624,6 +1649,8 @@ let registeredWindowMessageProvider;
1624
1649
  class WindowMessageProvider extends BaseProviderTransport {
1625
1650
  constructor(walletAppURL) {
1626
1651
  super();
1652
+ this.walletURL = void 0;
1653
+ this.walletWindow = void 0;
1627
1654
  this.register = () => {
1628
1655
  if (registeredWindowMessageProvider) {
1629
1656
  // overriding the registered message provider
@@ -1793,6 +1820,7 @@ class WindowMessageHandler extends BaseWalletTransport {
1793
1820
  var _this;
1794
1821
  super(walletRequestHandler);
1795
1822
  _this = this;
1823
+ this.parentWindow = void 0;
1796
1824
  this._isPopup = false;
1797
1825
  // onmessage is called when (the wallet) receives request messages from the dapp
1798
1826
  // over the window post-messaging transport
@@ -1941,6 +1969,8 @@ function isMuxTransportTemplate(obj) {
1941
1969
  class MuxMessageProvider {
1942
1970
  constructor(...messageProviders) {
1943
1971
  var _this = this;
1972
+ this.messageProviders = void 0;
1973
+ this.provider = void 0;
1944
1974
  this.register = () => {
1945
1975
  if (this.messageProviders.length === 1) {
1946
1976
  this.provider = this.messageProviders[0];
@@ -2151,7 +2181,12 @@ class WalletRequestHandler {
2151
2181
  // signer interface of the wallet. A null value means there is no signer (ie. user not signed in). An undefined
2152
2182
  // value means the signer state is unknown, usually meaning the wallet app is booting up and initializing. Of course
2153
2183
  // a Signer value is the actually interface to a signed-in account
2184
+ this.account = void 0;
2154
2185
  this.signerReadyCallbacks = [];
2186
+ this.prompter = void 0;
2187
+ this.networks = void 0;
2188
+ this._openIntent = void 0;
2189
+ this._connectOptions = void 0;
2155
2190
  this.events = new EventEmitter2();
2156
2191
  this.onConnectOptionsChange = undefined;
2157
2192
  this.promptConnect = async function (options) {
@@ -2640,6 +2675,10 @@ class WalletRequestHandler {
2640
2675
  }
2641
2676
  }
2642
2677
  signOut() {
2678
+ if (this.account) {
2679
+ this.notifyDisconnect();
2680
+ }
2681
+
2643
2682
  // signed out state
2644
2683
  this.setAccount(null);
2645
2684
  }
@@ -2894,11 +2933,11 @@ class SequenceSigner {
2894
2933
  return this.provider.utils;
2895
2934
  }
2896
2935
  constructor(client, provider) {
2936
+ this.client = client;
2937
+ this.provider = provider;
2897
2938
  this.singleNetworkSigners = {};
2898
2939
  this._isSigner = true;
2899
2940
  this._isSequenceSigner = true;
2900
- this.client = client;
2901
- this.provider = provider;
2902
2941
  }
2903
2942
  async getAddress() {
2904
2943
  return this.client.getAddress();
@@ -3056,8 +3095,8 @@ class SequenceSigner {
3056
3095
  class SingleNetworkSequenceSigner extends SequenceSigner {
3057
3096
  constructor(client, provider, chainId) {
3058
3097
  super(client, provider.getProvider(chainId));
3059
- this._isSingleNetworkSequenceSigner = true;
3060
3098
  this.chainId = chainId;
3099
+ this._isSingleNetworkSequenceSigner = true;
3061
3100
  }
3062
3101
  _useChainId(chainId) {
3063
3102
  const provided = this.provider.toChainId(chainId);
@@ -3165,11 +3204,13 @@ class SequenceProvider extends ethers.providers.BaseProvider {
3165
3204
  super(client.getChainId());
3166
3205
 
3167
3206
  // Emit events as defined by EIP-1193
3168
- this.singleNetworkProviders = {};
3169
- this._isSequenceProvider = true;
3170
3207
  this.client = client;
3171
3208
  this.providerFor = providerFor;
3172
3209
  this.networks = networks;
3210
+ this.singleNetworkProviders = {};
3211
+ this._isSequenceProvider = true;
3212
+ this.utils = void 0;
3213
+ this.signer = void 0;
3173
3214
  client.onConnect(details => {
3174
3215
  this.emit('connect', details);
3175
3216
  });
@@ -3480,8 +3521,8 @@ function normalizeChainId(chainId) {
3480
3521
  class SingleNetworkSequenceProvider extends SequenceProvider {
3481
3522
  constructor(client, providerFor, chainId) {
3482
3523
  super(client, providerFor);
3483
- this._isSingleNetworkSequenceProvider = true;
3484
3524
  this.chainId = chainId;
3525
+ this._isSingleNetworkSequenceProvider = true;
3485
3526
  }
3486
3527
  _useChainId(chainId) {
3487
3528
  const provided = this.toChainId(chainId);
@@ -3529,7 +3570,7 @@ class SingleNetworkSequenceProvider extends SequenceProvider {
3529
3570
 
3530
3571
  var packageJson = {
3531
3572
  name: "@0xsequence/provider",
3532
- version: "0.0.0-20231205222341",
3573
+ version: "0.0.0-20240111142017",
3533
3574
  description: "provider sub-package for Sequence",
3534
3575
  repository: "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
3535
3576
  source: "src/index.ts",
@@ -3540,7 +3581,7 @@ var packageJson = {
3540
3581
  scripts: {
3541
3582
  test: "pnpm test:concurrently 'pnpm test:run'",
3542
3583
  "test:run": "pnpm test:file tests/**/*.spec.ts",
3543
- "test:file": "NODE_OPTIONS='--loader tsx' mocha --timeout 30000",
3584
+ "test:file": "NODE_OPTIONS='--import tsx' mocha --timeout 30000",
3544
3585
  typecheck: "tsc --noEmit",
3545
3586
  "test:concurrently": "concurrently -k --success first 'pnpm start:hardhat1' 'pnpm start:hardhat2'",
3546
3587
  "start:hardhat1": "pnpm start:hardhat1:verbose > /dev/null 2>&1",
@@ -3622,9 +3663,9 @@ class SequenceClientSession {
3622
3663
  SequenceClientSession.SESSION_LOCALSTORE_KEY = '@sequence.session';
3623
3664
  class DefaultChainIdTracker {
3624
3665
  constructor(store, startingChainId = 1) {
3625
- this.callbacks = [];
3626
3666
  this.store = store;
3627
3667
  this.startingChainId = startingChainId;
3668
+ this.callbacks = [];
3628
3669
  store.onItemChange(DefaultChainIdTracker.SESSION_CHAIN_ID_KEY, value => {
3629
3670
  if (value) {
3630
3671
  const chainId = parseInt(value);
@@ -3661,8 +3702,12 @@ DefaultChainIdTracker.SESSION_CHAIN_ID_KEY = '@sequence.session.defaultChainId';
3661
3702
  class SequenceClient {
3662
3703
  constructor(transport, store, options, projectAccessKey) {
3663
3704
  var _options$defaultEIP;
3664
- this.callbacks = {};
3665
3705
  this.projectAccessKey = projectAccessKey;
3706
+ this.session = void 0;
3707
+ this.defaultChainId = void 0;
3708
+ this.callbacks = {};
3709
+ this.transport = void 0;
3710
+ this.defaultEIP6492 = void 0;
3666
3711
  if (isMuxTransportTemplate(transport)) {
3667
3712
  this.transport = MuxMessageProvider.new(transport);
3668
3713
  } else if (isProviderTransport(transport)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/provider",
3
- "version": "0.0.0-20231205222341",
3
+ "version": "0.0.0-20240111142017",
4
4
  "description": "provider sub-package for Sequence",
5
5
  "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
6
6
  "source": "src/index.ts",
@@ -11,15 +11,15 @@
11
11
  "dependencies": {
12
12
  "eventemitter2": "^6.4.5",
13
13
  "webextension-polyfill": "^0.10.0",
14
- "@0xsequence/abi": "0.0.0-20231205222341",
15
- "@0xsequence/account": "0.0.0-20231205222341",
16
- "@0xsequence/auth": "0.0.0-20231205222341",
17
- "@0xsequence/migration": "0.0.0-20231205222341",
18
- "@0xsequence/core": "0.0.0-20231205222341",
19
- "@0xsequence/network": "0.0.0-20231205222341",
20
- "@0xsequence/relayer": "0.0.0-20231205222341",
21
- "@0xsequence/utils": "0.0.0-20231205222341",
22
- "@0xsequence/wallet": "0.0.0-20231205222341"
14
+ "@0xsequence/abi": "0.0.0-20240111142017",
15
+ "@0xsequence/account": "0.0.0-20240111142017",
16
+ "@0xsequence/migration": "0.0.0-20240111142017",
17
+ "@0xsequence/core": "0.0.0-20240111142017",
18
+ "@0xsequence/auth": "0.0.0-20240111142017",
19
+ "@0xsequence/network": "0.0.0-20240111142017",
20
+ "@0xsequence/relayer": "0.0.0-20240111142017",
21
+ "@0xsequence/wallet": "0.0.0-20240111142017",
22
+ "@0xsequence/utils": "0.0.0-20240111142017"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "ethers": ">=5.5 < 6"
@@ -36,7 +36,7 @@
36
36
  "scripts": {
37
37
  "test": "pnpm test:concurrently 'pnpm test:run'",
38
38
  "test:run": "pnpm test:file tests/**/*.spec.ts",
39
- "test:file": "NODE_OPTIONS='--loader tsx' mocha --timeout 30000",
39
+ "test:file": "NODE_OPTIONS='--import tsx' mocha --timeout 30000",
40
40
  "typecheck": "tsc --noEmit",
41
41
  "test:concurrently": "concurrently -k --success first 'pnpm start:hardhat1' 'pnpm start:hardhat2'",
42
42
  "start:hardhat1": "pnpm start:hardhat1:verbose > /dev/null 2>&1",
@@ -110,6 +110,10 @@ export class WalletRequestHandler implements ExternalProvider, JsonRpcHandler, P
110
110
  }
111
111
 
112
112
  signOut() {
113
+ if (this.account) {
114
+ this.notifyDisconnect()
115
+ }
116
+
113
117
  // signed out state
114
118
  this.setAccount(null)
115
119
  }
package/src/types.ts CHANGED
@@ -90,11 +90,13 @@ export interface ProviderMessageTransport {
90
90
 
91
91
  export type WindowSessionParam = 'sid' | 'net' | 'intent'
92
92
 
93
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
93
94
  export interface WindowSessionParams extends URLSearchParams {
94
95
  get(name: WindowSessionParam): string | null
95
96
  set(name: WindowSessionParam, value: string): void
96
97
  }
97
98
 
99
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
98
100
  export class WindowSessionParams extends URLSearchParams {
99
101
  static new(init?: Record<WindowSessionParam, string> | string) {
100
102
  return new URLSearchParams(init) as WindowSessionParams