# @mysten/wallet-sdk

## 0.9.11

## 0.9.10

## 0.9.9

## 0.9.8

## 0.9.7

## 0.9.6

## 0.9.5

## 0.9.4

## 0.9.3

## 0.9.2

## 0.9.1

## 0.9.0

### Minor Changes

- 15eb25e: Recognize `SenderAllowance` funds withdrawals in the transaction analyzer. Withdrawal
  inputs report `withdrawFrom: 'SenderAllowance'` with the `funder` and `allowance`, and balance
  flows attribute the withdrawn amount to the funder instead of the sender or gas owner.

  Recognize `allowance::balance_spend` and `allowance::app_balance_spend`, tracking both funder
  debits and recipient credits. Require funder and allowance details when narrowing allowance
  inputs.

  Reject balance-flow analysis when a withdrawal's redemption cannot be tracked, including allowance
  withdrawals passed to custom Move functions. This prevents opaque self-funded allowance spends
  from bypassing auto-approval token budgets.

## 0.8.19

## 0.8.18

## 0.8.17

## 0.8.16

## 0.8.15

## 0.8.14

## 0.8.13

## 0.8.12

## 0.8.11

## 0.8.10

## 0.8.9

## 0.8.8

### Patch Changes

- 8c4b149: Update dependencies to versions that resolve security advisories: hono,
  @hono/node-server, next, postcss, and valibot

## 0.8.7

## 0.8.6

## 0.8.5

## 0.8.4

## 0.8.3

## 0.8.2

## 0.8.1

## 0.8.0

### Minor Changes

- 2f4d20f: Update auto-approval analysis to accept explicit operation types and use effective sender
  balance flows for budget checks. Auto-approval policy and settings coin types are now normalized
  before matching analyzer balance flows.

## 0.7.0

### Minor Changes

- da3a7b2: Add transaction analyzer status metadata and optional dependency edges.

  Analyzer results now include `status`, and top-level analysis returns an overall status.
  Dependency objects can use `{ analyzer, required?, transform? }`; bare analyzer dependencies
  remain required and unwrap `result`, while `optional(analyzer)` and
  `{ analyzer, required: false }` pass the full dependency `AnalyzerResult` unless a custom
  transform is provided. The top-level analyzer key `status` is now reserved.

  Sponsor validation now preserves policy findings from validators that ran while separately
  reporting validators that failed or were skipped. Sponsor rejections include `policyIssues` and
  `analysisIssues`, and failed or skipped validators reject even when they surface no issue message.

  Auto-approval state mutation methods now require a `success` analysis result before mutating
  budgets or pending digests.

  Compatibility note: code that constructs analyzer results, constructs sponsor rejections, or
  exhaustively matches the old analyzer result union may need updates for the required `status`
  field, the `partial` and `skipped` statuses, and the required `policyIssues` and `analysisIssues`
  fields.

## 0.6.2

## 0.6.1

## 0.6.0

### Minor Changes

- 564c8e7: The `transactionResponse` analyzer is now a generic factory — call
  `transactionResponse()` (was a bare analyzer value) — so its result can be typed to exactly the
  simulate fields you request. `transactionResponse<{ balanceChanges: true }>()` returns the same
  shared, deduped analyzer instance retyped so `result.balanceChanges` is present, and makes
  `include` a required request-scoped option when it names a field that must be fetched. `effects`
  is always included and can't be turned off. An injected `transactionResponse` now skips the
  dry-run entirely (it previously simulated and then discarded the result), so `transactionResponse`
  and `include` are mutually exclusive in effect — injection takes precedence. This is a breaking
  change: update `transactionResponse` references to `transactionResponse()` (or
  `transactionResponse<Include>()`). The `balanceChanges` analyzer now requests `balanceChanges`
  from the dry-run, so its result is the real `BalanceChange[]` rather than always empty.

## 0.5.1

## 0.5.0

### Minor Changes

- cc5cb98: Export the `Analyzer` type from the transaction analyzer. This lets downstream packages
  annotate custom analyzers (`const myAnalyzer: Analyzer<...> = createAnalyzer({...})`) so their
  declaration output stays portable.
- cc5cb98: The `transactionResponse` analyzer now dry-runs with `include: { effects: true }`, so its
  result carries the simulated `effects` (including execution status). This lets consumers tell
  whether a transaction would succeed without a second simulation.

### Patch Changes

- cc5cb98: The `bytes` and `transactionResponse` analyzers now include the underlying error in their
  failure issues — the message carries the real cause (e.g.
  `Failed to dry run transaction: <detail>`) and the caught `Error` is attached as `issue.error` —
  instead of a generic `Failed to build/dry run transaction`. Many failures (object resolution, gas
  estimation, an unreachable node) throw during build/simulation, and that detail was previously
  discarded.

## 0.4.0

### Minor Changes

- bbf63cb: Updated dependencies

### Patch Changes

- Updated dependencies [bbf63cb]
  - @mysten/bcs@2.1.0
  - @mysten/wallet-standard@0.21.0

## 0.3.2

