@dappworks/kit 0.5.10 → 0.5.12
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.
|
@@ -18,6 +18,7 @@ import { iopayWallet, metaMaskWallet, walletConnectWallet, okxWallet, binanceWal
|
|
|
18
18
|
import SafeAppsSDK, { TransactionStatus } from '@safe-global/safe-apps-sdk';
|
|
19
19
|
import { Card, Input } from '@nextui-org/react';
|
|
20
20
|
import axios3 from 'axios';
|
|
21
|
+
import { iotex } from 'viem/chains';
|
|
21
22
|
|
|
22
23
|
// ../../node_modules/semver/internal/constants.js
|
|
23
24
|
var require_constants = __commonJS({
|
|
@@ -39596,24 +39597,21 @@ try {
|
|
|
39596
39597
|
}
|
|
39597
39598
|
} catch (error) {
|
|
39598
39599
|
}
|
|
39599
|
-
|
|
39600
|
-
// module/Wallet/ledger.tsx
|
|
39601
39600
|
var _transport = null;
|
|
39601
|
+
var _signer = null;
|
|
39602
39602
|
async function createTransport() {
|
|
39603
|
-
|
|
39604
|
-
|
|
39605
|
-
|
|
39606
|
-
|
|
39607
|
-
|
|
39608
|
-
|
|
39609
|
-
|
|
39610
|
-
|
|
39611
|
-
|
|
39612
|
-
|
|
39613
|
-
|
|
39614
|
-
|
|
39615
|
-
}
|
|
39616
|
-
});
|
|
39603
|
+
if (_transport) {
|
|
39604
|
+
return _transport;
|
|
39605
|
+
}
|
|
39606
|
+
try {
|
|
39607
|
+
const res = await TransportWebUSB_default.create();
|
|
39608
|
+
console.log("createTransport res", res);
|
|
39609
|
+
_transport = res;
|
|
39610
|
+
return res;
|
|
39611
|
+
} catch (error) {
|
|
39612
|
+
console.error("Error creating transport", error);
|
|
39613
|
+
throw error;
|
|
39614
|
+
}
|
|
39617
39615
|
}
|
|
39618
39616
|
function waiter(duration) {
|
|
39619
39617
|
return new Promise((resolve) => {
|
|
@@ -39623,31 +39621,41 @@ function waiter(duration) {
|
|
|
39623
39621
|
var GlobalLedgerProvider = ObjectPool.get("provider", async () => {
|
|
39624
39622
|
return new ethers_exports.providers.JsonRpcProvider("https://babel-api.mainnet.iotex.io");
|
|
39625
39623
|
});
|
|
39626
|
-
var GlobalLedgerSigner =
|
|
39624
|
+
var GlobalLedgerSigner = async () => {
|
|
39625
|
+
var _a;
|
|
39627
39626
|
try {
|
|
39627
|
+
if (_signer) {
|
|
39628
|
+
return _signer;
|
|
39629
|
+
}
|
|
39628
39630
|
const transport = await createTransport();
|
|
39629
|
-
|
|
39631
|
+
_signer = new LedgerSigner(transport, await GlobalLedgerProvider, "44'/304'/0'/0/0");
|
|
39632
|
+
return _signer;
|
|
39630
39633
|
} catch (error) {
|
|
39634
|
+
console.error("Error creating ledger signer", error);
|
|
39635
|
+
RootStore.Get(ToastPlugin).error((_a = error.message) != null ? _a : "Failed to connect to Ledger");
|
|
39636
|
+
RootStore.Get(WalletStore).isLedger = false;
|
|
39631
39637
|
return null;
|
|
39632
39638
|
}
|
|
39633
|
-
}
|
|
39639
|
+
};
|
|
39634
39640
|
var ConnectLedger = async () => {
|
|
39635
39641
|
RootStore.Get(WalletStore).isLedger = true;
|
|
39636
|
-
|
|
39637
|
-
|
|
39638
|
-
|
|
39639
|
-
RootStore.Get(WalletStore).isLedger = false;
|
|
39640
|
-
return null;
|
|
39641
|
-
}
|
|
39642
|
+
console.log("ConnectLedger");
|
|
39643
|
+
const signer = await GlobalLedgerSigner();
|
|
39644
|
+
console.log("signer", signer);
|
|
39642
39645
|
const interval = setInterval(async () => {
|
|
39643
|
-
|
|
39644
|
-
|
|
39645
|
-
|
|
39646
|
-
|
|
39647
|
-
|
|
39648
|
-
|
|
39649
|
-
|
|
39650
|
-
|
|
39646
|
+
try {
|
|
39647
|
+
const address = await (signer == null ? void 0 : signer.getAddress());
|
|
39648
|
+
if (address) {
|
|
39649
|
+
RootStore.Get(WalletStore).set({
|
|
39650
|
+
account: address,
|
|
39651
|
+
isConnect: true,
|
|
39652
|
+
chain: iotex
|
|
39653
|
+
});
|
|
39654
|
+
clearInterval(interval);
|
|
39655
|
+
return signer;
|
|
39656
|
+
}
|
|
39657
|
+
} catch (error) {
|
|
39658
|
+
console.error("Error getting address", error);
|
|
39651
39659
|
}
|
|
39652
39660
|
}, 1e3);
|
|
39653
39661
|
};
|
|
@@ -40085,7 +40093,7 @@ var WalletStore = class _WalletStore {
|
|
|
40085
40093
|
const historyStore = RootStore.Get(WalletHistoryStore);
|
|
40086
40094
|
let hash3;
|
|
40087
40095
|
if (this.isLedger) {
|
|
40088
|
-
const ledger = await GlobalLedgerSigner;
|
|
40096
|
+
const ledger = await GlobalLedgerSigner();
|
|
40089
40097
|
console.log(ledger, "ledger signer");
|
|
40090
40098
|
hash3 = await ledger.sendTransaction({
|
|
40091
40099
|
to: address,
|
|
@@ -40156,7 +40164,7 @@ var WalletStore = class _WalletStore {
|
|
|
40156
40164
|
}
|
|
40157
40165
|
async signMessage(message) {
|
|
40158
40166
|
if (this.isLedger) {
|
|
40159
|
-
const ledger = await GlobalLedgerSigner;
|
|
40167
|
+
const ledger = await GlobalLedgerSigner();
|
|
40160
40168
|
return ledger.signMessage(message);
|
|
40161
40169
|
}
|
|
40162
40170
|
return this.walletClient.signMessage(message);
|
|
@@ -40253,4 +40261,4 @@ js-sha3/src/sha3.js:
|
|
|
40253
40261
|
|
|
40254
40262
|
export { AppProvider, AutoMan, BigNumberInputState, BigNumberState, ConnectLedger, DisconnectLedger, ObjectPool, PromiseHook, StorageListState, StorageState, WalletConfigStore, WalletHistoryStore, WalletRpcStore, WalletStore };
|
|
40255
40263
|
//# sourceMappingURL=out.js.map
|
|
40256
|
-
//# sourceMappingURL=chunk-
|
|
40264
|
+
//# sourceMappingURL=chunk-FDTQI73L.mjs.map
|