@kheopskit/core 5.2.1 → 6.0.0-rc.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.
- package/CHANGELOG.md +426 -0
- package/MIGRATING_TO_V6.md +837 -0
- package/README.md +628 -11
- package/dist/ethereum.d.mts +12 -6
- package/dist/ethereum.d.ts +12 -6
- package/dist/ethereum.js +13 -10
- package/dist/ethereum.js.map +1 -1
- package/dist/ethereum.mjs +7 -4
- package/dist/ethereum.mjs.map +1 -1
- package/dist/{iconCache-pP2ES4pJ.mjs → iconCache-C-U3IEbP.mjs} +21 -40
- package/dist/iconCache-C-U3IEbP.mjs.map +1 -0
- package/dist/{iconCache-DUtkJlaX.js → iconCache-FR4iy6go.js} +21 -40
- package/dist/iconCache-FR4iy6go.js.map +1 -0
- package/dist/index.d.mts +17 -63
- package/dist/index.d.ts +17 -63
- package/dist/index.js +387 -373
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +384 -369
- package/dist/index.mjs.map +1 -1
- package/dist/injectedWallets-48L-AL1I.mjs +173 -0
- package/dist/injectedWallets-48L-AL1I.mjs.map +1 -0
- package/dist/injectedWallets-Dy8YGKL-.js +178 -0
- package/dist/injectedWallets-Dy8YGKL-.js.map +1 -0
- package/dist/internal.d.mts +3 -27
- package/dist/internal.d.ts +3 -27
- package/dist/internal.js +2 -2
- package/dist/internal.mjs +2 -2
- package/dist/pageLoad-BZ7o8p5R.mjs +24 -0
- package/dist/pageLoad-BZ7o8p5R.mjs.map +1 -0
- package/dist/pageLoad-D1wLeuFG.js +28 -0
- package/dist/pageLoad-D1wLeuFG.js.map +1 -0
- package/dist/platformAccounts-BjIeRcFN.js +321 -0
- package/dist/platformAccounts-BjIeRcFN.js.map +1 -0
- package/dist/platformAccounts-yyRUrnel.mjs +256 -0
- package/dist/platformAccounts-yyRUrnel.mjs.map +1 -0
- package/dist/polkadot.d.mts +127 -11
- package/dist/polkadot.d.ts +127 -11
- package/dist/polkadot.js +171 -107
- package/dist/polkadot.js.map +1 -1
- package/dist/polkadot.mjs +164 -100
- package/dist/polkadot.mjs.map +1 -1
- package/dist/solana.d.mts +11 -5
- package/dist/solana.d.ts +11 -5
- package/dist/solana.js +18 -15
- package/dist/solana.js.map +1 -1
- package/dist/solana.mjs +7 -4
- package/dist/solana.mjs.map +1 -1
- package/dist/storage-D3AwNgqc.d.mts +27 -0
- package/dist/storage-D3AwNgqc.d.ts +27 -0
- package/dist/testing.d.mts +71 -0
- package/dist/testing.d.ts +71 -0
- package/dist/testing.js +136 -0
- package/dist/testing.js.map +1 -0
- package/dist/testing.mjs +131 -0
- package/dist/testing.mjs.map +1 -0
- package/dist/{types-DKU-SNio.js → types-BWHvNFlN.js} +149 -2
- package/dist/types-BWHvNFlN.js.map +1 -0
- package/dist/types-Dkyt9bf4.d.mts +683 -0
- package/dist/types-Dkyt9bf4.d.ts +683 -0
- package/dist/types-Yor672md.mjs +215 -0
- package/dist/types-Yor672md.mjs.map +1 -0
- package/dist/walletconnect.d.mts +41 -0
- package/dist/walletconnect.d.ts +41 -0
- package/dist/walletconnect.js +219 -0
- package/dist/walletconnect.js.map +1 -0
- package/dist/walletconnect.mjs +216 -0
- package/dist/walletconnect.mjs.map +1 -0
- package/package.json +33 -9
- package/dist/errors-BLFP1dQI.mjs +0 -181
- package/dist/errors-BLFP1dQI.mjs.map +0 -1
- package/dist/errors-DYWVPHrR.js +0 -222
- package/dist/errors-DYWVPHrR.js.map +0 -1
- package/dist/iconCache-DUtkJlaX.js.map +0 -1
- package/dist/iconCache-pP2ES4pJ.mjs.map +0 -1
- package/dist/injectedWallets-BqR-_aAy.js +0 -148
- package/dist/injectedWallets-BqR-_aAy.js.map +0 -1
- package/dist/injectedWallets-Uz4hPuoW.mjs +0 -119
- package/dist/injectedWallets-Uz4hPuoW.mjs.map +0 -1
- package/dist/types-Cb-vuEru.d.mts +0 -330
- package/dist/types-Cb-vuEru.d.ts +0 -330
- package/dist/types-DKU-SNio.js.map +0 -1
- package/dist/types-jnifAAA0.mjs +0 -104
- package/dist/types-jnifAAA0.mjs.map +0 -1
package/dist/polkadot.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { E as isWalletConnectWallet, N as WalletAccountId, T as isInjectedWallet, b as WalletConnectWallet, g as PolkadotAccountType, k as WalletId, l as KheopskitPlatform, m as PlaceholderWallet, p as Placeholder, r as BaseWallet } from "./types-Dkyt9bf4.mjs";
|
|
2
|
+
import { InjectedPolkadotAccount, SignPayload } from "polkadot-api/pjs-signer";
|
|
3
3
|
//#region src/utils/isSs58Address.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Returns true if `address` is a valid SS58-encoded 32-byte account id (the
|
|
@@ -11,9 +11,63 @@ import { InjectedExtension, InjectedPolkadotAccount } from "polkadot-api/pjs-sig
|
|
|
11
11
|
export declare const isSs58Address: (address: string) => boolean;
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/api/polkadot/types.d.ts
|
|
14
|
-
type
|
|
14
|
+
type PolkadotSignRawType = "bytes" | "payload";
|
|
15
|
+
/** An account as the extension lists it through `accounts.get()` and `accounts.subscribe()`. */
|
|
16
|
+
type PolkadotInjectedAccount = {
|
|
17
|
+
address: string;
|
|
18
|
+
genesisHash?: string | null;
|
|
19
|
+
name?: string;
|
|
20
|
+
type?: PolkadotAccountType;
|
|
21
|
+
/**
|
|
22
|
+
* Talisman adds this for its own dapp origins only: `true` for a watch-only
|
|
23
|
+
* account, which cannot sign. Absent for other origins and other wallets.
|
|
24
|
+
*/
|
|
25
|
+
readonly?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Talisman adds this for its own dapp origins only: `true` for a watch-only
|
|
28
|
+
* account that is part of the user's portfolio. Absent for other origins
|
|
29
|
+
* and other wallets.
|
|
30
|
+
*/
|
|
31
|
+
partOfPortfolio?: boolean;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The object `window.injectedWeb3[id].enable(appName)` resolved to, typed
|
|
35
|
+
* structurally (pjs-signer does not export its type). `metadata` and
|
|
36
|
+
* `provider` are the optional members of `@polkadot/extension-inject`'s
|
|
37
|
+
* `Injected`, left untyped here.
|
|
38
|
+
*/
|
|
39
|
+
type PolkadotInjected = {
|
|
40
|
+
accounts: {
|
|
41
|
+
get(): Promise<PolkadotInjectedAccount[]>;
|
|
42
|
+
subscribe(cb: (accounts: PolkadotInjectedAccount[]) => void): () => void;
|
|
43
|
+
};
|
|
44
|
+
signer: {
|
|
45
|
+
signPayload: SignPayload;
|
|
46
|
+
/**
|
|
47
|
+
* The extension's raw signing call, as the dapp sends it. Prefer
|
|
48
|
+
* {@link PolkadotAccount.signRaw}, which encodes `data` and documents
|
|
49
|
+
* what each wallet does with `type`.
|
|
50
|
+
*/
|
|
51
|
+
signRaw: (payload: {
|
|
52
|
+
address: string;
|
|
53
|
+
data: string;
|
|
54
|
+
type: PolkadotSignRawType;
|
|
55
|
+
}) => Promise<{
|
|
56
|
+
id: number;
|
|
57
|
+
signature: `0x${string}`;
|
|
58
|
+
}>;
|
|
59
|
+
};
|
|
60
|
+
metadata?: unknown;
|
|
61
|
+
provider?: unknown;
|
|
62
|
+
};
|
|
63
|
+
type LivePolkadotInjectedWallet = {
|
|
64
|
+
/** See {@link BaseWallet.isPlaceholder}. */
|
|
65
|
+
isPlaceholder?: false;
|
|
66
|
+
/** `polkadot:<extension id>`, e.g. `polkadot:talisman`. */
|
|
15
67
|
id: WalletId;
|
|
68
|
+
/** Always `"polkadot"`. */
|
|
16
69
|
platform: "polkadot";
|
|
70
|
+
/** Always `"injected"`. */
|
|
17
71
|
type: "injected";
|
|
18
72
|
/**
|
|
19
73
|
* Stable identifier of the underlying wallet source. For Polkadot this is the
|
|
@@ -21,32 +75,94 @@ type PolkadotInjectedWallet = {
|
|
|
21
75
|
* (Ethereum: EIP-6963 rdns; Solana: Wallet Standard name).
|
|
22
76
|
*/
|
|
23
77
|
sourceId: string;
|
|
24
|
-
|
|
78
|
+
/**
|
|
79
|
+
* The raw object `enable(appName)` returned. Use it for extension calls
|
|
80
|
+
* kheopskit does not wrap. `undefined` until `status` is `"connected"`,
|
|
81
|
+
* so also while connecting; a placeholder has none.
|
|
82
|
+
*/
|
|
83
|
+
extension: PolkadotInjected | undefined;
|
|
84
|
+
/** The extension's display name, e.g. `Talisman`; the extension id for an unknown extension. */
|
|
25
85
|
name: string;
|
|
86
|
+
/** The extension's logo as a data URI; `""` for an unknown extension. */
|
|
26
87
|
icon: string;
|
|
88
|
+
/** See {@link BaseWallet.status}. */
|
|
89
|
+
status: BaseWallet["status"];
|
|
90
|
+
/** See {@link BaseWallet.error}. */
|
|
91
|
+
error?: BaseWallet["error"];
|
|
92
|
+
/** `status === "connected"`. */
|
|
27
93
|
isConnected: boolean;
|
|
28
|
-
connect
|
|
29
|
-
|
|
94
|
+
/** See {@link BaseWallet.connect}. Calls `enable(appName)`, then `accounts.get()`. */
|
|
95
|
+
connect: BaseWallet["connect"];
|
|
96
|
+
/** See {@link BaseWallet.disconnect}. Polkadot extensions have no disconnect call; kheopskit drops the handle. */
|
|
97
|
+
disconnect: BaseWallet["disconnect"];
|
|
30
98
|
};
|
|
99
|
+
type PolkadotInjectedWallet = LivePolkadotInjectedWallet | PlaceholderWallet<LivePolkadotInjectedWallet, "sourceId" | "extension">;
|
|
31
100
|
type PolkadotWallet = PolkadotInjectedWallet;
|
|
32
101
|
/**
|
|
33
102
|
* A Polkadot account. Inherits the fields of polkadot-api's
|
|
34
103
|
* `InjectedPolkadotAccount` and narrows `type` to {@link PolkadotAccountType}.
|
|
104
|
+
* The inherited fields are `address` (SS58, or 0x-hex for an `ethereum`
|
|
105
|
+
* account, as the extension lists it), `name` (the account name in the
|
|
106
|
+
* extension, when it has one) and `genesisHash` (the chain the account is
|
|
107
|
+
* restricted to, `null` or absent when it is not). A WalletConnect account has
|
|
108
|
+
* `name` `<wallet name> Polkadot` and `genesisHash` `null`.
|
|
35
109
|
*
|
|
36
110
|
* The signing surface follows the installed polkadot-api version:
|
|
37
111
|
* **`txCreator`** (a `TxCreator`) on v3+, **`polkadotSigner`** (a
|
|
38
|
-
* `PolkadotSigner`) on v2.
|
|
112
|
+
* `PolkadotSigner`) on v2. For `ethereum` accounts the signer is built with the
|
|
113
|
+
* `ecdsa` signature type, so on v3 and later fee estimation and dry runs use a
|
|
114
|
+
* 65-byte mock signature. v2's `getPolkadotSignerFromPjs` ignores that type.
|
|
39
115
|
*
|
|
40
116
|
* Per-platform signing surfaces differ: Ethereum exposes `client` (viem),
|
|
41
|
-
* Solana `signer`/`getSigner(chain)`. The Polkadot signing surface
|
|
42
|
-
*
|
|
117
|
+
* Solana `signer`/`getSigner(chain)`. The Polkadot signing surface, `signRaw`
|
|
118
|
+
* included, is absent on a placeholder.
|
|
43
119
|
*/
|
|
44
|
-
type PolkadotAccount =
|
|
120
|
+
type PolkadotAccount = LivePolkadotAccount | Placeholder<LivePolkadotAccount, PolkadotSigningKey>;
|
|
121
|
+
type PolkadotSigningKey = Exclude<keyof InjectedPolkadotAccount, "address" | "genesisHash" | "name" | "type"> | "signRaw";
|
|
122
|
+
type LivePolkadotAccount = Omit<InjectedPolkadotAccount, "type"> & {
|
|
123
|
+
/** See {@link BaseWalletAccount.isPlaceholder}. */
|
|
124
|
+
isPlaceholder?: false;
|
|
125
|
+
/**
|
|
126
|
+
* Key type the extension reported, `sr25519` when it reported none. Always
|
|
127
|
+
* `sr25519` for a WalletConnect account, which reports no key type.
|
|
128
|
+
*/
|
|
45
129
|
type: PolkadotAccountType;
|
|
130
|
+
/** `<walletId>::<address>`. */
|
|
46
131
|
id: WalletAccountId;
|
|
132
|
+
/** Always `"polkadot"`. */
|
|
47
133
|
platform: "polkadot";
|
|
134
|
+
/** `name` of the wallet that lists the account. */
|
|
48
135
|
walletName: string;
|
|
136
|
+
/** `id` of the wallet that lists the account. */
|
|
49
137
|
walletId: WalletId;
|
|
138
|
+
/** See {@link PolkadotInjectedAccount.readonly}. */
|
|
139
|
+
readonly?: boolean;
|
|
140
|
+
/** See {@link PolkadotInjectedAccount.partOfPortfolio}. */
|
|
141
|
+
partOfPortfolio?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Signs arbitrary data with the wallet's raw signing call (`signer.signRaw`
|
|
144
|
+
* for an extension, `polkadot_signMessage` over WalletConnect) and resolves
|
|
145
|
+
* the signature as hex.
|
|
146
|
+
*
|
|
147
|
+
* A string is sent as text with `type: "payload"` and a `Uint8Array` as
|
|
148
|
+
* `0x` hex with `type: "bytes"`. An explicit `options.type` is sent as given
|
|
149
|
+
* for either input. A hex-looking string is sent as text; pass a
|
|
150
|
+
* `Uint8Array` for bytes, because Talisman, polkadot.js, SubWallet and Nova
|
|
151
|
+
* decode a `0x`-shaped string as bytes (Talisman observed live, the others
|
|
152
|
+
* read from their sources).
|
|
153
|
+
*
|
|
154
|
+
* Pass a string for a Sign-In With Substrate message. Talisman 3.11.0 opens
|
|
155
|
+
* its Sign In screen when the text parses as SIWS (the `Version` line must
|
|
156
|
+
* read `1.0.0`) and its generic Sign Request screen for anything else, hex
|
|
157
|
+
* included; the screen follows the text `data`, not `type` (observed live
|
|
158
|
+
* with both values). From their sources: Talisman, polkadot.js, SubWallet
|
|
159
|
+
* and Nova ignore `type`; Enkrypt reads it as the encoding of `data`,
|
|
160
|
+
* `"payload"` for UTF-8 text and `"bytes"` for hex, so it needs the value
|
|
161
|
+
* the derived default sends. WalletConnect has no such field.
|
|
162
|
+
*/
|
|
163
|
+
signRaw: (data: string | Uint8Array, options?: {
|
|
164
|
+
type?: PolkadotSignRawType;
|
|
165
|
+
}) => Promise<`0x${string}`>;
|
|
50
166
|
};
|
|
51
167
|
//#endregion
|
|
52
168
|
//#region src/api/polkadot/plugin.d.ts
|
|
@@ -70,5 +186,5 @@ type PolkadotPluginOptions = {
|
|
|
70
186
|
*/
|
|
71
187
|
export declare const polkadot: (options?: PolkadotPluginOptions) => KheopskitPlatform<"polkadot", PolkadotWallet, PolkadotAccount>;
|
|
72
188
|
//#endregion
|
|
73
|
-
export { type PolkadotAccount, type PolkadotAccountType, type PolkadotInjectedWallet, type PolkadotPluginOptions, type PolkadotWallet, type WalletConnectWallet, isInjectedWallet, isWalletConnectWallet };
|
|
189
|
+
export { type PolkadotAccount, type PolkadotAccountType, type PolkadotInjected, type PolkadotInjectedAccount, type PolkadotInjectedWallet, type PolkadotPluginOptions, type PolkadotSignRawType, type PolkadotWallet, type WalletConnectWallet, isInjectedWallet, isWalletConnectWallet };
|
|
74
190
|
//# sourceMappingURL=polkadot.d.mts.map
|
package/dist/polkadot.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { E as isWalletConnectWallet, N as WalletAccountId, T as isInjectedWallet, b as WalletConnectWallet, g as PolkadotAccountType, k as WalletId, l as KheopskitPlatform, m as PlaceholderWallet, p as Placeholder, r as BaseWallet } from "./types-Dkyt9bf4.js";
|
|
2
|
+
import { InjectedPolkadotAccount, SignPayload } from "polkadot-api/pjs-signer";
|
|
3
3
|
//#region src/utils/isSs58Address.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Returns true if `address` is a valid SS58-encoded 32-byte account id (the
|
|
@@ -11,9 +11,63 @@ import { InjectedExtension, InjectedPolkadotAccount } from "polkadot-api/pjs-sig
|
|
|
11
11
|
export declare const isSs58Address: (address: string) => boolean;
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/api/polkadot/types.d.ts
|
|
14
|
-
type
|
|
14
|
+
type PolkadotSignRawType = "bytes" | "payload";
|
|
15
|
+
/** An account as the extension lists it through `accounts.get()` and `accounts.subscribe()`. */
|
|
16
|
+
type PolkadotInjectedAccount = {
|
|
17
|
+
address: string;
|
|
18
|
+
genesisHash?: string | null;
|
|
19
|
+
name?: string;
|
|
20
|
+
type?: PolkadotAccountType;
|
|
21
|
+
/**
|
|
22
|
+
* Talisman adds this for its own dapp origins only: `true` for a watch-only
|
|
23
|
+
* account, which cannot sign. Absent for other origins and other wallets.
|
|
24
|
+
*/
|
|
25
|
+
readonly?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Talisman adds this for its own dapp origins only: `true` for a watch-only
|
|
28
|
+
* account that is part of the user's portfolio. Absent for other origins
|
|
29
|
+
* and other wallets.
|
|
30
|
+
*/
|
|
31
|
+
partOfPortfolio?: boolean;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The object `window.injectedWeb3[id].enable(appName)` resolved to, typed
|
|
35
|
+
* structurally (pjs-signer does not export its type). `metadata` and
|
|
36
|
+
* `provider` are the optional members of `@polkadot/extension-inject`'s
|
|
37
|
+
* `Injected`, left untyped here.
|
|
38
|
+
*/
|
|
39
|
+
type PolkadotInjected = {
|
|
40
|
+
accounts: {
|
|
41
|
+
get(): Promise<PolkadotInjectedAccount[]>;
|
|
42
|
+
subscribe(cb: (accounts: PolkadotInjectedAccount[]) => void): () => void;
|
|
43
|
+
};
|
|
44
|
+
signer: {
|
|
45
|
+
signPayload: SignPayload;
|
|
46
|
+
/**
|
|
47
|
+
* The extension's raw signing call, as the dapp sends it. Prefer
|
|
48
|
+
* {@link PolkadotAccount.signRaw}, which encodes `data` and documents
|
|
49
|
+
* what each wallet does with `type`.
|
|
50
|
+
*/
|
|
51
|
+
signRaw: (payload: {
|
|
52
|
+
address: string;
|
|
53
|
+
data: string;
|
|
54
|
+
type: PolkadotSignRawType;
|
|
55
|
+
}) => Promise<{
|
|
56
|
+
id: number;
|
|
57
|
+
signature: `0x${string}`;
|
|
58
|
+
}>;
|
|
59
|
+
};
|
|
60
|
+
metadata?: unknown;
|
|
61
|
+
provider?: unknown;
|
|
62
|
+
};
|
|
63
|
+
type LivePolkadotInjectedWallet = {
|
|
64
|
+
/** See {@link BaseWallet.isPlaceholder}. */
|
|
65
|
+
isPlaceholder?: false;
|
|
66
|
+
/** `polkadot:<extension id>`, e.g. `polkadot:talisman`. */
|
|
15
67
|
id: WalletId;
|
|
68
|
+
/** Always `"polkadot"`. */
|
|
16
69
|
platform: "polkadot";
|
|
70
|
+
/** Always `"injected"`. */
|
|
17
71
|
type: "injected";
|
|
18
72
|
/**
|
|
19
73
|
* Stable identifier of the underlying wallet source. For Polkadot this is the
|
|
@@ -21,32 +75,94 @@ type PolkadotInjectedWallet = {
|
|
|
21
75
|
* (Ethereum: EIP-6963 rdns; Solana: Wallet Standard name).
|
|
22
76
|
*/
|
|
23
77
|
sourceId: string;
|
|
24
|
-
|
|
78
|
+
/**
|
|
79
|
+
* The raw object `enable(appName)` returned. Use it for extension calls
|
|
80
|
+
* kheopskit does not wrap. `undefined` until `status` is `"connected"`,
|
|
81
|
+
* so also while connecting; a placeholder has none.
|
|
82
|
+
*/
|
|
83
|
+
extension: PolkadotInjected | undefined;
|
|
84
|
+
/** The extension's display name, e.g. `Talisman`; the extension id for an unknown extension. */
|
|
25
85
|
name: string;
|
|
86
|
+
/** The extension's logo as a data URI; `""` for an unknown extension. */
|
|
26
87
|
icon: string;
|
|
88
|
+
/** See {@link BaseWallet.status}. */
|
|
89
|
+
status: BaseWallet["status"];
|
|
90
|
+
/** See {@link BaseWallet.error}. */
|
|
91
|
+
error?: BaseWallet["error"];
|
|
92
|
+
/** `status === "connected"`. */
|
|
27
93
|
isConnected: boolean;
|
|
28
|
-
connect
|
|
29
|
-
|
|
94
|
+
/** See {@link BaseWallet.connect}. Calls `enable(appName)`, then `accounts.get()`. */
|
|
95
|
+
connect: BaseWallet["connect"];
|
|
96
|
+
/** See {@link BaseWallet.disconnect}. Polkadot extensions have no disconnect call; kheopskit drops the handle. */
|
|
97
|
+
disconnect: BaseWallet["disconnect"];
|
|
30
98
|
};
|
|
99
|
+
type PolkadotInjectedWallet = LivePolkadotInjectedWallet | PlaceholderWallet<LivePolkadotInjectedWallet, "sourceId" | "extension">;
|
|
31
100
|
type PolkadotWallet = PolkadotInjectedWallet;
|
|
32
101
|
/**
|
|
33
102
|
* A Polkadot account. Inherits the fields of polkadot-api's
|
|
34
103
|
* `InjectedPolkadotAccount` and narrows `type` to {@link PolkadotAccountType}.
|
|
104
|
+
* The inherited fields are `address` (SS58, or 0x-hex for an `ethereum`
|
|
105
|
+
* account, as the extension lists it), `name` (the account name in the
|
|
106
|
+
* extension, when it has one) and `genesisHash` (the chain the account is
|
|
107
|
+
* restricted to, `null` or absent when it is not). A WalletConnect account has
|
|
108
|
+
* `name` `<wallet name> Polkadot` and `genesisHash` `null`.
|
|
35
109
|
*
|
|
36
110
|
* The signing surface follows the installed polkadot-api version:
|
|
37
111
|
* **`txCreator`** (a `TxCreator`) on v3+, **`polkadotSigner`** (a
|
|
38
|
-
* `PolkadotSigner`) on v2.
|
|
112
|
+
* `PolkadotSigner`) on v2. For `ethereum` accounts the signer is built with the
|
|
113
|
+
* `ecdsa` signature type, so on v3 and later fee estimation and dry runs use a
|
|
114
|
+
* 65-byte mock signature. v2's `getPolkadotSignerFromPjs` ignores that type.
|
|
39
115
|
*
|
|
40
116
|
* Per-platform signing surfaces differ: Ethereum exposes `client` (viem),
|
|
41
|
-
* Solana `signer`/`getSigner(chain)`. The Polkadot signing surface
|
|
42
|
-
*
|
|
117
|
+
* Solana `signer`/`getSigner(chain)`. The Polkadot signing surface, `signRaw`
|
|
118
|
+
* included, is absent on a placeholder.
|
|
43
119
|
*/
|
|
44
|
-
type PolkadotAccount =
|
|
120
|
+
type PolkadotAccount = LivePolkadotAccount | Placeholder<LivePolkadotAccount, PolkadotSigningKey>;
|
|
121
|
+
type PolkadotSigningKey = Exclude<keyof InjectedPolkadotAccount, "address" | "genesisHash" | "name" | "type"> | "signRaw";
|
|
122
|
+
type LivePolkadotAccount = Omit<InjectedPolkadotAccount, "type"> & {
|
|
123
|
+
/** See {@link BaseWalletAccount.isPlaceholder}. */
|
|
124
|
+
isPlaceholder?: false;
|
|
125
|
+
/**
|
|
126
|
+
* Key type the extension reported, `sr25519` when it reported none. Always
|
|
127
|
+
* `sr25519` for a WalletConnect account, which reports no key type.
|
|
128
|
+
*/
|
|
45
129
|
type: PolkadotAccountType;
|
|
130
|
+
/** `<walletId>::<address>`. */
|
|
46
131
|
id: WalletAccountId;
|
|
132
|
+
/** Always `"polkadot"`. */
|
|
47
133
|
platform: "polkadot";
|
|
134
|
+
/** `name` of the wallet that lists the account. */
|
|
48
135
|
walletName: string;
|
|
136
|
+
/** `id` of the wallet that lists the account. */
|
|
49
137
|
walletId: WalletId;
|
|
138
|
+
/** See {@link PolkadotInjectedAccount.readonly}. */
|
|
139
|
+
readonly?: boolean;
|
|
140
|
+
/** See {@link PolkadotInjectedAccount.partOfPortfolio}. */
|
|
141
|
+
partOfPortfolio?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Signs arbitrary data with the wallet's raw signing call (`signer.signRaw`
|
|
144
|
+
* for an extension, `polkadot_signMessage` over WalletConnect) and resolves
|
|
145
|
+
* the signature as hex.
|
|
146
|
+
*
|
|
147
|
+
* A string is sent as text with `type: "payload"` and a `Uint8Array` as
|
|
148
|
+
* `0x` hex with `type: "bytes"`. An explicit `options.type` is sent as given
|
|
149
|
+
* for either input. A hex-looking string is sent as text; pass a
|
|
150
|
+
* `Uint8Array` for bytes, because Talisman, polkadot.js, SubWallet and Nova
|
|
151
|
+
* decode a `0x`-shaped string as bytes (Talisman observed live, the others
|
|
152
|
+
* read from their sources).
|
|
153
|
+
*
|
|
154
|
+
* Pass a string for a Sign-In With Substrate message. Talisman 3.11.0 opens
|
|
155
|
+
* its Sign In screen when the text parses as SIWS (the `Version` line must
|
|
156
|
+
* read `1.0.0`) and its generic Sign Request screen for anything else, hex
|
|
157
|
+
* included; the screen follows the text `data`, not `type` (observed live
|
|
158
|
+
* with both values). From their sources: Talisman, polkadot.js, SubWallet
|
|
159
|
+
* and Nova ignore `type`; Enkrypt reads it as the encoding of `data`,
|
|
160
|
+
* `"payload"` for UTF-8 text and `"bytes"` for hex, so it needs the value
|
|
161
|
+
* the derived default sends. WalletConnect has no such field.
|
|
162
|
+
*/
|
|
163
|
+
signRaw: (data: string | Uint8Array, options?: {
|
|
164
|
+
type?: PolkadotSignRawType;
|
|
165
|
+
}) => Promise<`0x${string}`>;
|
|
50
166
|
};
|
|
51
167
|
//#endregion
|
|
52
168
|
//#region src/api/polkadot/plugin.d.ts
|
|
@@ -70,5 +186,5 @@ type PolkadotPluginOptions = {
|
|
|
70
186
|
*/
|
|
71
187
|
export declare const polkadot: (options?: PolkadotPluginOptions) => KheopskitPlatform<"polkadot", PolkadotWallet, PolkadotAccount>;
|
|
72
188
|
//#endregion
|
|
73
|
-
export { type PolkadotAccount, type PolkadotAccountType, type PolkadotInjectedWallet, type PolkadotPluginOptions, type PolkadotWallet, type WalletConnectWallet, isInjectedWallet, isWalletConnectWallet };
|
|
189
|
+
export { type PolkadotAccount, type PolkadotAccountType, type PolkadotInjected, type PolkadotInjectedAccount, type PolkadotInjectedWallet, type PolkadotPluginOptions, type PolkadotSignRawType, type PolkadotWallet, type WalletConnectWallet, isInjectedWallet, isWalletConnectWallet };
|
|
74
190
|
//# sourceMappingURL=polkadot.d.ts.map
|