@0xsequence/provider 1.8.0 → 1.8.2

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.
@@ -3612,7 +3612,7 @@ const setupAnalytics = (projectAccessKey, server) => {
3612
3612
 
3613
3613
  var packageJson = {
3614
3614
  name: "@0xsequence/provider",
3615
- version: "1.8.0",
3615
+ version: "1.8.2",
3616
3616
  description: "provider sub-package for Sequence",
3617
3617
  repository: "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
3618
3618
  source: "src/index.ts",
@@ -3746,7 +3746,7 @@ DefaultChainIdTracker.SESSION_CHAIN_ID_KEY = '@sequence.session.defaultChainId';
3746
3746
  // TODO: rename Client to transport.. or something.. like SequenceTransport ..
3747
3747
  class SequenceClient {
3748
3748
  constructor(transport, store, options) {
3749
- var _options$defaultEIP;
3749
+ var _options$defaultEIP, _this$session$getSess;
3750
3750
  this.session = void 0;
3751
3751
  this.defaultChainId = void 0;
3752
3752
  this.callbacks = {};
@@ -3818,8 +3818,10 @@ class SequenceClient {
3818
3818
  }
3819
3819
  if (this.projectAccessKey && options != null && options.analytics) {
3820
3820
  this.analytics = setupAnalytics(this.projectAccessKey);
3821
- } else {
3822
- this.analytics = setupAnalytics(''); // noop analytics
3821
+ }
3822
+ if ((_this$session$getSess = this.session.getSession()) != null && _this$session$getSess.accountAddress) {
3823
+ var _this$analytics, _this$session$getSess2;
3824
+ (_this$analytics = this.analytics) == null || _this$analytics.identify((_this$session$getSess2 = this.session.getSession()) == null ? void 0 : _this$session$getSess2.accountAddress);
3823
3825
  }
3824
3826
  }
3825
3827
 
@@ -3944,17 +3946,24 @@ class SequenceClient {
3944
3946
  connectDetails.chainId = ethers.ethers.BigNumber.from(connectDetails.chainId).toString();
3945
3947
  }
3946
3948
  if (connectDetails.connected) {
3949
+ var _connectDetails$sessi;
3947
3950
  if (!connectDetails.session) {
3948
3951
  throw new Error('impossible state, connect response is missing session');
3949
3952
  }
3950
3953
  this.session.setSession(connectDetails.session);
3954
+ if ((_connectDetails$sessi = connectDetails.session) != null && _connectDetails$sessi.accountAddress) {
3955
+ var _this$analytics2;
3956
+ (_this$analytics2 = this.analytics) == null || _this$analytics2.identify(connectDetails.session.accountAddress);
3957
+ }
3951
3958
  }
3952
3959
  return connectDetails;
3953
3960
  }
3954
3961
  disconnect() {
3962
+ var _this$analytics3;
3955
3963
  if (this.isOpened()) {
3956
3964
  this.closeWallet();
3957
3965
  }
3966
+ (_this$analytics3 = this.analytics) == null || _this$analytics3.reset();
3958
3967
  return this.session.clearSession();
3959
3968
  }
3960
3969
 
@@ -4034,9 +4043,9 @@ class SequenceClient {
4034
4043
  return method;
4035
4044
  }
4036
4045
  async signMessage(message, options) {
4037
- var _this$analytics;
4046
+ var _this$analytics4;
4038
4047
  const method = this.signMethod(options);
4039
- (_this$analytics = this.analytics) == null || _this$analytics.track({
4048
+ (_this$analytics4 = this.analytics) == null || _this$analytics4.track({
4040
4049
  event: 'SIGN_MESSAGE_REQUEST',
4041
4050
  props: {
4042
4051
  chainId: `${(options == null ? void 0 : options.chainId) || this.getChainId()}`
@@ -4050,7 +4059,7 @@ class SequenceClient {
4050
4059
  }, options == null ? void 0 : options.chainId);
4051
4060
  }
4052
4061
  async signTypedData(typedData, options) {
4053
- var _this$analytics2;
4062
+ var _this$analytics5;
4054
4063
  const method = this.signTypedDataMethod(options);
4055
4064
 
4056
4065
  // TODO: Stop using ethers for this, this is the only place where we use it
@@ -4062,7 +4071,7 @@ class SequenceClient {
4062
4071
  // - The one provided in the typedData.domain.chainId
4063
4072
  // - The default chainId
4064
4073
 
4065
- (_this$analytics2 = this.analytics) == null || _this$analytics2.track({
4074
+ (_this$analytics5 = this.analytics) == null || _this$analytics5.track({
4066
4075
  event: 'SIGN_TYPED_DATA_REQUEST',
4067
4076
  props: {
4068
4077
  chainId: `${(options == null ? void 0 : options.chainId) || this.getChainId()}`
@@ -4074,10 +4083,10 @@ class SequenceClient {
4074
4083
  }, (options == null ? void 0 : options.chainId) || typedData.domain.chainId && ethers.ethers.BigNumber.from(typedData.domain.chainId).toNumber() || this.getChainId());
4075
4084
  }
4076
4085
  async sendTransaction(tx, options) {
4077
- var _this$analytics3;
4086
+ var _this$analytics6;
4078
4087
  const sequenceTxs = Array.isArray(tx) ? tx : [tx];
4079
4088
  const extendedTxs = toExtended(sequenceTxs);
4080
- (_this$analytics3 = this.analytics) == null || _this$analytics3.track({
4089
+ (_this$analytics6 = this.analytics) == null || _this$analytics6.track({
4081
4090
  event: 'SEND_TRANSACTION_REQUEST',
4082
4091
  props: {
4083
4092
  chainId: `${(options == null ? void 0 : options.chainId) || this.getChainId()}`
@@ -3612,7 +3612,7 @@ const setupAnalytics = (projectAccessKey, server) => {
3612
3612
 
3613
3613
  var packageJson = {
3614
3614
  name: "@0xsequence/provider",
3615
- version: "1.8.0",
3615
+ version: "1.8.2",
3616
3616
  description: "provider sub-package for Sequence",
3617
3617
  repository: "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
3618
3618
  source: "src/index.ts",
@@ -3746,7 +3746,7 @@ DefaultChainIdTracker.SESSION_CHAIN_ID_KEY = '@sequence.session.defaultChainId';
3746
3746
  // TODO: rename Client to transport.. or something.. like SequenceTransport ..
3747
3747
  class SequenceClient {
3748
3748
  constructor(transport, store, options) {
3749
- var _options$defaultEIP;
3749
+ var _options$defaultEIP, _this$session$getSess;
3750
3750
  this.session = void 0;
3751
3751
  this.defaultChainId = void 0;
3752
3752
  this.callbacks = {};
@@ -3818,8 +3818,10 @@ class SequenceClient {
3818
3818
  }
3819
3819
  if (this.projectAccessKey && options != null && options.analytics) {
3820
3820
  this.analytics = setupAnalytics(this.projectAccessKey);
3821
- } else {
3822
- this.analytics = setupAnalytics(''); // noop analytics
3821
+ }
3822
+ if ((_this$session$getSess = this.session.getSession()) != null && _this$session$getSess.accountAddress) {
3823
+ var _this$analytics, _this$session$getSess2;
3824
+ (_this$analytics = this.analytics) == null || _this$analytics.identify((_this$session$getSess2 = this.session.getSession()) == null ? void 0 : _this$session$getSess2.accountAddress);
3823
3825
  }
3824
3826
  }
3825
3827
 
@@ -3944,17 +3946,24 @@ class SequenceClient {
3944
3946
  connectDetails.chainId = ethers.ethers.BigNumber.from(connectDetails.chainId).toString();
3945
3947
  }
3946
3948
  if (connectDetails.connected) {
3949
+ var _connectDetails$sessi;
3947
3950
  if (!connectDetails.session) {
3948
3951
  throw new Error('impossible state, connect response is missing session');
3949
3952
  }
3950
3953
  this.session.setSession(connectDetails.session);
3954
+ if ((_connectDetails$sessi = connectDetails.session) != null && _connectDetails$sessi.accountAddress) {
3955
+ var _this$analytics2;
3956
+ (_this$analytics2 = this.analytics) == null || _this$analytics2.identify(connectDetails.session.accountAddress);
3957
+ }
3951
3958
  }
3952
3959
  return connectDetails;
3953
3960
  }
3954
3961
  disconnect() {
3962
+ var _this$analytics3;
3955
3963
  if (this.isOpened()) {
3956
3964
  this.closeWallet();
3957
3965
  }
3966
+ (_this$analytics3 = this.analytics) == null || _this$analytics3.reset();
3958
3967
  return this.session.clearSession();
3959
3968
  }
3960
3969
 
@@ -4034,9 +4043,9 @@ class SequenceClient {
4034
4043
  return method;
4035
4044
  }
4036
4045
  async signMessage(message, options) {
4037
- var _this$analytics;
4046
+ var _this$analytics4;
4038
4047
  const method = this.signMethod(options);
4039
- (_this$analytics = this.analytics) == null || _this$analytics.track({
4048
+ (_this$analytics4 = this.analytics) == null || _this$analytics4.track({
4040
4049
  event: 'SIGN_MESSAGE_REQUEST',
4041
4050
  props: {
4042
4051
  chainId: `${(options == null ? void 0 : options.chainId) || this.getChainId()}`
@@ -4050,7 +4059,7 @@ class SequenceClient {
4050
4059
  }, options == null ? void 0 : options.chainId);
4051
4060
  }
4052
4061
  async signTypedData(typedData, options) {
4053
- var _this$analytics2;
4062
+ var _this$analytics5;
4054
4063
  const method = this.signTypedDataMethod(options);
4055
4064
 
4056
4065
  // TODO: Stop using ethers for this, this is the only place where we use it
@@ -4062,7 +4071,7 @@ class SequenceClient {
4062
4071
  // - The one provided in the typedData.domain.chainId
4063
4072
  // - The default chainId
4064
4073
 
4065
- (_this$analytics2 = this.analytics) == null || _this$analytics2.track({
4074
+ (_this$analytics5 = this.analytics) == null || _this$analytics5.track({
4066
4075
  event: 'SIGN_TYPED_DATA_REQUEST',
4067
4076
  props: {
4068
4077
  chainId: `${(options == null ? void 0 : options.chainId) || this.getChainId()}`
@@ -4074,10 +4083,10 @@ class SequenceClient {
4074
4083
  }, (options == null ? void 0 : options.chainId) || typedData.domain.chainId && ethers.ethers.BigNumber.from(typedData.domain.chainId).toNumber() || this.getChainId());
4075
4084
  }
4076
4085
  async sendTransaction(tx, options) {
4077
- var _this$analytics3;
4086
+ var _this$analytics6;
4078
4087
  const sequenceTxs = Array.isArray(tx) ? tx : [tx];
4079
4088
  const extendedTxs = toExtended(sequenceTxs);
4080
- (_this$analytics3 = this.analytics) == null || _this$analytics3.track({
4089
+ (_this$analytics6 = this.analytics) == null || _this$analytics6.track({
4081
4090
  event: 'SEND_TRANSACTION_REQUEST',
4082
4091
  props: {
4083
4092
  chainId: `${(options == null ? void 0 : options.chainId) || this.getChainId()}`
@@ -3608,7 +3608,7 @@ const setupAnalytics = (projectAccessKey, server) => {
3608
3608
 
3609
3609
  var packageJson = {
3610
3610
  name: "@0xsequence/provider",
3611
- version: "1.8.0",
3611
+ version: "1.8.2",
3612
3612
  description: "provider sub-package for Sequence",
3613
3613
  repository: "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
3614
3614
  source: "src/index.ts",
@@ -3742,7 +3742,7 @@ DefaultChainIdTracker.SESSION_CHAIN_ID_KEY = '@sequence.session.defaultChainId';
3742
3742
  // TODO: rename Client to transport.. or something.. like SequenceTransport ..
3743
3743
  class SequenceClient {
3744
3744
  constructor(transport, store, options) {
3745
- var _options$defaultEIP;
3745
+ var _options$defaultEIP, _this$session$getSess;
3746
3746
  this.session = void 0;
3747
3747
  this.defaultChainId = void 0;
3748
3748
  this.callbacks = {};
@@ -3814,8 +3814,10 @@ class SequenceClient {
3814
3814
  }
3815
3815
  if (this.projectAccessKey && options != null && options.analytics) {
3816
3816
  this.analytics = setupAnalytics(this.projectAccessKey);
3817
- } else {
3818
- this.analytics = setupAnalytics(''); // noop analytics
3817
+ }
3818
+ if ((_this$session$getSess = this.session.getSession()) != null && _this$session$getSess.accountAddress) {
3819
+ var _this$analytics, _this$session$getSess2;
3820
+ (_this$analytics = this.analytics) == null || _this$analytics.identify((_this$session$getSess2 = this.session.getSession()) == null ? void 0 : _this$session$getSess2.accountAddress);
3819
3821
  }
3820
3822
  }
3821
3823
 
@@ -3940,17 +3942,24 @@ class SequenceClient {
3940
3942
  connectDetails.chainId = ethers.BigNumber.from(connectDetails.chainId).toString();
3941
3943
  }
3942
3944
  if (connectDetails.connected) {
3945
+ var _connectDetails$sessi;
3943
3946
  if (!connectDetails.session) {
3944
3947
  throw new Error('impossible state, connect response is missing session');
3945
3948
  }
3946
3949
  this.session.setSession(connectDetails.session);
3950
+ if ((_connectDetails$sessi = connectDetails.session) != null && _connectDetails$sessi.accountAddress) {
3951
+ var _this$analytics2;
3952
+ (_this$analytics2 = this.analytics) == null || _this$analytics2.identify(connectDetails.session.accountAddress);
3953
+ }
3947
3954
  }
3948
3955
  return connectDetails;
3949
3956
  }
3950
3957
  disconnect() {
3958
+ var _this$analytics3;
3951
3959
  if (this.isOpened()) {
3952
3960
  this.closeWallet();
3953
3961
  }
3962
+ (_this$analytics3 = this.analytics) == null || _this$analytics3.reset();
3954
3963
  return this.session.clearSession();
3955
3964
  }
3956
3965
 
@@ -4030,9 +4039,9 @@ class SequenceClient {
4030
4039
  return method;
4031
4040
  }
4032
4041
  async signMessage(message, options) {
4033
- var _this$analytics;
4042
+ var _this$analytics4;
4034
4043
  const method = this.signMethod(options);
4035
- (_this$analytics = this.analytics) == null || _this$analytics.track({
4044
+ (_this$analytics4 = this.analytics) == null || _this$analytics4.track({
4036
4045
  event: 'SIGN_MESSAGE_REQUEST',
4037
4046
  props: {
4038
4047
  chainId: `${(options == null ? void 0 : options.chainId) || this.getChainId()}`
@@ -4046,7 +4055,7 @@ class SequenceClient {
4046
4055
  }, options == null ? void 0 : options.chainId);
4047
4056
  }
4048
4057
  async signTypedData(typedData, options) {
4049
- var _this$analytics2;
4058
+ var _this$analytics5;
4050
4059
  const method = this.signTypedDataMethod(options);
4051
4060
 
4052
4061
  // TODO: Stop using ethers for this, this is the only place where we use it
@@ -4058,7 +4067,7 @@ class SequenceClient {
4058
4067
  // - The one provided in the typedData.domain.chainId
4059
4068
  // - The default chainId
4060
4069
 
4061
- (_this$analytics2 = this.analytics) == null || _this$analytics2.track({
4070
+ (_this$analytics5 = this.analytics) == null || _this$analytics5.track({
4062
4071
  event: 'SIGN_TYPED_DATA_REQUEST',
4063
4072
  props: {
4064
4073
  chainId: `${(options == null ? void 0 : options.chainId) || this.getChainId()}`
@@ -4070,10 +4079,10 @@ class SequenceClient {
4070
4079
  }, (options == null ? void 0 : options.chainId) || typedData.domain.chainId && ethers.BigNumber.from(typedData.domain.chainId).toNumber() || this.getChainId());
4071
4080
  }
4072
4081
  async sendTransaction(tx, options) {
4073
- var _this$analytics3;
4082
+ var _this$analytics6;
4074
4083
  const sequenceTxs = Array.isArray(tx) ? tx : [tx];
4075
4084
  const extendedTxs = toExtended(sequenceTxs);
4076
- (_this$analytics3 = this.analytics) == null || _this$analytics3.track({
4085
+ (_this$analytics6 = this.analytics) == null || _this$analytics6.track({
4077
4086
  event: 'SEND_TRANSACTION_REQUEST',
4078
4087
  props: {
4079
4088
  chainId: `${(options == null ? void 0 : options.chainId) || this.getChainId()}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/provider",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
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",
@@ -12,15 +12,15 @@
12
12
  "@databeat/tracker": "^0.8.1",
13
13
  "eventemitter2": "^6.4.5",
14
14
  "webextension-polyfill": "^0.10.0",
15
- "@0xsequence/abi": "1.8.0",
16
- "@0xsequence/account": "1.8.0",
17
- "@0xsequence/auth": "1.8.0",
18
- "@0xsequence/core": "1.8.0",
19
- "@0xsequence/migration": "1.8.0",
20
- "@0xsequence/network": "1.8.0",
21
- "@0xsequence/relayer": "1.8.0",
22
- "@0xsequence/utils": "1.8.0",
23
- "@0xsequence/wallet": "1.8.0"
15
+ "@0xsequence/abi": "1.8.2",
16
+ "@0xsequence/account": "1.8.2",
17
+ "@0xsequence/auth": "1.8.2",
18
+ "@0xsequence/core": "1.8.2",
19
+ "@0xsequence/migration": "1.8.2",
20
+ "@0xsequence/network": "1.8.2",
21
+ "@0xsequence/relayer": "1.8.2",
22
+ "@0xsequence/utils": "1.8.2",
23
+ "@0xsequence/wallet": "1.8.2"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "ethers": ">=5.5 < 6"
package/src/client.ts CHANGED
@@ -212,8 +212,10 @@ export class SequenceClient {
212
212
  }
213
213
  if (this.projectAccessKey && options?.analytics) {
214
214
  this.analytics = setupAnalytics(this.projectAccessKey)
215
- } else {
216
- this.analytics = setupAnalytics('') // noop analytics
215
+ }
216
+
217
+ if (this.session.getSession()?.accountAddress) {
218
+ this.analytics?.identify(this.session.getSession()?.accountAddress)
217
219
  }
218
220
  }
219
221
 
@@ -357,6 +359,10 @@ export class SequenceClient {
357
359
  }
358
360
 
359
361
  this.session.setSession(connectDetails.session)
362
+
363
+ if (connectDetails.session?.accountAddress) {
364
+ this.analytics?.identify(connectDetails.session.accountAddress)
365
+ }
360
366
  }
361
367
 
362
368
  return connectDetails
@@ -367,6 +373,8 @@ export class SequenceClient {
367
373
  this.closeWallet()
368
374
  }
369
375
 
376
+ this.analytics?.reset()
377
+
370
378
  return this.session.clearSession()
371
379
  }
372
380