1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8cc3ea6e-24aa-43f8-8f83-e9a5754aa8be",e._sentryDebugIdIdentifier="sentry-dbid-8cc3ea6e-24aa-43f8-8f83-e9a5754aa8be")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[839],{70839:function(e,t,n){n.r(t),n.d(t,{EvmTBTCBridge:function(){return c}});var a=n(23507),r=n(88605),i=n(35447),s=n(71469),o=n(18089);class c{network;chain;provider;contracts;chainId;core;gatewayAddress;gateway;tbtcTokenAddr;constructor(e,t,n,s){if(this.network=e,this.chain=t,this.provider=n,this.contracts=s,"Mainnet"!==this.network)throw new Error("TBTC is only supported on Mainnet");if(!this.contracts.tbtc)throw new Error("TBTC contract address is required");const o=a.T.getNativeTbtcToken(this.chain);if(!o)throw new Error("Native tbtc token not found");this.chainId=a.m.get(e,t),this.core=new r.EvmWormholeCore(e,t,n,s),this.gatewayAddress=this.contracts.tbtc,this.gateway=new i.C(this.gatewayAddress,["function sendTbtc(uint256 amount, uint16 recipientChain, bytes32 recipient, uint256 arbiterFee, uint32 nonce) payable returns (uint64)","function receiveTbtc(bytes calldata encodedVm)"],n),this.tbtcTokenAddr=(0,a._)(o)}static async fromRpc(e,t){const[n,a]=await s.E.chainFromRpc(e),r=t[a];if(r.network!==n)throw new Error(`Network mismatch: ${r.network} != ${n}`);return new c(n,a,e,r.contracts)}async*transfer(e,t,n){const r=new a.aB(e).toString(),i=await this.gateway.sendTbtc.populateTransaction(n,(0,a.az)(t.chain),t.address.toUniversalAddress().toUint8Array(),0n,0n);i.value=await this.core.getMessageFee(),yield*this.approve(r,n,this.gatewayAddress),yield this.createUnsignedTransaction((0,a.aE)(i,r),"TBTCBridge.Send")}async*redeem(e,t){if("GatewayTransfer"!==t.payloadName)throw new Error("Invalid VAA payload");const n=new a.aB(e).toString(),r=await this.gateway.receiveTbtc.populateTransaction((0,a.aG)(t));yield this.createUnsignedTransaction((0,a.aE)(r,n),"TBTCBridge.Redeem")}async*approve(e,t,n){const r=s.E.getTokenImplementation(this.provider,this.tbtcTokenAddr);if(await r.allowance(e,n)<t){const i=await r.approve.populateTransaction(n,t);yield this.createUnsignedTransaction((0,a.aE)(i,e),"TBTC.Approve")}}createUnsignedTransaction(e,t){return new o.E((0,a.aF)(e,this.chainId),this.network,this.chain,t,!1)}}(0,a.aH)(a.aI,"TBTCBridge",c)}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.