torque-actions
v0.1.2
Published
Torque Platform execute helpers — parse Assistant functionResults and call v1 execute routes
Maintainers
Readme
torque-actions
Parse Assistant functionResults and call Torque POST /api/v1/execute/** routes with a Connect delegated JWT or smart wallet JWT.
Install
yarn add torque-actions @torquefi/typesimport { createTorqueActions, parseFunctionResults } from 'torque-actions'
const parsed = parseFunctionResults(chat.functionResults)
const actions = createTorqueActions({
accessToken: delegatedJwt,
baseUrl: 'https://app.torque.fi',
})
for (const item of parsed) {
if (item.kind === 'swap') {
await actions.buildEvmSwap(item.payload, 'retry-key-1')
}
}Unsigned responses must be signed by your wallet client (same contract as in-app AssistantTransactionHandler).