### Patch Changes

- f7de3e5: Restore docs in published tarballs.
- Updated dependencies [f7de3e5]
  - @mysten/bcs@2.0.5
  - @mysten/wallet-standard@0.20.3

## 0.3.1

### Patch Changes

- 9e067cf: Validate the new per-package release flow end-to-end across every public @mysten package.
  No functional changes — empty patch bump to force the orchestrator to dispatch every
  release-<pkg>.yml workflow with `dry_run=false` so each package publishes via OIDC trusted
  publishing.
- Updated dependencies [9e067cf]
  - @mysten/bcs@2.0.4
  - @mysten/wallet-standard@0.20.2

## 0.3.0

### Minor Changes

- bf0843b: Improve issue handling on `analyze()`:
  - Each analyzer result now carries an additional `ownIssues` field — the issues this analyzer's
    own `analyze()` emitted, excluding anything inherited from failing dependencies. The existing
    `issues` field is unchanged (own + inherited).
  - The `analyze()` return object now exposes a top-level `issues` array — the concatenation of
    every analyzer's `ownIssues` across the whole run (including transitive deps). Each analyzer
    runs once (memoized by cacheKey), so each issue appears exactly once without needing to dedup.
  - New `AnalyzerOutput<T>` type exported from `@mysten/wallet-sdk`, returned by individual analyzer
    `analyze()` callbacks (the old union shape). `AnalyzerResult<T>` is what `analyze()` produces
    per analyzer, with the new `ownIssues` field added to the failure branch.

  ```ts
  const r = await analyze({ balanceFlows, coinFlows }, { ... });

  r.balanceFlows.result      // unchanged
  r.balanceFlows.issues      // unchanged (own + inherited)
  r.balanceFlows.ownIssues   // NEW — only what balanceFlows emitted
  r.issues                   // NEW — every issue, each appearing exactly once
  ```

- 10564cf: Add a `moveCallHandlers` option to the `balanceFlows` analyzer for teaching it about
  protocol-specific Move calls without hard-coding package addresses into the core rule. Each entry
  is a factory invoked once per `analyze()` run so handlers can hold per-PTB state in a closure; the
  returned handler participates in the same tracking model as the built-in `0x2::coin` /
  `0x2::balance` framework handler — it can look up tracked balances for command arguments, emit
  per-address deltas, and register tracked results at result slots — but it fires only for MoveCalls
  the built-in handler doesn't recognize.

  ```ts
  import { analyze, balanceFlows, createPASMoveCallHandler } from '@mysten/wallet-sdk';

  await analyze(
  	{ balanceFlows },
  	{
  		transaction,
  		client,
  		balanceFlows: {
  			moveCallHandlers: [createPASMoveCallHandler({ packageId, namespaceId })],
  		},
  	},
  );
  ```

  New exports:
  - `BalanceFlowsMoveCallHandler`, `BalanceFlowsMoveCallHandlerContext`,
    `BalanceFlowsMoveCallHandlerFactory` — the handler signature, the context passed to it (exposes
    `getTrackedBalance`, `keyFor`, `outputKey`, `trackCoinResult`, `trackBalanceResult`,
    `recordFlow`, and `addIssue`), and the factory type the `moveCallHandlers` option accepts.
  - `TrackedBalance` — exported as a type so handlers can annotate values returned by
    `getTrackedBalance`; handlers don't construct them directly.
  - `AnalyzedMoveCallCommand` — hoisted from the `AnalyzedCommand` union so handlers can type their
    first argument.
  - `createPASMoveCallHandler({ packageId, namespaceId })` — **experimental** — a handler factory
    for the Permissioned Assets Standard. PAS is still evolving, so expect the supported Move
    signatures and the resulting delta shape to change alongside the standard. Handles
    `account::deposit_balance`, `account::send_balance`, `account::unlock_balance`,
    `account::clawback_balance`, `account::unsafe_send_balance`, `account::create`, and the
    `unlock_funds::resolve` / `unlock_funds::resolve_unrestricted_balance` /
    `clawback_funds::resolve` / `send_funds::resolve_balance` resolvers. Deltas are keyed on each
    PAS account's on-chain address (the shared Account object's id for existing accounts, or the
    `(namespace, owner)`-derived address for accounts created earlier in the same PTB via
    `account::create`) so they match the actual accumulator mutations on chain. The credit for
    `send_balance` / `unsafe_send_balance` is emitted when `send_funds::resolve_balance` runs,
    matching where the on-chain `balance::send_funds` call lives. Hot-potato state (pending sends,
    unlocked/clawed-back balances waiting on a resolver) lives in the handler's closure — the
    generic consume loop never sees these intermediate results, so template MoveCalls that take a
    `&mut Request<...>` between a send and its resolver don't wipe the pending credit. Dynamic `u64`
    amounts (Result args instead of Pure) are flagged as analysis issues rather than guessed — PAS
    withdrawals source from an account address with no tracked starting balance, so there is no safe
    worst-case default and the caller needs to decide how to surface the uncertainty.

## 0.2.0

### Minor Changes

