import { Client , Provider , Receipt , Result } from "@blockstack/clarity" ; export class FungibleTokenClient extends Client { constructor ( provider ) { super ( "SP3GWX3NE58KXHESRYE4DYQ1S31PQJTCRXB3PE9SB.fungible-token" , "tokens/fungible-token" , provider ) ; } async transfer ( to , value , params ) { const tx = this . createTransaction ( { method : { name : "transfer" , args : [ `'${ to }` , `u${ value }` ] } } ) ; await tx . sign ( params . sender ) ; const res = await this . submitTransaction ( tx ) ; return res ; } async balanceOf ( owner ) { const query = this . createQuery ( { method : { name : "balance-of" , args : [ `'${ owner }` ] } } ) ; const res = await this . submitQuery ( query ) ; return Result . unwrapUInt ( res ) ; } async approve ( spender , amount , params ) { const tx = this . createTransaction ( { method : { name : "approve" , args : [ `'${ spender }` , `u${ amount }` ] } } ) ; await tx . sign ( params . sender ) ; const res = await this . submitTransaction ( tx ) ; return res ; } async revoke ( spender , params ) { const tx = this . createTransaction ( { method : { name : "revoke" , args : [ `'${ spender }` ] } } ) ; await tx . sign ( params . sender ) ; const res = await this . submitTransaction ( tx ) ; return res ; } async allowanceOf ( spender , owner ) { const query = this . createQuery ( { method : { name : "get-allowance-of" , args : [ `'${ spender }` , `'${ owner }` ] } } ) ; const res = await this . submitQuery ( query ) ; return Result . unwrapUInt ( res ) ; } async transferFrom ( from , to , value , params ) { const tx = this . createTransaction ( { method : { name : "transfer-from" , args : [ `'${ from }` , `'${ to }` , `u${ value }` ] } } ) ; await tx . sign ( params . sender ) ; const res = await this . submitTransaction ( tx ) ; return res ; } }