Skip to content

Commit

Permalink
refactor(compiler)!: remove getCompilerVersion
Browse files Browse the repository at this point in the history
use sdk.compilerVersion instead
  • Loading branch information
davidyuk committed Jan 24, 2022
1 parent 5ae9c62 commit fb929f8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 25 deletions.
11 changes: 5 additions & 6 deletions docs/guides/connect-aepp-to-wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ async created () {
compilerUrl: COMPILER_URL,
onNetworkChange: async (params) => {
this.client.selectNode(params.networkId)
this.nodeInfoResponse = await errorAsField(this.client.getNodeInfo())
this.nodeInfoResponse = await this.client.getNodeInfo()
},
onAddressChange: async (addresses) => {
this.pub = await this.client.address()
this.balance = await this.client.balance(this.pub).catch(e => '0')
this.addressResponse = await errorAsField(this.client.address())
this.addressResponse = await this.client.address()
},
onDisconnect: () => {
this.resetState()
Expand Down Expand Up @@ -73,9 +73,8 @@ async connectToWallet (wallet) {
this.onAccount = this.pub
this.balance = await this.client.getBalance(this.pub)
this.walletName = this.client.rpcClient.info.name
this.addressResponse = await errorAsField(this.client.address())
this.heightResponse = await errorAsField(this.client.height())
this.nodeInfoResponse = await errorAsField(this.client.getNodeInfo())
this.compilerVersionResponse = await errorAsField(this.client.getCompilerVersion())
this.addressResponse = await this.client.address()
this.heightResponse = await this.client.height()
this.nodeInfoResponse = await this.client.getNodeInfo()
}
```
6 changes: 3 additions & 3 deletions examples/browser/aepp/src/Basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</div>
<div>
<div>Compiler version</div>
<Value :value="compilerVersionPromise" />
<div>{{ compilerVersion }}</div>
</div>
</div>

Expand Down Expand Up @@ -69,7 +69,7 @@ export default {
balancePromise: null,
heightPromise: null,
nodeInfoPromise: null,
compilerVersionPromise: null,
compilerVersion: '',
spendTo: '',
spendAmount: '',
spendPayload: '',
Expand All @@ -80,7 +80,7 @@ export default {
({ sdk, address, networkId }) => [sdk, address, networkId],
([sdk, address]) => {
if (!sdk) return
this.compilerVersionPromise = sdk.getCompilerVersion()
this.compilerVersion = sdk.compilerVersion
this.balancePromise = sdk.balance(address)
this.heightPromise = sdk.height()
this.nodeInfoPromise = sdk.getNodeInfo()
Expand Down
4 changes: 0 additions & 4 deletions src/contract/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ export default AsyncInit.compose(ContractBase, {
_ensureCompilerReady () {
if (!this.compilerApi) throw new UnavailableCompilerError()
},
getCompilerVersion () {
this._ensureCompilerReady()
return Promise.resolve(this.compilerVersion)
},
/**
* Encode call data for contract call
* @function
Expand Down
13 changes: 1 addition & 12 deletions src/contract/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ import { required } from '@stamp/required'
const ContractBase = stampit(required({
methods: {
contractEncodeCallDataAPI: required,
setCompilerUrl: required,
getCompilerVersion: required
setCompilerUrl: required
}
}))

Expand Down Expand Up @@ -71,14 +70,4 @@ const ContractBase = stampit(required({
* @return {void}
*/

/**
* Get Compiler Version
* @function getCompilerVersion
* @instance
* @abstract
* @category async
* @rtype () => String
* @return {String} Compiler version
*/

export default ContractBase

0 comments on commit fb929f8

Please sign in to comment.