@reef-knot/ledger-connector 4.1.4 → 4.2.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.
@@ -1 +1 @@
1
- {"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../src/hid/connector.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,eAAO,MAAM,WAAW,cAAc,CAAC;AACvC,eAAO,MAAM,IAAI,WAAW,CAAC;AAG7B,wBAAgB,kBAAkB,CAAC,EACjC,GAAG,EACH,YAAY,GACb,EAAE;IACD,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,YAAY,EAAE,KAAK,CAAC;CACrB,yGAuFA;yBA7Fe,kBAAkB"}
1
+ {"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../src/hid/connector.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,eAAO,MAAM,WAAW,cAAc,CAAC;AACvC,eAAO,MAAM,IAAI,WAAW,CAAC;AAG7B,wBAAgB,kBAAkB,CAAC,EACjC,GAAG,EACH,YAAY,GACb,EAAE;IACD,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,YAAY,EAAE,KAAK,CAAC;CACrB,yGAwGA;yBA9Ge,kBAAkB"}
@@ -90,6 +90,35 @@ function ledgerHIDConnector({
90
90
  }
91
91
  });
92
92
  },
93
+ switchChain(_a) {
94
+ return __awaiter(this, arguments, void 0, function* ({
95
+ chainId
96
+ }) {
97
+ var _b;
98
+ const id = chainId.toString(16);
99
+ emitter.emit('change', {
100
+ chainId: Number(chainId)
101
+ });
102
+ return Promise.resolve((_b = chains.find(x => x.id === chainId)) !== null && _b !== void 0 ? _b : {
103
+ id: chainId,
104
+ name: `Chain ${id}`,
105
+ network: `${id}`,
106
+ nativeCurrency: {
107
+ decimals: 18,
108
+ name: 'Ether',
109
+ symbol: 'ETH'
110
+ },
111
+ rpcUrls: {
112
+ default: {
113
+ http: ['']
114
+ },
115
+ public: {
116
+ http: ['']
117
+ }
118
+ }
119
+ });
120
+ });
121
+ },
93
122
  onDisconnect() {
94
123
  // Is called when HID API emits 'disconnect' event for some reason.
95
124
  // For example, the device was manually unplugged.
@@ -98,9 +127,11 @@ function ledgerHIDConnector({
98
127
  },
99
128
  onAccountsChanged() {
100
129
  // NOOP
130
+ // HID Ledger cannot change account by itself
101
131
  },
102
132
  onChainChanged() {
103
133
  // NOOP
134
+ // HID Ledger cannot change chain by itself
104
135
  }
105
136
  }));
106
137
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reef-knot/ledger-connector",
3
- "version": "4.1.4",
3
+ "version": "4.2.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {