@human.tech/waap-sdk 2.1.0 → 2.2.0-staging-7f56bf
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/.agent/SKILL.md +179 -0
- package/CHANGELOG.md +69 -0
- package/README.md +264 -94
- package/dist/{WaaPError-XLgIXUgh.d.ts → WaaPError-DCJ9WDaR.d.ts} +1 -1
- package/dist/{WaaPError-C5nPcaKk.d.mts → WaaPError-DgDAQQKF.d.mts} +1 -1
- package/dist/{WalletConnect-G-lbqknM.js → WalletConnect-Dn40Omgo.js} +1 -1
- package/dist/{WalletConnect-Deg7_JmH.mjs → WalletConnect-UfxGn2M_.mjs} +1 -1
- package/dist/{esm-B4jz8Emb.mjs → esm-BUfmyWbN.mjs} +1 -1
- package/dist/esm-DFwVZkjo.js +1 -0
- package/dist/evm-BINU4e1N.mjs +2 -0
- package/dist/evm-BXkH-I90.js +2 -0
- package/dist/evm.d.mts +2 -2
- package/dist/evm.d.ts +2 -2
- package/dist/evm.js +1 -1
- package/dist/evm.mjs +1 -1
- package/dist/{index-CdKntlzX.d.mts → index-C0mLQs_a.d.mts} +44 -28
- package/dist/{index-CMSufeMa.d.ts → index-DOIss_GK.d.ts} +44 -28
- package/dist/index.d.mts +46 -10
- package/dist/index.d.ts +46 -10
- package/dist/index.js +4 -1
- package/dist/index.mjs +4 -1
- package/dist/{initializerContext-0oKHzvQG.d.ts → initializerContext-DIrqEE6B.d.ts} +1 -2
- package/dist/{initializerContext-C39PUnGi.d.mts → initializerContext-_YjbVTiL.d.mts} +1 -2
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/react.mjs +1 -1
- package/dist/{register-QjrsOe7r.d.mts → register-9bEe9ATz.d.mts} +3 -3
- package/dist/register-BXqcetNF.mjs +1 -0
- package/dist/{register-CNgjA0yl.mjs → register-Bg4jW_HM.mjs} +1 -1
- package/dist/{register-4Afr2Jx8.js → register-CRhge1wE.js} +1 -1
- package/dist/{register-CxsUwgKJ.d.ts → register-Mb1D_xW4.d.ts} +5 -17
- package/dist/{register-CBlzg5ln.d.ts → register-PWKDsSRv.d.ts} +3 -3
- package/dist/{register-LmdJdvzn.d.mts → register-XzDVa7r8.d.mts} +5 -17
- package/dist/{register-ozKwGWOb.js → register-oYvnB41B.js} +1 -1
- package/dist/solana.d.mts +4 -4
- package/dist/solana.d.ts +4 -4
- package/dist/solana.js +1 -1
- package/dist/solana.mjs +1 -1
- package/dist/sui.d.mts +4 -4
- package/dist/sui.d.ts +4 -4
- package/dist/sui.js +1 -1
- package/dist/sui.mjs +1 -1
- package/dist/{types-DexmJNke.d.mts → types-BmCqyQtu.d.mts} +36 -15
- package/dist/{types-DexmJNke.d.ts → types-BmCqyQtu.d.ts} +36 -15
- package/dist/ui-Co16lVSp.mjs +1 -0
- package/dist/ui-lJmATPTt.js +1 -0
- package/dist/{useWaapAuth-Z_ONicYr.js → useWaapAuth-BPvve-_3.js} +1 -1
- package/dist/{useWaapAuth-DHIeb4yc.mjs → useWaapAuth-BcmVGb-D.mjs} +1 -1
- package/dist/{useWaapAuth-BrqAhAn2.d.ts → useWaapAuth-DgYO5KxO.d.ts} +2 -2
- package/dist/{useWaapAuth-C5I7QqyW.d.mts → useWaapAuth-vJAk2n_I.d.mts} +2 -2
- package/dist/walletconnect.js +1 -1
- package/dist/walletconnect.mjs +1 -1
- package/package.json +4 -2
- package/dist/esm-D5fDQenf.js +0 -1
- package/dist/evm-Ch-aWWat.js +0 -1
- package/dist/evm-DHVrAmEw.mjs +0 -1
- package/dist/register-DIZnKDHF.mjs +0 -1
- package/dist/ui-16QpbEyG.js +0 -1
- package/dist/ui-BAYRtDQg.mjs +0 -1
package/.agent/SKILL.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: waap-sdk
|
|
3
|
+
description: Integrate the WaaP wallet into a browser dApp with @human.tech/waap-sdk — EIP-1193 on EVM, Wallet Standard on Sui and Solana, Squid multichain accounts, permission tokens, and iframe lifecycle. Use when writing or reviewing browser dApp code that connects to a WaaP wallet. For headless agents and scripts, use the waap-cli skill instead.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# WaaP SDK
|
|
7
|
+
|
|
8
|
+
`@human.tech/waap-sdk` is a browser bridge to the WaaP wallet iframe. It holds
|
|
9
|
+
no keys and prepares no transactions; the wallet reviews, gates, signs, and
|
|
10
|
+
broadcasts. Signing happens in a secure enclave behind policy-engine rules that
|
|
11
|
+
no SDK argument can relax.
|
|
12
|
+
|
|
13
|
+
This file states the shape of the API. It is not a version compatibility
|
|
14
|
+
contract — check the installed version's types before relying on a field.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @human.tech/waap-sdk
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Entry points
|
|
21
|
+
|
|
22
|
+
| Call | Returns | Use for |
|
|
23
|
+
| ---------------------------------------- | --------------------------- | ------------------------------- |
|
|
24
|
+
| `initWaaP()` | EIP-1193 provider | One EVM integration |
|
|
25
|
+
| `initWaaP({ chain: 'sui' \| 'solana' })` | That chain's facade | One non-EVM integration |
|
|
26
|
+
| `initWaaPSquid({ chains })` | Facades + `squid` lifecycle | Squid mode, more than one chain |
|
|
27
|
+
|
|
28
|
+
`initWaaP` returns **the facade itself**. Do not destructure a chain off it.
|
|
29
|
+
`initWaaPSquid` returns a container keyed by the chains requested.
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
const evm = initWaaP() // EIP-1193 provider
|
|
33
|
+
const sui = initWaaP({ chain: 'sui' }) // Sui facade
|
|
34
|
+
const waap = initWaaPSquid({ chains: ['evm', 'sui'] }) // waap.evm, waap.sui
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Four mistakes to avoid, each of which fails at runtime or compile time:
|
|
38
|
+
|
|
39
|
+
- `initWaaP({ chains: [...] })` — plural on the singular initializer **throws**.
|
|
40
|
+
- `const { sui } = initWaaP({ chain: 'sui' })` — there is nothing to destructure.
|
|
41
|
+
- `initWaaPSquid()` with no `chains` — at least one facade is required.
|
|
42
|
+
- Squid signing without `squid.onboard()` — the account does not exist yet.
|
|
43
|
+
|
|
44
|
+
There is no public multichain standard-mode initializer. A multichain
|
|
45
|
+
standard-mode integration
|
|
46
|
+
creates one `initWaaP({ chain })` facade per chain.
|
|
47
|
+
|
|
48
|
+
## Environment
|
|
49
|
+
|
|
50
|
+
`environment` is `'production'` (default) or `'staging'`. Never point an
|
|
51
|
+
integration at a wallet origin supplied by a URL, query parameter, or any other
|
|
52
|
+
caller-controlled input: that origin governs iframe creation, every
|
|
53
|
+
`postMessage`, and the incoming-message origin check.
|
|
54
|
+
|
|
55
|
+
## Chain and capability support
|
|
56
|
+
|
|
57
|
+
| Capability | EVM | Sui | Solana |
|
|
58
|
+
| --------------------------- | ---------------------- | --------------------------- | ------------------------ |
|
|
59
|
+
| Interface | EIP-1193 | Wallet Standard | Wallet Standard |
|
|
60
|
+
| Standard signer | `t1` secp256k1 | `t1` secp256k1 | `t2` ed25519 |
|
|
61
|
+
| Squid dWallet | `sqd1` secp256k1 | `sqd2` ed25519 | `sqd2` ed25519 |
|
|
62
|
+
| Message signing | `personal_sign` | `signPersonalMessage` | `signMessage` |
|
|
63
|
+
| Typed data | `eth_signTypedData_v4` | — | — |
|
|
64
|
+
| Sign only | `eth_signTransaction` | `signTransaction` | `signTransaction` |
|
|
65
|
+
| Sign and submit | `eth_sendTransaction` | `signAndExecuteTransaction` | `signAndSendTransaction` |
|
|
66
|
+
| Permission token (`withPT`) | sign/send transaction | sign / sign-and-execute | sign / sign-and-send |
|
|
67
|
+
| Batch signing | — | — | not implemented |
|
|
68
|
+
|
|
69
|
+
Chain identifiers are `sui:<mainnet\|testnet\|devnet\|localnet>` and
|
|
70
|
+
`solana:<mainnet\|devnet\|testnet>`. Permission-token requests use
|
|
71
|
+
`evm:<id>`, `sui:<network>`, or `solana:<network>`.
|
|
72
|
+
|
|
73
|
+
## Lifecycle rules
|
|
74
|
+
|
|
75
|
+
- Create one facade for the lifetime of the embedding UI. Do not create and
|
|
76
|
+
destroy one per Connect or Sign click.
|
|
77
|
+
- Call `destroy()` when the owning UI unmounts.
|
|
78
|
+
- The iframe warms itself once the browser is idle. `deferIframe: false` mounts
|
|
79
|
+
eagerly; `deferIframe: true` mounts nothing until `preload()` or the first
|
|
80
|
+
operation — correct when wallet interaction is not above the fold.
|
|
81
|
+
- `preload()` completes non-interactive setup. It never opens wallet UI and
|
|
82
|
+
never creates a Squid account.
|
|
83
|
+
- Re-target an environment by navigating, not by swapping in place. The wallet
|
|
84
|
+
origin is fixed at initialization and Wallet Standard registers providers
|
|
85
|
+
globally with no clean unregister.
|
|
86
|
+
|
|
87
|
+
## Squid accounts
|
|
88
|
+
|
|
89
|
+
Squid account creation is explicit and is never a side effect of login:
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
const waap = initWaaPSquid({ chains: ['evm', 'sui'] })
|
|
93
|
+
await waap.session.login() // safe on startup; silent if a session exists
|
|
94
|
+
await waap.squid.onboard() // creates or restores sqd1 + sqd2
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`waap.session` is the chain-neutral owner of login, logout, account status, and
|
|
98
|
+
lifecycle events. `waap.auth` is a deprecated EVM alias that exists only when
|
|
99
|
+
all three chains are requested.
|
|
100
|
+
|
|
101
|
+
`squid.getStatus()` reports `absent`, `provisioning`, `awaiting-network`,
|
|
102
|
+
`active`, or `failed`. In React, `useWaapAuth(waap.session)` exposes
|
|
103
|
+
`squidStatus` and the derived `isConnected`, `isPending`, `squidReady`,
|
|
104
|
+
`error`, `address`, `suiAddress`, and `solanaAddress`.
|
|
105
|
+
|
|
106
|
+
## Permission tokens
|
|
107
|
+
|
|
108
|
+
A permission token pre-authorizes a scoped batch of transactions so each one
|
|
109
|
+
does not need an individual confirmation. Request it, then opt in per call.
|
|
110
|
+
|
|
111
|
+
The wallet mode is not a parameter — the facade decides it. `initWaaP` mints a
|
|
112
|
+
standard-mode token, `initWaaPSquid` mints a Squid one, and a token is not
|
|
113
|
+
redeemable by the other mode. Request it on the facade that will send.
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
await wallet.requestPermissionToken({
|
|
117
|
+
chain: 'evm:1',
|
|
118
|
+
allowedAddresses: ['0x…'],
|
|
119
|
+
requestedAmountUsd: 100,
|
|
120
|
+
requestedExpirySeconds: 3600 // maximum 7200
|
|
121
|
+
})
|
|
122
|
+
await wallet.request({
|
|
123
|
+
method: 'eth_sendTransaction',
|
|
124
|
+
params: [tx],
|
|
125
|
+
withPT: true
|
|
126
|
+
})
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
- Holding a token changes nothing on its own; `withPT: true` is required.
|
|
130
|
+
- `withPT` is ignored on message and typed-data signing — those operations are
|
|
131
|
+
permission-token-ineligible in the wallet, whatever the caller passes.
|
|
132
|
+
- The wallet resolves only a token matching the requesting origin, chain,
|
|
133
|
+
wallet mode, and signer. Otherwise the ordinary approval / 2FA flow runs.
|
|
134
|
+
- `getPermissionTokenStatus` returns redacted metadata. The signed token never
|
|
135
|
+
leaves the wallet.
|
|
136
|
+
- Treat a permission token as a narrowing of user confirmations, never as an
|
|
137
|
+
authorization bypass. The policy engine still decides. Do not widen scope,
|
|
138
|
+
extend expiry, or add recipients without explicit user authority.
|
|
139
|
+
|
|
140
|
+
## Events and completion
|
|
141
|
+
|
|
142
|
+
Event names are exported as `WAAP_EVENTS`: `signPending`, `twoFactorRequired`,
|
|
143
|
+
`signComplete`, `signFailed`, `txPending`, `txConfirmed`, `txFailed`,
|
|
144
|
+
`squidPending`, `squidReady`, `squidFailed`. The `tx*` events are EVM-only and
|
|
145
|
+
fire only under `asyncTxs`; consume them with `useWaapTransaction(provider,
|
|
146
|
+
callbacks)`.
|
|
147
|
+
|
|
148
|
+
Resolution differs per chain, and none of it implies finality:
|
|
149
|
+
|
|
150
|
+
- EVM message and sign-only methods resolve with a signature. Under `asyncTxs`,
|
|
151
|
+
`eth_sendTransaction` resolves with the signed transaction's deterministic
|
|
152
|
+
hash as soon as signing completes; broadcast and confirmation continue in the
|
|
153
|
+
background and report through the events above.
|
|
154
|
+
- Sui `signTransaction` returns signed bytes; `signAndExecuteTransaction`
|
|
155
|
+
returns a submitted digest. Query the chain independently for finality.
|
|
156
|
+
- Solana `signTransaction` returns signed bytes; `signAndSendTransaction`
|
|
157
|
+
returns the cluster signature. A caller-built transaction keeps its exact
|
|
158
|
+
blockhash and can expire during human approval — obtain a fresh one near
|
|
159
|
+
approval time.
|
|
160
|
+
|
|
161
|
+
## Errors
|
|
162
|
+
|
|
163
|
+
- EVM follows EIP-1193: match on `error.code` from the provider error object.
|
|
164
|
+
- Sui and Solana throw `WaaPError` with a stable `code`. Branch on that, never
|
|
165
|
+
on message text.
|
|
166
|
+
- A user rejection is a decision, not a fault. Do not retry it automatically or
|
|
167
|
+
re-prompt in a loop.
|
|
168
|
+
|
|
169
|
+
## Subpath entry points
|
|
170
|
+
|
|
171
|
+
`@human.tech/waap-sdk` carries everything. Import a subpath to keep an unrelated
|
|
172
|
+
graph out of the bundle: `/evm`, `/sui`, `/solana`, `/react`, `/walletconnect`.
|
|
173
|
+
`/react` is the only subpath that imports `react`.
|
|
174
|
+
|
|
175
|
+
## Out of scope
|
|
176
|
+
|
|
177
|
+
The SDK deliberately does not expose account conversion, portable
|
|
178
|
+
signed-artifact broadcast workflows, raw-digest signing, policy administration,
|
|
179
|
+
or headless automation. For those, use `@human.tech/waap-cli` and its skill.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,74 @@
|
|
|
1
1
|
# @human.tech/waap-sdk
|
|
2
2
|
|
|
3
|
+
## 2.2.0-staging-7f56bf
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5e97ef0: Ship an agent skill at `.agent/SKILL.md`, matching the one `@human.tech/waap-cli`
|
|
8
|
+
already publishes. It states the entry-point shapes, chain capability matrix,
|
|
9
|
+
lifecycle rules, permission-token semantics, and per-chain completion meaning,
|
|
10
|
+
plus the four initializer mistakes that fail at runtime or compile time.
|
|
11
|
+
- 5e97ef0: WaaP now chooses the session protection. `sessionProtection` is gone from the
|
|
12
|
+
initializer options: DPoP is always requested, and the wallet already probes for
|
|
13
|
+
WebCrypto and IndexedDB and settles for a weaker credential where they are
|
|
14
|
+
missing. The option could only ever downgrade a browser that was capable of the
|
|
15
|
+
strong one.
|
|
16
|
+
|
|
17
|
+
`InitWaaPChainOptions` is gone too. There is one options type, `InitWaaPOptions`,
|
|
18
|
+
and the runtime chain selector is supplied inline as
|
|
19
|
+
`InitWaaPOptions & { chain?: WaaPChain }`. The base type still carries no
|
|
20
|
+
`chain`, so a variable annotated `InitWaaPOptions` keeps resolving to the EVM
|
|
21
|
+
provider exactly as it did in 2.0.0.
|
|
22
|
+
|
|
23
|
+
`initWaaPSquid` now requires `chains` with at least one facade, instead of
|
|
24
|
+
defaulting to all three. The default loaded the Sui and Solana surfaces for
|
|
25
|
+
callers that only ever used EVM, and the set a caller wants is not inferable
|
|
26
|
+
from anything else. The type is a non-empty tuple, so an empty array is a
|
|
27
|
+
compile error rather than only a runtime throw.
|
|
28
|
+
|
|
29
|
+
`initWaaPMulti` / `initWaaPTap` remain exported but are deliberately absent from
|
|
30
|
+
the README. The shared-iframe TAP composite is not a surface we have committed
|
|
31
|
+
to supporting publicly, so it is documented nowhere — but it stays exported
|
|
32
|
+
because the internal workbench drives it to exercise one iframe and one session
|
|
33
|
+
across chains, which no other entry point provides.
|
|
34
|
+
|
|
35
|
+
None of these existed in the published 2.0.0, so no 2.0 integration changes.
|
|
36
|
+
|
|
37
|
+
- 5e97ef0: Sui transactions can now opt into a permission token with `withPT: true`, on
|
|
38
|
+
`signTransaction` and `signAndExecuteTransaction` as well as the legacy
|
|
39
|
+
`signTransactionBlock` / `signAndExecuteTransactionBlock` pair.
|
|
40
|
+
|
|
41
|
+
The wallet has honored permission tokens for both Sui operations since the
|
|
42
|
+
chain drivers were unified; only the SDK input was missing, so a Sui caller had
|
|
43
|
+
no way to ask. EVM and Solana already had it.
|
|
44
|
+
|
|
45
|
+
The legacy block methods delegate to the modern ones and dropped every field
|
|
46
|
+
they were not explicitly rewriting, so `signal` and `timeoutMs` were silently
|
|
47
|
+
inert there — abort and timeout now work on that surface too.
|
|
48
|
+
|
|
49
|
+
- 53e9d3f: The call path decides the wallet mode; `--wallet-mode` and `walletMode` are gone.
|
|
50
|
+
|
|
51
|
+
A Privilege is bound to one wallet mode and cannot be redeemed by the other, so
|
|
52
|
+
restating a mode the surface already knows only created a way to bind the wrong
|
|
53
|
+
one — and the failure was silent until redemption.
|
|
54
|
+
|
|
55
|
+
`waap-cli`: `privilege create` mints for standard mode, `squid privilege create`
|
|
56
|
+
mints for Squid. That matches `send-tx` versus `squid send-tx`, so Privileges
|
|
57
|
+
stop being the one command where the mode is a flag instead of the path.
|
|
58
|
+
|
|
59
|
+
`waap-sdk`: each facade injects the mode it was constructed with, so `initWaaP`
|
|
60
|
+
mints standard and `initWaaPSquid` mints Squid.
|
|
61
|
+
`RequestPermissionTokenParams` is now
|
|
62
|
+
`Omit<RequestPermissionTokenWireParams, 'walletMode'>` — the wire shape keeps the
|
|
63
|
+
field required, the public input cannot carry it.
|
|
64
|
+
|
|
65
|
+
Runtime behaviour is unchanged for every caller: the facade's mode already won
|
|
66
|
+
the spread, so a value passed by a JavaScript caller was being overwritten
|
|
67
|
+
rather than honoured. Only the TypeScript type breaks, and that break is the
|
|
68
|
+
point — the wallet read `params?.walletMode ?? 'tap'`, so an `initWaaPSquid`
|
|
69
|
+
caller who omitted the field received a standard-mode token their Squid
|
|
70
|
+
transactions could never redeem, with nothing to indicate why.
|
|
71
|
+
|
|
3
72
|
## 2.1.0
|
|
4
73
|
|
|
5
74
|
### Minor Changes
|