Browser SDK
Receive decision requests in your web app
Installation
npm install @noxy-network/browser-sdk@2.0.1
# or
yarn add @noxy-network/browser-sdk@2.0.1
# or
pnpm add @noxy-network/browser-sdk@2.0.1
Quick Start
const noxy = await createNoxyClient({
identity: {
type: 'eoa',
address: account.address,
signer: async (data) =>
account.signMessage({ message: { raw: data } }),
},
network: {
relayNodesUrl: 'wss://relay.noxy.network',
appId: '__your-app-id__',
},
});
await noxy.on(async (decisionId, decision) => {
// show actionable decision requests in the UI
const isApproved = await showConfirmDialog(decision);
// send decision outcome to Noxy, which will be orchestrated to your agent
await noxy.submitDecisionOutcome({
decisionId,
outcome: isApproved ? NoxyDecisionOutcomeValues.APPROVE : NoxyDecisionOutcomeValues.REJECT,
receivedAt: Date.now(),
});
});