Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
## [0.10.3-beta.4](https://github.com/starknet-io/types-js/compare/v0.10.3-beta.3...v0.10.3-beta.4) (2026-06-30)


### Bug Fixes

* implement spec v0.10.3-rc.3 ([c10cb2a](https://github.com/starknet-io/types-js/commit/c10cb2a9a971c9014730d6966fe750226fe90461))

## [0.10.3-beta.3](https://github.com/starknet-io/types-js/compare/v0.10.3-beta.2...v0.10.3-beta.3) (2026-06-17)


### Bug Fixes

* implements spec v0.10.3-rc2 ([93ec752](https://github.com/starknet-io/types-js/commit/93ec7522d850e75aad2d4de60b121b95195367a0))

## [0.10.3-beta.2](https://github.com/starknet-io/types-js/compare/v0.10.3-beta.1...v0.10.3-beta.2) (2026-06-10)


### Bug Fixes

* implements spec v 0.10.3-rc1 ([758ee7d](https://github.com/starknet-io/types-js/commit/758ee7d760ac65b8293cd7610a10eba0d74d95e1))

## [0.10.3-beta.1](https://github.com/starknet-io/types-js/compare/v0.10.2...v0.10.3-beta.1) (2026-06-08)


### Bug Fixes

* add missing items from rpc 0.10.2 ([e977073](https://github.com/starknet-io/types-js/commit/e97707319999f9eade49ae0c06b0945f475934be))
* rpc 0.10.3-rc0 ([d9ae10e](https://github.com/starknet-io/types-js/commit/d9ae10e6bf9a1490a6e1cf4e8937e298a0a37b14))
* starknet spec v0.10.1-rc.3 ([641bf08](https://github.com/starknet-io/types-js/commit/641bf082f79a42a1776e912706e195cb960dcaa3))
* update starknet spec v0.10.1-rc.2 ([819a426](https://github.com/starknet-io/types-js/commit/819a426d61f4785f0c16be91f9b7a55462acbf45))

## [0.10.2](https://github.com/starknet-io/types-js/compare/v0.10.1...v0.10.2) (2026-03-31)


Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,11 @@

## Installation

RPC 0.10.3 - **beta** (stable not yet released)

| npm version | Spec |
|---|---|
| `npm i @starknet-io/types-js@0.10.3-beta.4` | rc3 - latest beta |
| `npm i @starknet-io/types-js@0.10.3-beta.3` | rc2 |
| `npm i @starknet-io/types-js@0.10.3-beta.2` | rc1 |
| `npm i @starknet-io/types-js@0.10.3-beta.1` | rc0 |
RPC 0.10.3 - **latest**
```bash
npm i @starknet-io/types-js@0.10.3

RPC 0.10.2 - **latest** (Starknet 0.14.2)
```bash
npm i @starknet-io/types-js@0.10.2
```
Expand Down Expand Up @@ -110,6 +105,13 @@ import type { TypedData } from '@starknet-io/types-js';
import { PAYMASTER_API } from '@starknet-io/types-js';
```

#### Proving API [Starknet Transaction Prover API](https://github.com/starkware-libs/starknet-specs/tree/master/proving-api)

```ts
// namespace import
import { PROVING_API } from '@starknet-io/types-js';
```

## Versioning

MAJOR and MINOR version of this package follows [starknet-spec](https://github.com/starkware-libs/starknet-specs/tags) semantic versioning. The PATCH version can diverge based on the bug fixes.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@starknet-io/types-js",
"version": "0.10.2",
"version": "0.10.3-beta.4",
"author": "Toni Tabak <tabaktoni@gmail.com>",
"repository": {
"type": "git",
Expand Down
19 changes: 13 additions & 6 deletions src/api/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ export type u128 = string
* A transaction signature
*/
export type SIGNATURE = Array<FELT>

/**
* A STARK proof, encoded as a base64 string
* @pattern ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$
*/
export type PROOF = string

/**
* Proof facts (felt values) associated with a proven transaction
*/
export type PROOF_FACTS = FELT[]
/**
* The block number (height) in the blockchain
* @minimum 0
Expand Down Expand Up @@ -809,11 +820,7 @@ export type BROADCASTED_TXN =
* A broadcasted invoke transaction
*/
export type BROADCASTED_INVOKE_TXN = INVOKE_TXN_V3 & {
/**
* Optional proof for the transaction, as a base64 string-encoded byte array
* @pattern ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$
*/
proof?: string
proof?: PROOF
}

/**
Expand Down Expand Up @@ -935,7 +942,7 @@ export type INVOKE_TXN_V3 = {
/**
* Proof facts for the transaction. An empty array is returned if no proof facts exist for the transaction
*/
proof_facts?: FELT[]
proof_facts?: PROOF_FACTS
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './api/index.js'
export * as API from './api/index.js'
export * as PAYMASTER_API from './snip-29/index.js'
export * as PROVING_API from './proving-api/index.js'
export * from './wallet-api/index.js'
export * as WALLET_API from './wallet-api/index.js'
17 changes: 17 additions & 0 deletions src/proving-api/components.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { MSG_TO_L1, PROOF, PROOF_FACTS } from '../api/components.js'

/**
* The result of proving a transaction
*/
export type PROVE_TRANSACTION_RESULT = {
proof: PROOF
proof_facts: PROOF_FACTS
l2_to_l1_messages: MSG_TO_L1[]
/**
* Opaque side-channel attached alongside the proof and relayed verbatim by the prover
* from the external blocking check service. Optional; omitted from the response when absent.
* The prover does not interpret its contents — concrete keys (e.g. a screening signature
* under `signature`) are defined by the producing service, not by this API.
*/
additional_data?: Record<string, unknown>
}
28 changes: 28 additions & 0 deletions src/proving-api/errors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export interface ACCOUNT_VALIDATION_FAILED {
code: 55
message: 'Account validation failed'
data: string
}

export interface SERVICE_BUSY {
code: -32005
message: 'Service is busy'
data: string
}

export interface INVALID_TRANSACTION_INPUT {
code: 1000
message: 'Invalid transaction input'
data: string
}

export interface UNSUPPORTED_TX_TYPE {
code: 1001
message: 'the transaction type is not supported'
data: string
}

export interface TRANSACTION_BLOCKED {
code: 10000
message: 'Transaction blocked'
}
3 changes: 3 additions & 0 deletions src/proving-api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './components.js'
export * from './errors.js'
export * from './methods.js'
26 changes: 26 additions & 0 deletions src/proving-api/methods.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { BLOCK_ID, BROADCASTED_INVOKE_TXN } from '../api/components.js'
import * as ApiErrors from '../api/errors.js'
import type { PROVE_TRANSACTION_RESULT } from './components.js'
import * as Errors from './errors.js'

export interface RpcTypeToMessageMap {
starknet_specVersion: {
params?: never
result: string
}

starknet_proveTransaction: {
params: {
block_id: BLOCK_ID
transaction: BROADCASTED_INVOKE_TXN
}
result: PROVE_TRANSACTION_RESULT
errors:
| ApiErrors.BLOCK_NOT_FOUND
| Errors.ACCOUNT_VALIDATION_FAILED
| Errors.UNSUPPORTED_TX_TYPE
| Errors.SERVICE_BUSY
| Errors.INVALID_TRANSACTION_INPUT
| Errors.TRANSACTION_BLOCKED
}
}
129 changes: 125 additions & 4 deletions src/wallet-api/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ export type PADDED_TXN_HASH = PADDED_FELT // TODO: Should be like TXN_HASH_PADDE
export type PADDED_FELT = string // TODO: STORAGE_KEY should also be PADDED_FELT to remove duplication, and padded felt added to api spec ?

/**
* A Starknet RPC spec version, only two numbers are provided
* @pattern ^[0-9]+\\.[0-9]+$
* A Starknet JSON-RPC spec version, following semantic versioning.
* @pattern ^[0-9]+\\.[0-9]+(\\.[0-9]+(-[0-9A-Za-z.-]+)?)?$
* @example "0.10" | "0.10.3" | "0.10.3-rc.3"
*/
export type SpecVersion = string
export type SpecVersion =
| `${number}.${number}`
| `${number}.${number}.${number}`
| `${number}.${number}.${number}-${string}`

/**
* ERC20 Token Symbol (min:1 char - max:6 chars)
Expand Down Expand Up @@ -73,6 +77,11 @@ export interface AddInvokeTransactionParameters {
* Calls to invoke by the account
*/
calls: Call[]
/**
* Optional SNIP-36-compliant ZK proof. Required when submitting a STRK20 call
* produced by wallet_strk20PrepareInvoke; omitted for regular invocations.
*/
proof?: STRK20_PROOF
}
export interface AddInvokeTransactionResult {
/**
Expand Down Expand Up @@ -127,6 +136,7 @@ export interface AddStarknetChainParameters extends StarknetChain {}

export interface SwitchStarknetChainParameters {
chainId: ChainId
silent_mode?: boolean
}

/**
Expand All @@ -141,11 +151,122 @@ export interface AccountDeploymentData {
version: 0 | 1 // Cairo version (an integer)
}

export type API_VERSION = string
/**
* A wallet API version, following semantic versioning (no pre-release).
* When used as a request parameter and not specified, the latest is assumed.
* @pattern ^[0-9]+\\.[0-9]+(\\.[0-9]+)?$
* @example "0.8" | "0.10.3"
*/
export type API_VERSION = `${number}.${number}` | `${number}.${number}.${number}`

/**
* The version of wallet API the request expecting. If not specified, the latest is assumed
*/
export interface ApiVersionRequest {
api_version?: API_VERSION
}

// ==================== STRK20 Privacy Protocol ====================

/**
* SNIP-36-compliant zero-knowledge proof material (an in-protocol stwo-cairo
* proof) that must be included with the call when submitting the STRK20
* transaction on-chain. When the prepared call was built in simulate mode all
* three fields are present but empty.
*/
export type STRK20_PROOF = {
data: string
output: FELT[]
proof_facts: FELT[]
}

/**
* A Starknet call that materializes a STRK20 transaction, together with the
* SNIP-36-compliant zero-knowledge proof needed to submit it. When produced in
* simulate mode the proof fields are present but empty (proof.data is an empty
* string, proof.output and proof.proof_facts are empty arrays); in that case the
* call is not submittable on-chain and is only useful for fee estimation or UI
* previews.
*/
export type STRK20_CALL_AND_PROOF = {
call: Call
proof: STRK20_PROOF
}

/**
* A wallet-resolved placeholder that the wallet substitutes with a single felt
* during STRK20 action assembly. ${openNoteIds[N]} expands to the ID of the Nth
* open note in the same transaction (i.e. the Nth transfer action with amount
* "OPEN"); ${poolAddress} expands to the privacy pool contract address. N is a
* zero-based index.
* @pattern ^\$\{(?:openNoteIds\[[0-9]+\]|poolAddress)\}$
*/
export type STRK20_CALLDATA_PLACEHOLDER = string

/**
* A single calldata entry: either a literal felt, or one of the placeholder
* strings the wallet expands during action assembly.
*/
export type STRK20_CALLDATA_ITEM = FELT | STRK20_CALLDATA_PLACEHOLDER

/**
* Deposits public funds from the user's account into the privacy pool. Always to
* self.
*/
export type STRK20_DEPOSIT_ACTION = {
type: 'deposit'
token: ADDRESS
amount: FELT
}

/**
* Withdraws funds from the privacy pool to a public recipient address.
*/
export type STRK20_WITHDRAW_ACTION = {
type: 'withdraw'
token: ADDRESS
amount: FELT
recipient: ADDRESS
}

/**
* Privately transfers funds inside the privacy pool to another registered user.
*/
export type STRK20_TRANSFER_ACTION = {
type: 'transfer'
token: ADDRESS
/** FELT amount in the token's smallest unit, or the literal "OPEN" to create a new open note */
amount: FELT | 'OPEN'
recipient: ADDRESS
}

/**
* Invokes an arbitrary contract entry point as part of the same STRK20
* transaction. Calldata items may be literal felts or wallet-resolved
* placeholders that the wallet substitutes during action assembly:
* ${openNoteIds[N]} for the ID of the Nth open note (the Nth transfer action with
* amount "OPEN"), or ${poolAddress} for the privacy pool address.
*/
export type STRK20_INVOKE_ACTION = {
type: 'invoke'
contract: ADDRESS
calldata: STRK20_CALLDATA_ITEM[]
}

/**
* A single action to perform via the STRK20 privacy protocol. The `type` field
* discriminates the variant.
*/
export type STRK20_ACTION =
| STRK20_DEPOSIT_ACTION
| STRK20_WITHDRAW_ACTION
| STRK20_TRANSFER_ACTION
| STRK20_INVOKE_ACTION

/**
* A private balance for a single token held inside the privacy pool.
*/
export type STRK20_BALANCE_ENTRY = {
token: ADDRESS
balance: FELT
}
Loading