Read vault state
Build transactions
Each body below goes toPOST https://hedgin.xyz/api/external/v1/transactions/{action} with Content-Type: application/json. Amounts are base-unit strings.
dlmm/open body creates bins -20 to 20, because upperBinId is exclusive there. See Units and views.
Sign, send, and confirm a whole build
This TypeScript module runs one build to completion. It follows the batch andnext rules, and it never builds again after an unknown send. It needs Node.js 18 or later and @solana/web3.js.
hedgin.ts
send:
execute throws partway through a batch, confirmed steps stay on chain, and steps sent alongside the failing one can still land. A send that threw after the request left your machine, such as a network timeout, may also have reached the API. Wait about a minute for the blockhash to expire, then read current state before you call execute again.
execute does not handle Phoenix onboarding. Send a phoenix/onboard step to transactions/phoenix/onboard/submit instead of transactions/send.