@dappworks/kit 0.5.9 → 0.5.11
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.
|
@@ -39599,21 +39599,20 @@ try {
|
|
|
39599
39599
|
|
|
39600
39600
|
// module/Wallet/ledger.tsx
|
|
39601
39601
|
var _transport = null;
|
|
39602
|
+
var _signer = null;
|
|
39602
39603
|
async function createTransport() {
|
|
39603
|
-
|
|
39604
|
-
|
|
39605
|
-
|
|
39606
|
-
|
|
39607
|
-
|
|
39608
|
-
|
|
39609
|
-
|
|
39610
|
-
|
|
39611
|
-
|
|
39612
|
-
|
|
39613
|
-
|
|
39614
|
-
|
|
39615
|
-
}
|
|
39616
|
-
});
|
|
39604
|
+
if (_transport) {
|
|
39605
|
+
return _transport;
|
|
39606
|
+
}
|
|
39607
|
+
try {
|
|
39608
|
+
const res = await TransportWebUSB_default.create();
|
|
39609
|
+
console.log("createTransport res", res);
|
|
39610
|
+
_transport = res;
|
|
39611
|
+
return res;
|
|
39612
|
+
} catch (error) {
|
|
39613
|
+
console.error("Error creating transport", error);
|
|
39614
|
+
throw error;
|
|
39615
|
+
}
|
|
39617
39616
|
}
|
|
39618
39617
|
function waiter(duration) {
|
|
39619
39618
|
return new Promise((resolve) => {
|
|
@@ -39623,22 +39622,40 @@ function waiter(duration) {
|
|
|
39623
39622
|
var GlobalLedgerProvider = ObjectPool.get("provider", async () => {
|
|
39624
39623
|
return new ethers_exports.providers.JsonRpcProvider("https://babel-api.mainnet.iotex.io");
|
|
39625
39624
|
});
|
|
39626
|
-
var GlobalLedgerSigner =
|
|
39627
|
-
|
|
39628
|
-
|
|
39629
|
-
|
|
39625
|
+
var GlobalLedgerSigner = async () => {
|
|
39626
|
+
var _a;
|
|
39627
|
+
try {
|
|
39628
|
+
if (_signer) {
|
|
39629
|
+
return _signer;
|
|
39630
|
+
}
|
|
39631
|
+
const transport = await createTransport();
|
|
39632
|
+
_signer = new LedgerSigner(transport, await GlobalLedgerProvider, "44'/304'/0'/0/0");
|
|
39633
|
+
return _signer;
|
|
39634
|
+
} catch (error) {
|
|
39635
|
+
console.error("Error creating ledger signer", error);
|
|
39636
|
+
RootStore.Get(ToastPlugin).error((_a = error.message) != null ? _a : "Failed to connect to Ledger");
|
|
39637
|
+
RootStore.Get(WalletStore).isLedger = false;
|
|
39638
|
+
return null;
|
|
39639
|
+
}
|
|
39640
|
+
};
|
|
39630
39641
|
var ConnectLedger = async () => {
|
|
39631
39642
|
RootStore.Get(WalletStore).isLedger = true;
|
|
39632
|
-
|
|
39643
|
+
console.log("ConnectLedger");
|
|
39644
|
+
const signer = await GlobalLedgerSigner();
|
|
39645
|
+
console.log("signer", signer);
|
|
39633
39646
|
const interval = setInterval(async () => {
|
|
39634
|
-
|
|
39635
|
-
|
|
39636
|
-
|
|
39637
|
-
|
|
39638
|
-
|
|
39639
|
-
|
|
39640
|
-
|
|
39641
|
-
|
|
39647
|
+
try {
|
|
39648
|
+
const address = await (signer == null ? void 0 : signer.getAddress());
|
|
39649
|
+
if (address) {
|
|
39650
|
+
RootStore.Get(WalletStore).set({
|
|
39651
|
+
account: address,
|
|
39652
|
+
isConnect: true
|
|
39653
|
+
});
|
|
39654
|
+
clearInterval(interval);
|
|
39655
|
+
return signer;
|
|
39656
|
+
}
|
|
39657
|
+
} catch (error) {
|
|
39658
|
+
console.error("Error getting address", error);
|
|
39642
39659
|
}
|
|
39643
39660
|
}, 1e3);
|
|
39644
39661
|
};
|
|
@@ -40076,7 +40093,7 @@ var WalletStore = class _WalletStore {
|
|
|
40076
40093
|
const historyStore = RootStore.Get(WalletHistoryStore);
|
|
40077
40094
|
let hash3;
|
|
40078
40095
|
if (this.isLedger) {
|
|
40079
|
-
const ledger = await GlobalLedgerSigner;
|
|
40096
|
+
const ledger = await GlobalLedgerSigner();
|
|
40080
40097
|
console.log(ledger, "ledger signer");
|
|
40081
40098
|
hash3 = await ledger.sendTransaction({
|
|
40082
40099
|
to: address,
|
|
@@ -40147,7 +40164,7 @@ var WalletStore = class _WalletStore {
|
|
|
40147
40164
|
}
|
|
40148
40165
|
async signMessage(message) {
|
|
40149
40166
|
if (this.isLedger) {
|
|
40150
|
-
const ledger = await GlobalLedgerSigner;
|
|
40167
|
+
const ledger = await GlobalLedgerSigner();
|
|
40151
40168
|
return ledger.signMessage(message);
|
|
40152
40169
|
}
|
|
40153
40170
|
return this.walletClient.signMessage(message);
|
|
@@ -40244,4 +40261,4 @@ js-sha3/src/sha3.js:
|
|
|
40244
40261
|
|
|
40245
40262
|
export { AppProvider, AutoMan, BigNumberInputState, BigNumberState, ConnectLedger, DisconnectLedger, ObjectPool, PromiseHook, StorageListState, StorageState, WalletConfigStore, WalletHistoryStore, WalletRpcStore, WalletStore };
|
|
40246
40263
|
//# sourceMappingURL=out.js.map
|
|
40247
|
-
//# sourceMappingURL=chunk-
|
|
40264
|
+
//# sourceMappingURL=chunk-VUM2RE4Z.mjs.map
|