- 1ec49c4: Add an `excludeGasBudget` option to the `balanceFlows` analyzer. When true, the gas
  budget is not charged against the gas payer's per-address deltas — useful for UIs that display gas
  fees separately from value flows. The gas coin itself is still tracked, so splits / merges on
  `tx.gas` account correctly; only the budget deduction is suppressed.

  ```ts
  await analyze(
  	{ balanceFlows },
  	{ transaction, client, balanceFlows: { excludeGasBudget: true } },
  );
  ```

  Also exports `BalanceFlowsResult` and `BalanceFlowsAnalyzerOptions` from `@mysten/wallet-sdk`.

- a391d8d: Transaction analyzer supports `FundsWithdrawal` inputs, the `0x2::coin` / `0x2::balance`
  framework functions (`redeem_funds`, `send_funds`, `into_balance`, `from_balance`, `split`,
  `take`, `withdraw_all`, `join`, `put`, `zero`), and sponsored transactions.

  New `balanceFlows` rule exposes per-address signed balance deltas — negative = value left the
  address on net, positive = value arrived. Its result has three views:
  - `byAddress: Record<string, CoinFlow[]>` — every address that touched tracked value.
  - `sender: CoinFlow[]` — the transaction sender's signed flows (empty if the sender didn't move
    any tracked value).
  - `sponsor: CoinFlow[] | null` — the gas payer's signed flows when `gasData.owner` differs from
    `data.sender`; `null` when the tx isn't sponsored.

  Coin reservation refs are surfaced as synthetic entries in the `objects` / `coins` / `gasCoins`
  analyzers with `isCoinReservation: true` on the resulting `AnalyzedObject` and balance decoded
  from the digest. Gas-payment reservations (always `Coin<SUI>`) are synthesized locally.
  Reservation refs that appear as regular `Object` inputs — the backwards-compatible shape produced
  by old SDKs via `listCoins` — are resolved by unmasking the object ID (XOR with the chain
  identifier) and batching the accumulator-field lookup into the same `getObjects` request; the coin
  type is parsed from the accumulator field's struct tag.

  The existing `coinFlows` rule is now deprecated — it returns sender-only outflows with the pre-PR
  sign convention (positive = spent). Migrate to `balanceFlows.sender` for signed flows, or iterate
  `balanceFlows.byAddress[senderAddress]`.

  When `gasData.payment` is empty the gas budget is attributed to the gas payer's address balance
  (this is the shape transactions take when gas is paid from an address balance rather than coin
  objects). `tx.gas` itself is unusable in that mode; the analyzer flags any draw from it as an
  over-split against a zero-balance coin.

## 0.1.1

### Patch Changes

- 99d1e00: Add default export condition
- Updated dependencies [99d1e00]
  - @mysten/wallet-standard@0.20.1
  - @mysten/bcs@2.0.2

## 0.1.0

### Minor Changes

- e00788c: Update to @mysten/sui@2.0
- e00788c: Update to use SuiJsonRpcClient instead of SuiClient

  Updated all type signatures, internal usages, examples, and documentation to use
  `SuiJsonRpcClient` from `@mysten/sui/jsonRpc` instead of the deprecated `SuiClient` from
  `@mysten/sui/client`.

### Patch Changes

- Updated dependencies [e00788c]
- Updated dependencies [e00788c]
- Updated dependencies [e00788c]
- Updated dependencies [e00788c]
  - @mysten/wallet-standard@0.20.0
  - @mysten/bcs@2.0.0

## 0.0.8

### Patch Changes

- Updated dependencies [29e8b92]
  - @mysten/sui@1.45.2
  - @mysten/wallet-standard@0.19.9

## 0.0.7

### Patch Changes

- e3811f1: update valibot
- Updated dependencies [e3811f1]
  - @mysten/sui@1.45.1
  - @mysten/wallet-standard@0.19.8

## 0.0.6

### Patch Changes

- a71f824: fix coin calculation in AutoApprovalManager.applyTransactionEffects

## 0.0.5

### Patch Changes

- Updated dependencies [88bdbac]
  - @mysten/sui@1.45.0
  - @mysten/wallet-standard@0.19.7

## 0.0.4

### Patch Changes

- Updated dependencies [44d9b4f]
  - @mysten/sui@1.44.0
  - @mysten/wallet-standard@0.19.6

## 0.0.3

### Patch Changes

- Updated dependencies [89fa2dc]
  - @mysten/bcs@1.9.2
  - @mysten/sui@1.43.2
  - @mysten/wallet-standard@0.19.5

## 0.0.2

### Patch Changes

- Updated dependencies [a37829f]
  - @mysten/bcs@1.9.1
  - @mysten/sui@1.43.1
  - @mysten/wallet-standard@0.19.4

## 0.0.1

### Patch Changes

- Updated dependencies [f3b19a7]
- Updated dependencies [f3b19a7]
- Updated dependencies [bf9f85c]
  - @mysten/sui@1.43.0
  - @mysten/bcs@1.9.0
  - @mysten/wallet-standard@0.19.3
