import { Client , Provider , Receipt , Result } from "@blockstack/clarity" ; export class RocketFactoryClient extends Client { constructor ( provider ) { super ( "SP3GWX3NE58KXHESRYE4DYQ1S31PQJTCRXB3PE9SB.rocket-factory" , "rocket-tutorial/rocket-factory" , provider ) ; } async canUserBuy ( user ) { const query = this . createQuery ( { atChaintip : true , method : { name : "can-user-buy" , args : [ `'${ user }` ] } } ) ; const res = await this . submitQuery ( query ) ; return res . result === "true" ; } async canUserClaim ( user ) { const query = this . createQuery ( { atChaintip : true , method : { name : "can-user-claim" , args : [ `'${ user }` ] } } ) ; const res = await this . submitQuery ( query ) ; return res . result === "true" ; } async rocketClaimableAt ( user ) { const query = this . createQuery ( { atChaintip : true , method : { name : "rocket-claimable-at" , args : [ `'${ user }` ] } } ) ; const res = await this . submitQuery ( query ) ; return parseInt ( Result . unwrap ( res ) ) ; } async orderRocket ( size , params ) { const tx = this . createTransaction ( { method : { name : "order-rocket" , args : [ `u${ size }` ] } } ) ; await tx . sign ( params . sender ) ; const res = await this . submitTransaction ( tx ) ; return res ; } async claimRocket ( params ) { const tx = this . createTransaction ( { method : { name : "claim-rocket" , args : [ ] } } ) ; await tx . sign ( params . sender ) ; const res = await this . submitTransaction ( tx ) ; return res ; } async mineBlock ( sender ) { const tx = this . createTransaction ( { method : { name : "mine-block" , args : [ ] , } } ) ; await tx . sign ( sender ) ; return this . submitTransaction ( tx ) ; } }