Skip to content

Commit

Permalink
fix: remove compiler decodeData commend that depends on unsupported api
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed May 28, 2021
1 parent 22a361e commit e198ea2
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 37 deletions.
10 changes: 0 additions & 10 deletions bin/aecli-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,6 @@ program
.description('Encode contract call data')
.action(async (source, fn, args, ...otherArgs) => await Contract.encodeData(source, fn, args, utils.cli.getCmdFromArguments(otherArgs)))

// ## Initialize `decode data` command
//
// You can use this command to decode contract return data
//
// Example: `aecli contract decodeData cb_asdasdasdasdasdas int`
program
.command('decodeData <data> <returnType>')
.description('Decode contract data')
.action(async (data, returnType, ...args) => await Contract.decodeData(data, returnType, utils.cli.getCmdFromArguments(args)))

// ## Initialize `decode call data` command
//
// You can use this command to decode contract call data using source or bytecode
Expand Down
21 changes: 0 additions & 21 deletions bin/commands/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,6 @@ export async function encodeData (source, fn, args = [], options) {
}
}

// ## Function which compile your `source` code
export async function decodeData (data, type, options) {
try {
const client = await initCompiler(options)

await handleApiError(async () => {
// Call `node` API which return `compiled code`
const decodedData = await client.contractDecodeDataAPI(type, data)
if (options.json) {
print(JSON.stringify({ decodedData }))
} else {
print('Contract bytecode:')
print(decodedData)
}
})
} catch (e) {
printError(e.message)
}
}

// ## Function which compile your `source` code
export async function decodeCallData (data, options) {
const { sourcePath, code, fn, backend } = options
Expand Down Expand Up @@ -236,6 +216,5 @@ export const Contract = {
deploy,
call,
encodeData,
decodeData,
decodeCallData
}
6 changes: 0 additions & 6 deletions test/cli/contract.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const testContract = `contract Identity =
entrypoint main(x : int, y: int) = x + y
`

const encodedNumber3 = 'cb_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPJ9AW0'
const CALL_DATA = 'cb_KxG4F37sKwIEFmEjaA=='
const DECODED_CALL_DATA = { arguments: [{ type: 'int', value: 1 }, { type: 'int', value: 2 }], function: 'main' }

Expand Down Expand Up @@ -76,11 +75,6 @@ describe('CLI Contract Module', function () {
return Promise.resolve(decoded).should.eventually.become(DECODED_CALL_DATA)
})

it('Decode Data', async () => {
const { decodedData } = JSON.parse(await exec(['contract', 'decodeData', encodedNumber3, 'int', '--json']))
decodedData.value.should.be.equal(3)
})

it('Deploy Contract', async () => {
// Create contract file
fs.writeFileSync(contractFile, testContract)
Expand Down

0 comments on commit e198ea2

Please sign in to comment.