Convert sub-objects (other than arrays) in YAML to JSON strings automatically.
All checks were successful
Tests / sdk_tests (pull_request) Successful in 4m28s
All checks were successful
Tests / sdk_tests (pull_request) Successful in 4m28s
This commit is contained in:
parent
37b69da3bb
commit
29a57930f7
@ -36,6 +36,14 @@ export const handler = async (argv: Arguments) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { record } = await yaml.load(fs.readFileSync(file, 'utf-8')) as any;
|
const { record } = await yaml.load(fs.readFileSync(file, 'utf-8')) as any;
|
||||||
|
|
||||||
|
// Convert sub-objects (other than arrays) to a JSON automatically.
|
||||||
|
for (const [k, v] of Object.entries(record)) {
|
||||||
|
if (v && typeof v === "object" && !Array.isArray(v)) {
|
||||||
|
record[k] = JSON.stringify(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
const registry = new Registry(gqlEndpoint, restEndpoint, chainId);
|
||||||
const fee = getGasAndFees(argv, cnsConfig);
|
const fee = getGasAndFees(argv, cnsConfig);
|
||||||
const result = await registry.setRecord({ privateKey: userKey, record, bondId }, txKey as string, fee);
|
const result = await registry.setRecord({ privateKey: userKey, record, bondId }, txKey as string, fee);
|
||||||
|
Loading…
Reference in New Issue
Block a user