{"id":"tx-5fnhg-8u56n-xxxxxxxxxxxxxxxx","walletId":"wa-5kqa8-4leor-xxxxxxxxxxxxxxxx","network":"TezosGhostnet","requester": {"userId":"us-3v1ag-v6b36-xxxxxxxxxxxxxxxx","tokenId":"to-7mkkj-c831n-xxxxxxxxxxxxxxxx","appId":"ap-C3H2-H7-xxxxxxxxxxxxxxxx" },"requestBody": {"kind":"Transaction", "transaction": "0x04c4b1966777a5d83f3f61e17bf64aa6090ddd3413ede4e24316d3334a7836486c0060f4b0700cb1b73bff168a6221c6a033de12953ebc029d82d50a8d02000100008017ed86b1bbb1c6a9399fc47b83fb8a919e013400"
},"status":"Broadcasted","txHash":"ooESkzFG4oKQueVWX9PX1tSrBES8hWJ7N9NRtz2gK6AwVZpZqGX","dateRequested":"2024-01-10T20:06:52.915Z","dateBroadcasted":"2024-01-10T20:06:53.103Z", "approvalId": "ap-...", // defined only if an approval process was triggered as the result of a policy ("status" will be "Pending" then)
}
Taquito is a little special in that it requires a signer to forge an operation. In fact, we only need the signer to return the wallet address and the (encoded) public key. We'll initialize a Taquito RPC instance using our fake signer and a local forger (see below). After forging the operation, we can distribute it via the Dfns TypeScript SDK.
import { RpcClient} from'@taquito/rpc'import { Signer, TezosToolkit } from'@taquito/taquito'import { LocalForger } from'@taquito/local-forging'import { Prefix, b58cencode, prefix } from'@taquito/utils'constwalletId='wa-6lbfv-9esgj-88s80c0qsih0a393'constwallet=awaitdfnsClient.wallets.getWallet({ walletId })// Tezos requires a signer to forge a transaction. When forging, we only// need 'publicKeyHash' (address) and 'publicKey' (encoded)classTezosToolkitSignerimplementsSigner {sign():Promise<{ bytes:string; sig:string; prefixSig:string; sbytes:string }> {thrownewError('Method not implemented.') }asyncpublicKey():Promise<string> {constprefix=wallet.signingKey.scheme ==="EdDSA"?Prefix.EDPK:Prefix.SPPKreturnb58cencode(wallet.signingKey.publicKey, prefix) }asyncpublicKeyHash():Promise<string> {returnwallet.address }secretKey():Promise<string|undefined> {thrownewError('Method not implemented.') }}constclient=newRpcClient("TEZOS_NODE_URL") constTezos=newTezosToolkit(client)constforger=newLocalForger()Tezos.setForgerProvider(forger)Tezos.setSignerProvider(newTezosToolkitSigner())constreceiver="tz1...."// estimate feesconstestimate=awaitTezos.estimate.transfer({ source:wallet.address, to: receiver, amount:1,})constprepared=awaitTezos.prepare.transaction({ source:wallet.address, to: receiver, amount:1, fee:estimate.suggestedFeeMutez, gasLimit:estimate.gasLimit, storageLimit:estimate.storageLimit,})constforgeable=awaitTezos.prepare.toForge(prepared)constforgedBytes=awaitforger.forge(forgeable)constres=awaitdfnsClient.wallets.broadcastTransaction({ walletId, body: { kind:'Transaction', transaction:`0x${forgedBytes}`, },})