Skip to content
Starknet Start

useStrk20

Hooks for STRK20 privacy wallet requests.

These hooks require a connected wallet that supports the STRK20 wallet API methods.

Hooks

useStrk20Balances

Queries private STRK20 balances for one or more token addresses.

import {  } from "@starknetfoundation/starknet-start-react";
 
const  = "0x123";
 
const { ,  } = ({
  : [],
});

useStrk20PrepareInvoke

Builds a Starknet call and SNIP-36 proof for STRK20 actions without submitting it.

import {  } from "@starknetfoundation/starknet-start-react";
import type {  } from "@starknet-io/types-js";
 
const : [] = [
  {
    : "deposit",
    : "0x123",
    : "0x1",
  },
];
 
const {  } = ({
  ,
  : true,
});

Use simulate: true for fee previews. The returned proof has the same shape, but is not submittable on-chain.

useStrk20InvokeTransaction

Submits STRK20 actions through the wallet.

import {  } from "@starknetfoundation/starknet-start-react";
import type {  } from "@starknet-io/types-js";
 
const : [] = [
  {
    : "transfer",
    : "0x123",
    : "0x1",
    : "0x456",
  },
];
 
const {  } = ({  });

Prepared Calls

If you prepare a STRK20 call and want to submit it yourself, pass the returned proof to useSendTransaction.

import { ,  } from "@starknetfoundation/starknet-start-react";
import type {  } from "@starknet-io/types-js";
 
const : [] = [
  {
    : "withdraw",
    : "0x123",
    : "0x1",
    : "0x456",
  },
];
 
const {  } = ({  });
const {  } = ({});
 
async function () {
  const { ,  } = await ();
  await ({ : [],  });
}