Skip to content

Commit 3d96f59

Browse files
authored
Merge pull request #1179 from aeternity/release/8.0.0-beta.2
Release 8.0.0 beta.2
2 parents 9a6b670 + 5ed37ec commit 3d96f59

File tree

11 files changed

+38
-89
lines changed

11 files changed

+38
-89
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## [8.0.0-beta.2](https://github.com/aeternity/aepp-sdk-js/compare/8.0.0-beta.1...8.0.0-beta.2) (2021-05-12)
2+
3+
4+
### Bug Fixes
5+
6+
* revert conversion of case in calls to compiler ([0a69e49](https://github.com/aeternity/aepp-sdk-js/commit/0a69e4979b20bdd5ee954e2860fdc827f808eb8f))
7+
8+
### Maintenance
9+
10+
* avoid ts definitions based on broken JsDoc ([572d19f](https://github.com/aeternity/aepp-sdk-js/commit/572d19f5ae6bd549c92a1a37452c0270490b9f6e))
11+
12+
113
# [8.0.0-beta.1](https://github.com/aeternity/aepp-sdk-js/compare/7.7.0...8.0.0-beta.1) (2021-05-6)
214

315

package-lock.json

Lines changed: 7 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aeternity/aepp-sdk",
3-
"version": "8.0.0-beta.1",
3+
"version": "8.0.0-beta.2",
44
"description": "SDK for the æternity blockchain",
55
"main": "dist/aepp-sdk.js",
66
"types": "es/index.d.ts",

src/contract/aci/helpers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ export function getFunctionACI (aci, name, { external }) {
1919
bindings: [
2020
{
2121
state: aci.state,
22-
typeDefs: aci.typeDefs,
22+
type_defs: aci.type_defs,
2323
name: aci.name
2424
},
25-
...external.map(R.pick(['state', 'typeDefs', 'name']))
25+
...external.map(R.pick(['state', 'type_defs', 'name']))
2626
],
2727
event: aci.event ? aci.event.variant : []
2828
}

src/contract/aci/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ export default async function getContractInstance (source, { aci, contractAddres
6767
}
6868
const instance = {
6969
interface: R.defaultTo(null, R.prop('interface', aci)),
70-
aci: R.defaultTo(null, R.path(['encodedAci', 'contract'], aci)),
71-
externalAci: aci.externalEncodedAci ? aci.externalEncodedAci.map(a => a.contract || a.namespace) : [],
70+
aci: R.defaultTo(null, R.path(['encoded_aci', 'contract'], aci)),
71+
externalAci: aci.external_encoded_aci ? aci.external_encoded_aci.map(a => a.contract || a.namespace) : [],
7272
source,
7373
compiled: null,
7474
deployInfo: { address: contractAddress },

src/contract/aci/transformation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export function linkTypeDefs (t, bindings) {
119119
const [root, typeDef] = typeof t === 'object' ? Object.keys(t)[0].split('.') : t.split('.')
120120
const contractTypeDefs = bindings.find(c => c.name === root)
121121
const aciType = [
122-
...contractTypeDefs.typeDefs,
122+
...contractTypeDefs.type_defs,
123123
{ name: 'state', typedef: contractTypeDefs.state, vars: [] }
124124
].find(({ name }) => name === typeDef)
125125
if (aciType.vars.length) {

src/contract/compiler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default AsyncInit.compose(ContractBase, {
5252
compilerUrl = compilerUrl.replace(/\/$/, '')
5353
const client = await genSwaggerClient(`${compilerUrl}/api`, {
5454
disableBigNumbers: true,
55-
keysOfValuesToIgnore: ['fileSystem', 'arguments']
55+
disableCaseConversion: true
5656
})
5757
this.compilerVersion = client.spec.info.version
5858
this._compilerApi = client.api
@@ -67,7 +67,7 @@ export default AsyncInit.compose(ContractBase, {
6767
if (!this._compilerApi) throw new Error('Compiler is not ready')
6868
},
6969
_prepareCompilerOptions ({ filesystem = {} } = {}) {
70-
return { fileSystem: filesystem }
70+
return { file_system: filesystem }
7171
},
7272
getCompilerVersion () {
7373
this._ensureCompilerReady()

src/utils/other.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,19 @@ export const filterObject = (object, fn) => Object.fromEntries(Object.entries(ob
1212
* @rtype (fn: (s: String) => String) => (o: Object) => Object
1313
* @param {Function} fn - Key transformation function
1414
* @param {Object} object - Object to traverse
15-
* @param {Array} [keysOfValuesToIgnore] - Workaround to fix serialisation
1615
* @return {Object} Transformed object
1716
*/
18-
export const traverseKeys = (fn, object, keysOfValuesToIgnore = []) => {
17+
export const traverseKeys = (fn, object) => {
1918
if (typeof object !== 'object' || object === null) return object
20-
if (Array.isArray(object)) return object.map(i => traverseKeys(fn, i, keysOfValuesToIgnore))
21-
return mapObject(object, ([key, value]) => [
22-
fn(key),
23-
keysOfValuesToIgnore.includes(key) ? value : traverseKeys(fn, value, keysOfValuesToIgnore)
24-
])
19+
if (Array.isArray(object)) return object.map(i => traverseKeys(fn, i))
20+
return mapObject(object, ([key, value]) => [fn(key), traverseKeys(fn, value)])
2521
}
2622

2723
/**
2824
* snake_case key traversal
2925
* @static
3026
* @rtype (o: Object) => Object
3127
* @param {Object} object - Object to traverse
32-
* @param {Array} keysOfValuesToIgnore
3328
* @return {Object} Transformed object
3429
* @see pascalToSnake
3530
*/
@@ -40,7 +35,6 @@ export const snakizeKeys = traverseKeys.bind(null, pascalToSnake)
4035
* @static
4136
* @rtype (o: Object) => Object
4237
* @param {Object} object - Object to traverse
43-
* @param {Array} keysOfValuesToIgnore
4438
* @return {Object} Transformed object
4539
* @see snakeToPascal
4640
*/

src/utils/swagger.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ import { snakizeKeys, pascalizeKeys, mapObject, filterObject } from './other'
3636
* @param {String} [options.spec] - Override OpenAPI definition
3737
* @param {String} [options.internalUrl] - Node internal URL
3838
* @param {Boolean} [options.disableBigNumbers]
39-
* @param {Boolean} [options.keysOfValuesToIgnore] TODO: Convert keys according to Swagger definitions instead
39+
* @param {Boolean} [options.disableCaseConversion]
4040
* @return {Object} Swagger client
4141
* @example (await genSwaggerClient('https://mainnet.aeternity.io/api')).getAccountByPubkey('ak_jupBUgZNbcC4krDLR3tAkw1iBZoBbkNeShAq4atBtpFWmz36r')
4242
*/
43-
export default async (specUrl, { spec, internalUrl, disableBigNumbers, keysOfValuesToIgnore } = {}) => {
43+
export default async (specUrl, { spec, internalUrl, disableBigNumbers, disableCaseConversion } = {}) => {
4444
spec = spec || await (await fetch(specUrl)).json()
4545
const jsonImp = disableBigNumbers ? JSON : JsonBig
4646

@@ -69,8 +69,10 @@ export default async (specUrl, { spec, internalUrl, disableBigNumbers, keysOfVal
6969
},
7070
responseInterceptor: response => {
7171
if (!response.text) return response
72-
const body = pascalizeKeys(jsonImp.parse(response.text), keysOfValuesToIgnore)
73-
return Object.assign(response, { body })
72+
const body = jsonImp.parse(response.text)
73+
return Object.assign(response, {
74+
body: disableCaseConversion ? body : pascalizeKeys(body)
75+
})
7476
}
7577
})
7678
}))
@@ -107,7 +109,7 @@ export default async (specUrl, { spec, internalUrl, disableBigNumbers, keysOfVal
107109
if (typeof value !== 'object') return [param, value]
108110
const rootKeys = Object.keys(parameters.find(p => p.name === param).schema.properties)
109111
const filteredValue = filterObject(
110-
snakizeKeys(value, keysOfValuesToIgnore),
112+
disableCaseConversion ? value : snakizeKeys(value),
111113
([key]) => rootKeys.includes(key)
112114
)
113115
return [param, jsonImp.stringify(filteredValue)]

test/unit/other.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,17 @@ describe('Other utils', function () {
3030
c: [3, {
3131
ca: 4
3232
}],
33-
t: {
34-
f: 6
35-
},
3633
d: null
3734
}
3835

39-
expect(traverseKeys(k => 'x' + k, input, ['t'])).to.deep.equal({
36+
expect(traverseKeys(k => 'x' + k, input)).to.deep.equal({
4037
xa: 1,
4138
xb: {
4239
xba: 2
4340
},
4441
xc: [3, {
4542
xca: 4
4643
}],
47-
xt: {
48-
f: 6
49-
},
5044
xd: null
5145
})
5246
})

0 commit comments

Comments
 (0)