You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/pages/signers.md
+8-6Lines changed: 8 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,10 @@
1
1
# Signers
2
2
3
+
## `PolkadotSigner`
4
+
3
5
For transactions, the generated descriptors and its corresponding typed API are needed to create the transaction extrinsics, but for these transactions to be signed, we also need a signer, which is the responsible of taking it the call data and signing it.
4
6
5
-
Every method on Polkadot-API that needs to sign something, takes in a signer with the following interface:
7
+
Every method on Polkadot-API that needs to sign something, requires a `PolkadotSigner` with the following interface:
6
8
7
9
```ts
8
10
interfacePolkadotSigner {
@@ -26,7 +28,7 @@ interface PolkadotSigner {
26
28
27
29
This interface is generic to signing transactions for the chain.
28
30
29
-
##`PolkadotSigner` from a browser extension
31
+
### From a browser extension
30
32
31
33
If you want to use a compatible extension as a signer, Polkadot-API has a subpath with a couple of utilities to help with this: `polkadot-api/pjs-signer`.
If you have a signer which takes some arbitrary data and just signs it with one of the supported algorithms, you can create a `PolkadotSigner` with the function `getPolkadotSigner` from `polkadot-api/signer`:
57
59
@@ -68,16 +70,16 @@ For example, using hdkd from `@polkadot-labs`:
68
70
```ts
69
71
import { sr25519CreateDerive } from "@polkadot-labs/hdkd"
70
72
import {
71
-
sr25519,
72
73
DEV_PHRASE,
73
74
entropyToMiniSecret,
74
75
mnemonicToEntropy,
75
76
} from "@polkadot-labs/hdkd-helpers"
77
+
import { getPolkadotSigner } from "polkadot-api/signer"
0 commit comments