Skip to content

Commit

Permalink
create chest defect
Browse files Browse the repository at this point in the history
  • Loading branch information
lllwvlvwlll committed May 17, 2023
1 parent 9c8c2dc commit 0150ea1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions sdk/src/api/chest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/interface/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,5 @@ export interface EligibilityAttribute {

export interface EligibilityCase {
scriptHash: string,
attributes: [EligibilityAttribute]
attributes: EligibilityAttribute[]
}

0 comments on commit 0150ea1

Please sign in to comment.