diff --git a/src/lib/docs/Releases/4.0.1.md b/src/lib/docs/Releases/4.0.1.md index 427149e4..95e9c263 100644 --- a/src/lib/docs/Releases/4.0.1.md +++ b/src/lib/docs/Releases/4.0.1.md @@ -37,11 +37,11 @@ After reinstalling, confirm that your project resolves one copy of antelope with ### Changes to check in your code - **K1 signatures differ byte for byte** from the ones 1.x produced for the same key and message. They are valid and canonical, and older signatures still verify. Re-record any test that asserts a literal signature string. -- **`PrivateKey.sharedSecret()` returns the full 32 bytes** of the shared x-coordinate, where 1.x stripped leading zero bytes. Pass `{legacy: true}` for the stripped form. -- **A binary extension field (`T$`) absent from the data is left out** of the object or `Struct` instance antelope decodes, matching nodeos, where 1.x set it to `null`. An empty optional field (`T?`) still decodes as `null`. Check any code that tests a decoded extension field for `null`. +- **`PrivateKey.sharedSecret()` returns the full 32 bytes** of the shared x-coordinate, where 1.x stripped leading zero bytes. Pass `{legacy: true}` for the stripped form: `privateKey.sharedSecret(publicKey, {legacy: true})`. +- **A binary extension field (`T$`) absent from the data is left out** of the object or `Struct` instance antelope decodes, matching nodeos, where 1.x set it to `null`. An empty optional field (`T?`) still decodes as `null`. Code that tests a decoded extension field for `null` tests for `undefined`: `decoded.field === null` becomes `decoded.field === undefined`. - **`Float32.toString()` returns the shortest round-tripping string**, so `1.5` renders as `"1.5"` in place of `"1.5000000"`. Infinity, NaN and negative zero render as nodeos spells them. - **`SessionKit.restore()` takes a `PartialSerializedSession`**, and the `RestoreArgs` type is removed. Only an explicit `import type {RestoreArgs}` needs editing. -- **`SessionKit.persistSession()` takes options** in place of a boolean: `persistSession(session, {setAsDefault: false})`. +- **`SessionKit.persistSession()` takes options** in place of a boolean: `persistSession(session, false)` becomes `persistSession(session, {setAsDefault: false})`. - **Namespaces re-exported from CommonJS dependencies** by `@wharfkit/cli`, `@wharfkit/protocol-esr` and `@wharfkit/session` are no longer frozen with a `null` prototype in the CommonJS bundles. Only code that checks one with `instanceof`, `Object.getPrototypeOf` or `Object.isFrozen` sees a difference. - **`pako` moved to 3.x** inside antelope. It is ESM with no default export, which matters only to a project that imports `pako` itself. @@ -53,9 +53,8 @@ Your application can hold a key that signs a chosen set of actions on its own, s ```ts const sessionKit = new SessionKit(args, { - ui, sessionKey: { - whitelist: [{ contract: "eosio.token", actions: ["transfer"] }], + whitelist: [{ contract: "mygame", actions: ["move", "attack"] }], }, }) @@ -64,18 +63,26 @@ await session.setupSessionKey() `setupSessionKey()` generates the key, adds it under a permission named after your application, and links the listed actions to it, in one transaction the user approves. `Session` also has methods to check, update and remove the key. Session keys need a `UserInterface` that draws four prompts (consent, an existing key on the permission, a whitelist mismatch, and removal); `@wharfkit/web-renderer` draws all four. -### Holding several sessions +The key signs the listed actions without showing them to the user, and every action outside the whitelist goes to the wallet for approval. -`equalityFn` on the `SessionKit` decides when two stored sessions are the same, which lets an application keep several sessions for one account apart by something it stores in `session.data`. Four fixes land with it: +### Waiting for irreversibility -- `logout(session)` clears the stored default only when that session was the default. -- `login()`, `restore()` and `persistSession()` resolve after the session is in storage, so two logins in a row keep both sessions. -- `restoreAll()` leaves storage untouched. -- Each restored session gets its own wallet plugin instance. +Set `awaitIrreversible` on `transact()`, or once on the `SessionKit`, and the call resolves only after the transaction is irreversible: -### Waiting for irreversibility +```ts +await session.transact({ action }, { awaitIrreversible: true }) + +const sessionKit = new SessionKit(args, { awaitIrreversible: true }) +``` + +`broadcastOptions` sets `returnFailureTrace`, `retryTrx` and `retryTrxNumBlocks` directly: -Set `awaitIrreversible` on `transact()`, or once on the `SessionKit`, and the call resolves only after the transaction is irreversible. `broadcastOptions` sets `returnFailureTrace`, `retryTrx` and `retryTrxNumBlocks` directly. +```ts +await session.transact( + { action }, + { broadcastOptions: { retryTrx: true, retryTrxNumBlocks: 10 } } +) +``` ### Anchor signing on iOS @@ -87,6 +94,7 @@ Signing with Anchor on the same iOS device completes when Safari brings the user - `Authority.sort()` orders keys, accounts and waits the way nodeos does, so the chain accepts the `updateauth` you build with it. `Name`, `PermissionLevel` and `PublicKey` gained `compare()`. - `FetchProvider` uses the `fetch` built into Node.js and browsers, so you can drop `node-fetch`. - `get_table_rows` queries `float64` and `float128` secondary indexes. +- `SessionKit` keeps stored sessions intact: `login()`, `restore()` and `persistSession()` resolve after the session is in storage, so two logins in a row keep both sessions; `logout(session)` clears the stored default only when that session was the default; `restoreAll()` leaves storage untouched; and each restored session gets its own wallet plugin instance. - `@wharfkit/roborovski` gains `activity()`, which pages through an account's history with `next()` and `prev()` and filters by contract, action and date range. - `@wharfkit/web-renderer` accepts `colorMode`, `"light"` or `"dark"`. - `@wharfkit/protocol-scatter` and the four wallet plugins built on it import cleanly under Node.js. diff --git a/src/routes/docs/releases/4-0-0/+page.ts b/src/routes/docs/releases/4-0-0/+page.ts new file mode 100644 index 00000000..c735f812 --- /dev/null +++ b/src/routes/docs/releases/4-0-0/+page.ts @@ -0,0 +1,7 @@ +import { redirect } from "@sveltejs/kit" + +export const prerender = false + +export const load = async () => { + throw redirect(301, "/docs/releases/4-0-1") +} diff --git a/static/_redirects b/static/_redirects deleted file mode 100644 index 8aa4b65c..00000000 --- a/static/_redirects +++ /dev/null @@ -1 +0,0 @@ -/docs/releases/4-0-0 /docs/releases/4-0-1 301