@injectivelabs/wallet-turnkey 1.16.38-alpha.2 → 1.16.38-alpha.4
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.
- package/dist/cjs/index.cjs +13 -5
- package/dist/cjs/index.d.cts +6 -1
- package/dist/esm/index.d.ts +6 -1
- package/dist/esm/index.js +9 -1
- package/package.json +9 -9
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
let viem = require("viem");
|
|
2
|
-
let __injectivelabs_sdk_ts = require("@injectivelabs/sdk-ts");
|
|
3
2
|
let __injectivelabs_utils = require("@injectivelabs/utils");
|
|
3
|
+
let __injectivelabs_sdk_ts_core_tx = require("@injectivelabs/sdk-ts/core/tx");
|
|
4
|
+
let __injectivelabs_sdk_ts_utils = require("@injectivelabs/sdk-ts/utils");
|
|
4
5
|
let __injectivelabs_exceptions = require("@injectivelabs/exceptions");
|
|
5
6
|
let __injectivelabs_wallet_base = require("@injectivelabs/wallet-base");
|
|
6
7
|
let __turnkey_viem = require("@turnkey/viem");
|
|
@@ -79,7 +80,7 @@ var TurnkeyOauthWallet = class {
|
|
|
79
80
|
await indexedDbClient.resetKeyPair();
|
|
80
81
|
const targetPublicKey = await indexedDbClient.getPublicKey();
|
|
81
82
|
if (!targetPublicKey) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("Target public key not found"));
|
|
82
|
-
return Array.from((0,
|
|
83
|
+
return Array.from((0, __injectivelabs_sdk_ts_utils.sha256)(new TextEncoder().encode(targetPublicKey))).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
83
84
|
} catch (e) {
|
|
84
85
|
throw new __injectivelabs_exceptions.WalletException(new Error(e.message), {
|
|
85
86
|
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
@@ -233,7 +234,7 @@ var TurnkeyWallet = class {
|
|
|
233
234
|
})))).filter((account) => account.status === "fulfilled").flatMap((result) => {
|
|
234
235
|
var _result$value;
|
|
235
236
|
return (_result$value = result.value) === null || _result$value === void 0 ? void 0 : _result$value.accounts;
|
|
236
|
-
}).filter((wa) => !!wa && wa.addressFormat === "ADDRESS_FORMAT_ETHEREUM" && !!wa.address).map((account) => (0,
|
|
237
|
+
}).filter((wa) => !!wa && wa.addressFormat === "ADDRESS_FORMAT_ETHEREUM" && !!wa.address).map((account) => (0, __injectivelabs_sdk_ts_utils.getInjectiveAddress)(account.address));
|
|
237
238
|
} catch (e) {
|
|
238
239
|
if (e.code === TurnkeyErrorCodes.UserLoggedOut) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("User is not logged in"), {
|
|
239
240
|
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
@@ -530,6 +531,13 @@ var TurnkeyWalletStrategy = class extends __injectivelabs_wallet_base.BaseConcre
|
|
|
530
531
|
});
|
|
531
532
|
}
|
|
532
533
|
}
|
|
534
|
+
async getAddressesInfo() {
|
|
535
|
+
throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("getAddressesInfo is not implemented"), {
|
|
536
|
+
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
537
|
+
type: __injectivelabs_exceptions.ErrorType.WalletError,
|
|
538
|
+
contextModule: __injectivelabs_wallet_base.WalletAction.GetAccounts
|
|
539
|
+
});
|
|
540
|
+
}
|
|
533
541
|
async getSessionOrConfirm(_address) {
|
|
534
542
|
return await (await this.getTurnkeyWallet()).refreshSession();
|
|
535
543
|
}
|
|
@@ -581,7 +589,7 @@ var TurnkeyWalletStrategy = class extends __injectivelabs_wallet_base.BaseConcre
|
|
|
581
589
|
async sendTransaction(transaction, options) {
|
|
582
590
|
const { endpoints, txTimeout } = options;
|
|
583
591
|
if (!endpoints) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("You have to pass endpoints.grpc within the options for using Turnkey wallet"));
|
|
584
|
-
const response = await new
|
|
592
|
+
const response = await new __injectivelabs_sdk_ts_core_tx.TxGrpcApi(endpoints.grpc).broadcast(transaction, { txTimeout });
|
|
585
593
|
if (response.code !== 0) throw new __injectivelabs_exceptions.TransactionException(new Error(response.rawLog), {
|
|
586
594
|
code: __injectivelabs_exceptions.UnspecifiedErrorCode,
|
|
587
595
|
contextCode: response.code,
|
|
@@ -671,7 +679,7 @@ var TurnkeyWalletStrategy = class extends __injectivelabs_wallet_base.BaseConcre
|
|
|
671
679
|
}
|
|
672
680
|
async getEip1193Provider() {
|
|
673
681
|
const turnkeyWallet = await this.getTurnkeyWallet();
|
|
674
|
-
const checksumAddress = (0, viem.getAddress)((0,
|
|
682
|
+
const checksumAddress = (0, viem.getAddress)((0, __injectivelabs_sdk_ts_utils.getEthereumAddress)((await turnkeyWallet.getAccounts())[0]));
|
|
675
683
|
return await getEip1193ProviderForTurnkey(await turnkeyWallet.getOrCreateAndGetAccount(checksumAddress), String(this.evmOptions.evmChainId));
|
|
676
684
|
}
|
|
677
685
|
};
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { BaseConcreteStrategy, ConcreteEvmWalletStrategyArgs, ConcreteWalletStra
|
|
|
3
3
|
import { AccountAddress, EvmChainId } from "@injectivelabs/ts-types";
|
|
4
4
|
import * as _turnkey_sdk_browser0 from "@turnkey/sdk-browser";
|
|
5
5
|
import { Turnkey, TurnkeyIndexedDbClient } from "@turnkey/sdk-browser";
|
|
6
|
-
import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts";
|
|
6
|
+
import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts/types";
|
|
7
7
|
import { createAccount } from "@turnkey/viem";
|
|
8
8
|
|
|
9
9
|
//#region src/strategy/strategy.d.ts
|
|
@@ -21,6 +21,11 @@ declare class TurnkeyWalletStrategy extends BaseConcreteStrategy implements Conc
|
|
|
21
21
|
enable(): Promise<boolean>;
|
|
22
22
|
disconnect(): Promise<void>;
|
|
23
23
|
getAddresses(): Promise<string[]>;
|
|
24
|
+
getAddressesInfo(): Promise<{
|
|
25
|
+
address: string;
|
|
26
|
+
derivationPath: string;
|
|
27
|
+
baseDerivationPath: string;
|
|
28
|
+
}[]>;
|
|
24
29
|
getSessionOrConfirm(_address?: string): Promise<string>;
|
|
25
30
|
getWalletClient<TurnkeyWallet$1>(): Promise<TurnkeyWallet$1>;
|
|
26
31
|
sendEvmTransaction(transaction: unknown, args: {
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts";
|
|
2
1
|
import { HttpRestClient } from "@injectivelabs/utils";
|
|
3
2
|
import { BaseConcreteStrategy, ConcreteEvmWalletStrategyArgs, ConcreteWalletStrategy, Eip1193Provider, SendTransactionOptions, StdSignDoc, TurnkeyMetadata, TurnkeyProvider, WalletDeviceType, WalletMetadata, WalletStrategyEvmOptions } from "@injectivelabs/wallet-base";
|
|
4
3
|
import { createAccount } from "@turnkey/viem";
|
|
5
4
|
import * as _turnkey_sdk_browser0 from "@turnkey/sdk-browser";
|
|
6
5
|
import { Turnkey, TurnkeyIndexedDbClient } from "@turnkey/sdk-browser";
|
|
7
6
|
import { AccountAddress, EvmChainId } from "@injectivelabs/ts-types";
|
|
7
|
+
import { AminoSignResponse, DirectSignResponse, TxRaw } from "@injectivelabs/sdk-ts/types";
|
|
8
8
|
|
|
9
9
|
//#region src/strategy/strategy.d.ts
|
|
10
10
|
declare class TurnkeyWalletStrategy extends BaseConcreteStrategy implements ConcreteWalletStrategy {
|
|
@@ -21,6 +21,11 @@ declare class TurnkeyWalletStrategy extends BaseConcreteStrategy implements Conc
|
|
|
21
21
|
enable(): Promise<boolean>;
|
|
22
22
|
disconnect(): Promise<void>;
|
|
23
23
|
getAddresses(): Promise<string[]>;
|
|
24
|
+
getAddressesInfo(): Promise<{
|
|
25
|
+
address: string;
|
|
26
|
+
derivationPath: string;
|
|
27
|
+
baseDerivationPath: string;
|
|
28
|
+
}[]>;
|
|
24
29
|
getSessionOrConfirm(_address?: string): Promise<string>;
|
|
25
30
|
getWalletClient<TurnkeyWallet$1>(): Promise<TurnkeyWallet$1>;
|
|
26
31
|
sendEvmTransaction(transaction: unknown, args: {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getAddress } from "viem";
|
|
2
|
-
import { TxGrpcApi, getEthereumAddress, getInjectiveAddress, sha256 } from "@injectivelabs/sdk-ts";
|
|
3
2
|
import { HttpRestClient } from "@injectivelabs/utils";
|
|
3
|
+
import { TxGrpcApi } from "@injectivelabs/sdk-ts/core/tx";
|
|
4
|
+
import { getEthereumAddress, getInjectiveAddress, sha256 } from "@injectivelabs/sdk-ts/utils";
|
|
4
5
|
import { CosmosWalletException, ErrorType, GeneralException, TransactionException, TurnkeyWalletSessionException, UnspecifiedErrorCode, WalletException } from "@injectivelabs/exceptions";
|
|
5
6
|
import { BaseConcreteStrategy, TurnkeyProvider, WalletAction, WalletDeviceType, getEvmChainConfig, getViemPublicClient, getViemWalletClient } from "@injectivelabs/wallet-base";
|
|
6
7
|
import { createAccount } from "@turnkey/viem";
|
|
@@ -530,6 +531,13 @@ var TurnkeyWalletStrategy = class extends BaseConcreteStrategy {
|
|
|
530
531
|
});
|
|
531
532
|
}
|
|
532
533
|
}
|
|
534
|
+
async getAddressesInfo() {
|
|
535
|
+
throw new WalletException(/* @__PURE__ */ new Error("getAddressesInfo is not implemented"), {
|
|
536
|
+
code: UnspecifiedErrorCode,
|
|
537
|
+
type: ErrorType.WalletError,
|
|
538
|
+
contextModule: WalletAction.GetAccounts
|
|
539
|
+
});
|
|
540
|
+
}
|
|
533
541
|
async getSessionOrConfirm(_address) {
|
|
534
542
|
return await (await this.getTurnkeyWallet()).refreshSession();
|
|
535
543
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-turnkey",
|
|
3
|
-
"version": "1.16.38-alpha.
|
|
3
|
+
"version": "1.16.38-alpha.4",
|
|
4
4
|
"description": "Turnkey wallet strategy for use with @injectivelabs/wallet-core.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"dist"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@turnkey/sdk-browser": "5.
|
|
42
|
-
"@turnkey/viem": "^0.
|
|
43
|
-
"viem": "^2.
|
|
44
|
-
"@injectivelabs/exceptions": "1.16.38-alpha.
|
|
45
|
-
"@injectivelabs/sdk-ts": "1.16.38-alpha.
|
|
46
|
-
"@injectivelabs/
|
|
47
|
-
"@injectivelabs/
|
|
48
|
-
"@injectivelabs/
|
|
41
|
+
"@turnkey/sdk-browser": "^5.13.4",
|
|
42
|
+
"@turnkey/viem": "^0.14.16",
|
|
43
|
+
"viem": "^2.41.2",
|
|
44
|
+
"@injectivelabs/exceptions": "1.16.38-alpha.3",
|
|
45
|
+
"@injectivelabs/sdk-ts": "1.16.38-alpha.4",
|
|
46
|
+
"@injectivelabs/wallet-base": "1.16.38-alpha.4",
|
|
47
|
+
"@injectivelabs/ts-types": "1.16.38-alpha.2",
|
|
48
|
+
"@injectivelabs/utils": "1.16.38-alpha.3"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|