Run it locally
Two examples in octap-core use the public SDK methods. Run both from the repository root after setting up the workspace.
Voucher demo
Section titled “Voucher demo”This runs a full paid claim against a real API with a disposable database. It needs Docker. Enoki, Sui and the customer signature are mocked, so it proves the SDK flow, not a real Testnet transaction or Google sign-in.
npm run demo:sdk:localIt reads the balance, claims a voucher, hands off the signature, finalizes and redeems the serial, then checks the saved state. Read scripts/sdk-voucher-demo.mjs to see the backend side of the flow.
To run the same flow against your own API, set these in your shell. It stops at the customer signature, because only the customer can sign.
OCTAP_API_URL=… OCTAP_API_KEY=… OCTAP_DEMO_MEMBER_ID=… OCTAP_DEMO_VOUCHER_ID=… OCTAP_DEMO_RUN_ID=… \ npm run demo:sdkReal sign-in on Testnet
Section titled “Real sign-in on Testnet”ts-sdks/examples/browser-auth is a page with no framework, and a small server that plays your backend. Use it to check a paid claim with a real Google account. Mocked tests can’t prove this. It is a local harness, so never deploy it.
-
Run Core’s API, worker and indexer with
ENOKI_API_KEYset andSUI_NETWORK=testnet. -
Prepare an active, provisioned organization, an API key with the
readandwritescopes, and an active paid voucher. -
Register your Google client ID in the Enoki portal, and add
http://localhost:4001to its authorized JavaScript origins. -
Start the example:
Terminal window npm run buildOCTAP_API_KEY=… OCTAP_ORGANIZATION_ID=… GOOGLE_CLIENT_ID=… OCTAP_VOUCHER_ID=… \node ts-sdks/examples/browser-auth/server.mjs -
Open
http://localhost:4001and sign in. The page shows yourmemberIdandsuiAddress. Reload to check that the session restores. -
Give that member enough confirmed points with an earn, and wait for it to confirm.
-
Press Claim voucher. The page shows the
RESERVEDclaim, the finalized result, then the claim asAVAILABLE.
Set OCTAP_EXAMPLE_RUN_ID to start a new claim instead of resuming the last one.

