@reef-knot/ledger-connector 4.1.1 → 4.1.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../src/iframe/connector.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAIrC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,eAAO,MAAM,YAAY,eAAe,CAAC;AACzC,eAAO,MAAM,IAAI,gBAAgB,CAAC;AAElC,KAAK,uBAAuB,GAAG;IAC7B,OAAO,CAAC,EAAE,6BAA6B,CAAC;IACxC,YAAY,EAAE,KAAK,CAAC;CACrB,CAAC;AAGF,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,YAAY,GACb,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../src/iframe/connector.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAIrC,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,eAAO,MAAM,YAAY,eAAe,CAAC;AACzC,eAAO,MAAM,IAAI,gBAAgB,CAAC;AAElC,KAAK,uBAAuB,GAAG;IAC7B,OAAO,CAAC,EAAE,6BAA6B,CAAC;IACxC,YAAY,EAAE,KAAK,CAAC;CACrB,CAAC;AAGF,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,YAAY,GACb,EAAE,uBAAuB,6GA0IzB;yBA7Ie,mBAAmB"}
|
package/dist/iframe/connector.js
CHANGED
|
@@ -41,6 +41,7 @@ function ledgerLiveConnector({
|
|
|
41
41
|
} = {}) {
|
|
42
42
|
try {
|
|
43
43
|
const provider = yield this.getProvider();
|
|
44
|
+
// works without bind because it's an obj created(scoped) in a function
|
|
44
45
|
provider.on('accountsChanged', this.onAccountsChanged);
|
|
45
46
|
provider.on('chainChanged', this.onChainChanged);
|
|
46
47
|
emitter.emit('message', {
|
|
@@ -144,16 +145,17 @@ function ledgerLiveConnector({
|
|
|
144
145
|
}
|
|
145
146
|
});
|
|
146
147
|
},
|
|
147
|
-
|
|
148
|
+
onAccountsChanged(accounts) {
|
|
148
149
|
if (accounts.length === 0 || !accounts[0]) {
|
|
149
150
|
emitter.emit('disconnect');
|
|
151
|
+
this.disconnect();
|
|
150
152
|
} else {
|
|
151
153
|
emitter.emit('change', {
|
|
152
154
|
accounts
|
|
153
155
|
});
|
|
154
156
|
}
|
|
155
157
|
},
|
|
156
|
-
|
|
158
|
+
onChainChanged(chainId) {
|
|
157
159
|
emitter.emit('change', {
|
|
158
160
|
chainId: Number(chainId)
|
|
159
161
|
});
|
|
@@ -167,12 +169,6 @@ function ledgerLiveConnector({
|
|
|
167
169
|
},
|
|
168
170
|
onDisconnect() {
|
|
169
171
|
emitter.emit('disconnect');
|
|
170
|
-
},
|
|
171
|
-
onAccountsChanged() {
|
|
172
|
-
// NOOP
|
|
173
|
-
},
|
|
174
|
-
onChainChanged() {
|
|
175
|
-
// NOOP
|
|
176
172
|
}
|
|
177
173
|
}));
|
|
178
174
|
}
|