From 0150ea1287b3dccf8d020751bd7c77db61f4b49b Mon Sep 17 00:00:00 2001 From: lllwvlvwlll Date: Wed, 17 May 2023 08:13:02 -0600 Subject: [PATCH] create chest defect --- sdk/src/api/chest.ts | 9 +++------ sdk/src/interface/interface.ts | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/sdk/src/api/chest.ts b/sdk/src/api/chest.ts index 8f11dc0..d5becf8 100644 --- a/sdk/src/api/chest.ts +++ b/sdk/src/api/chest.ts @@ -19,22 +19,20 @@ export class ChestAPI { const cases = eligibilityCases.map( (eligibilityCase: EligibilityCase) => { const attributes = eligibilityCase.attributes.map( (attr: EligibilityAttribute) => { - let value = sc.ContractParam.byteArray('') switch (typeof attr.value) { - case "string": + case typeof "a": value = sc.ContractParam.string(attr.value) - case "number": + break + case typeof 1: value = sc.ContractParam.integer(attr.value) } - return sc.ContractParam.array( sc.ContractParam.string(attr.logic), sc.ContractParam.string(attr.key), value ) }) - return sc.ContractParam.array( sc.ContractParam.hash160(eligibilityCase.scriptHash), sc.ContractParam.array(...attributes) @@ -46,7 +44,6 @@ export class ChestAPI { sc.ContractParam.integer(chestType), sc.ContractParam.array(...cases), ]; - const res = await variableInvoke(node, networkMagic, contractHash, method, param, signer) if (signer) { return res diff --git a/sdk/src/interface/interface.ts b/sdk/src/interface/interface.ts index da625bc..234fc00 100644 --- a/sdk/src/interface/interface.ts +++ b/sdk/src/interface/interface.ts @@ -146,5 +146,5 @@ export interface EligibilityAttribute { export interface EligibilityCase { scriptHash: string, - attributes: [EligibilityAttribute] + attributes: EligibilityAttribute[] } \ No newline at end of file