UNPKG

@privy-io/js-sdk-core

Version:

Vanilla JS client for the Privy Auth API

2 lines (1 loc) 559 B
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=/*#__PURE__*/e(require("canonicalize"));let a={method:"POST",path:"/v1/wallets/:wallet_id/rpc"};exports.rpc=async function(e,r,{wallet_id:i,...l}){let o={version:1,url:e.getCompiledPath(a,{params:{wallet_id:i}}),method:"POST",headers:{"privy-app-id":e.app.appId},body:{...l}},d=Buffer.from(t.default(o)).toString("base64"),{signature:p}=await r({message:d});return await e.fetchPrivyRoute(a,{body:l,params:{wallet_id:i},headers:{"privy-authorization-signature":p}})};