From aca64fd2a0fb5e417b86d03c6c3b9c0178d9d55f Mon Sep 17 00:00:00 2001 From: lllwvlvwlll Date: Mon, 30 May 2022 16:57:57 -0600 Subject: [PATCH 1/9] simple chest --- contracts/chest/__init__.py | 0 contracts/chest/chest.manifest.json | 249 +++++++++ contracts/chest/chest.nef | Bin 0 -> 4184 bytes contracts/chest/chest.py | 563 +++++++++++++++++++++ parameters/generators/2_paper_puppet.json | 34 ++ parameters/generators/3_golden_puppet.json | 25 + sdk/dist/Chest.d.ts | 43 ++ sdk/dist/Chest.js | 113 +++++ sdk/dist/Chest.js.map | 1 + sdk/dist/api/chest.d.ts | 9 + sdk/dist/api/chest.js | 83 +++ sdk/dist/api/chest.js.map | 1 + sdk/dist/api/index.d.ts | 1 + sdk/dist/api/index.js | 1 + sdk/dist/api/index.js.map | 2 +- sdk/dist/index.d.ts | 1 + sdk/dist/index.js | 1 + sdk/dist/index.js.map | 2 +- sdk/src/Chest.ts | 122 +++++ sdk/src/api/chest.ts | 142 ++++++ sdk/src/api/index.ts | 1 + sdk/src/index.ts | 1 + sdk/test/integration/chest.js | 364 +++++++++++++ 23 files changed, 1757 insertions(+), 2 deletions(-) create mode 100644 contracts/chest/__init__.py create mode 100644 contracts/chest/chest.manifest.json create mode 100644 contracts/chest/chest.nef create mode 100644 contracts/chest/chest.py create mode 100644 parameters/generators/2_paper_puppet.json create mode 100644 parameters/generators/3_golden_puppet.json create mode 100644 sdk/dist/Chest.d.ts create mode 100644 sdk/dist/Chest.js create mode 100644 sdk/dist/Chest.js.map create mode 100644 sdk/dist/api/chest.d.ts create mode 100644 sdk/dist/api/chest.js create mode 100644 sdk/dist/api/chest.js.map create mode 100644 sdk/src/Chest.ts create mode 100644 sdk/src/api/chest.ts create mode 100644 sdk/test/integration/chest.js diff --git a/contracts/chest/__init__.py b/contracts/chest/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/contracts/chest/chest.manifest.json b/contracts/chest/chest.manifest.json new file mode 100644 index 0000000..43f74ae --- /dev/null +++ b/contracts/chest/chest.manifest.json @@ -0,0 +1,249 @@ +{ + "name": "chest", + "groups": [], + "abi": { + "methods": [ + { + "name": "create_chest", + "offset": 177, + "parameters": [ + { + "name": "name", + "type": "ByteArray" + }, + { + "name": "chest_type", + "type": "Integer" + }, + { + "name": "eligible_epochs", + "type": "Array" + }, + { + "name": "puppet_traits", + "type": "Array" + } + ], + "returntype": "ByteArray", + "safe": false + }, + { + "name": "loot_chest_with_puppet", + "offset": 283, + "parameters": [ + { + "name": "chest_id", + "type": "ByteArray" + }, + { + "name": "puppet_id", + "type": "ByteArray" + } + ], + "returntype": "Map", + "safe": false + }, + { + "name": "loot_chest_as_owner", + "offset": 473, + "parameters": [ + { + "name": "chest_id", + "type": "ByteArray" + } + ], + "returntype": "Map", + "safe": false + }, + { + "name": "is_puppet_eligible", + "offset": 584, + "parameters": [ + { + "name": "chest_id", + "type": "ByteArray" + }, + { + "name": "puppet_id", + "type": "ByteArray" + } + ], + "returntype": "Boolean", + "safe": false + }, + { + "name": "get_chest_json", + "offset": 803, + "parameters": [ + { + "name": "chest_id", + "type": "ByteArray" + } + ], + "returntype": "Map", + "safe": false + }, + { + "name": "get_chest", + "offset": 817, + "parameters": [ + { + "name": "chest_id", + "type": "ByteArray" + } + ], + "returntype": "Array", + "safe": false + }, + { + "name": "get_chest_raw", + "offset": 880, + "parameters": [ + { + "name": "chest_id", + "type": "ByteArray" + } + ], + "returntype": "ByteArray", + "safe": false + }, + { + "name": "total_chests", + "offset": 908, + "parameters": [], + "returntype": "Integer", + "safe": false + }, + { + "name": "onNEP11Payment", + "offset": 962, + "parameters": [ + { + "name": "from_address", + "type": "Hash160" + }, + { + "name": "amount", + "type": "Integer" + }, + { + "name": "token_id", + "type": "ByteArray" + }, + { + "name": "data", + "type": "Any" + } + ], + "returntype": "Void", + "safe": false + }, + { + "name": "onNEP17Payment", + "offset": 1061, + "parameters": [ + { + "name": "from_address", + "type": "Hash160" + }, + { + "name": "amount", + "type": "Integer" + }, + { + "name": "data", + "type": "Any" + } + ], + "returntype": "Void", + "safe": false + }, + { + "name": "update", + "offset": 1292, + "parameters": [ + { + "name": "script", + "type": "ByteArray" + }, + { + "name": "manifest", + "type": "ByteArray" + }, + { + "name": "data", + "type": "Any" + } + ], + "returntype": "Void", + "safe": false + }, + { + "name": "_deploy", + "offset": 1416, + "parameters": [ + { + "name": "data", + "type": "Any" + }, + { + "name": "update", + "type": "Boolean" + } + ], + "returntype": "Void", + "safe": false + }, + { + "name": "_initialize", + "offset": 1454, + "parameters": [], + "returntype": "Void", + "safe": false + } + ], + "events": [ + { + "name": "NewChest", + "parameters": [ + { + "name": "ChestId", + "type": "ByteArray" + } + ] + }, + { + "name": "ChestOpened", + "parameters": [ + { + "name": "ChestId", + "type": "ByteArray" + } + ] + }, + { + "name": "Debug", + "parameters": [ + { + "name": "debug", + "type": "Any" + } + ] + } + ] + }, + "permissions": [ + { + "contract": "*", + "methods": "*" + } + ], + "trusts": [], + "features": {}, + "supportedstandards": [], + "extra": { + "Author": "COZ, Inc.", + "Description": "A public smart contract for holding things", + "Email": "contact@coz.io" + } +} \ No newline at end of file diff --git a/contracts/chest/chest.nef b/contracts/chest/chest.nef new file mode 100644 index 0000000000000000000000000000000000000000..af65d199731f5d3d245293c945b44471bf56c49c GIT binary patch literal 4184 zcmbVPU2Ggz6`oytZP%ILUE4_^LdwmOZjBY2n0lHfM8a0GA#v*1O$_c2Xg%J!-nqN8 zGqW?Z_KZUxkf0Cz2nhrMHA*7ELlw#kZB-sna9so;z>)`qlCDxgMJe>9eLw}ZNz8Ze z%&vdph=zUGd*}X~^PO|Qd(OEhvPT{=srAsntfi9KfE=25a$xV^(9qzg2lq<%^1IcM zoNj5|_UbFy{_NhD@*l0TfdTgA=8>1(d)ZLrrTOa2OjI# zYwJB@KkVvH9KUj|R=Mn)PNqM3{CIQ3EqO&F+59w8&FZ)!0$Lg7Y^yv^+vxJv(z#)#eJna4wndp6}GC-2~tZt<*owta(30W(G*?FlzT6H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ih{K$WEITH5HL_HW+E!k7!&JQ04j)5^D$H~JZG7cN zL@;SyT7P@(s;%Q~)q-B~<^A|iolkb-H6^1I)N-@bTc8wAsiDgIuV47X?gy0{nGW-3 zZHY@4{=8ij2)52&r@rzyYETD&aT;4hqMty>L+!;MZ$fIl&sRRU#p_t?@RcOiXT^lC zJcr@zqOUxSG0#YyL-$!e9Tb&)pjj1XmWT&(yD$!KD_e(wW7m&n+9rROet2x`df()g zf-zU>M*F0Js3>9mvSo=Yy{TN>zJyl=NW>MSV2|Nf$jpv?Q@|8<41MrvR t#9=yHEeO*M6uLrHRF=VFJXX&6%8NI-fx;CDZhlCJs4^URCiVQ`{{kC5)Ykw2 literal 0 HcmV?d00001 diff --git a/contracts/chest/chest.py b/contracts/chest/chest.py new file mode 100644 index 0000000..bf7fd42 --- /dev/null +++ b/contracts/chest/chest.py @@ -0,0 +1,563 @@ +from typing import Any, Dict, cast, List +from boa3.builtin.type import UInt160 +from boa3.builtin import CreateNewEvent, NeoMetadata, metadata, public, contract +from boa3.builtin.interop.blockchain import Transaction +from boa3.builtin.interop.runtime import script_container, calling_script_hash, executing_script_hash +from boa3.builtin.interop.contract import call_contract, update_contract +from boa3.builtin.interop.storage import get, put +from boa3.builtin.interop.stdlib import serialize, deserialize + + +OWNER_KEY = b'!OWNER' +CHEST_KEY = b'c' +RESERVOIR_KEY = b'r' + +TOTAL_CHESTS = b'!TOTAL_CHESTS' +RESERVOIR_WRITE_POINTER = b'!RWRITE_POINTER' + + +@metadata +def manifest_metadata() -> NeoMetadata: + """ + Defines this smart contract's metadata information + """ + meta = NeoMetadata() + meta.author = "COZ, Inc." + meta.description = "A public smart contract for holding things" + meta.email = "contact@coz.io" + meta.supported_standards = [] + return meta + +NewChest = CreateNewEvent( + [ + ('ChestId', bytes), + ], + 'NewChest' +) + +ChestOpened = CreateNewEvent( + [ + ('ChestId', bytes), + ('Contents', [Dict[str, Any]]) + ], + 'ChestOpened' +) + +################## +################## +# Loot +################## +################## + + +class ReservoirItem: + def __init__(self): + self._id: bytes = b'' + self._script_hash: UInt160 = '' + self._type: str = '' + self._quantity: int = 0 + self._token_id: bytes = b'' + + def set_id(self, id: bytes) -> bool: + self._id = id + return True + + def set_type(self, type: str) -> bool: + self._type = type + return True + + def set_script_hash(self, script_hash: UInt160) -> bool: + self._script_hash = script_hash + return True + + def set_quantity(self, quantity: int) -> bool: + self._quantity = quantity + return True + + def set_token_id(self, token_id: bytes) -> bool: + self._token_id = token_id + return True + + def transfer(self, destination: UInt160) -> Any: + params: List = [] + if self._type == 'NEP-11': + params = [destination, self._token_id, []] + if self._type == 'NEP-17': + params = [executing_script_hash, destination, self._quantity, []] + return call_contract(self._script_hash, "transfer", params) + + def format(self) -> Dict[str, Any]: + return { + 'type': self._type, + 'scriptHash': self._script_hash, + 'tokenId': self._token_id, + 'quantity': self._quantity + } + +def create_reservoir_item(type: str, script_hash: UInt160, quantity: int, token_id: bytes ) -> bytes: + """ + creates a new chest + :param author: The author of the chest + :param name: The name of the chest + :param chest_type: The type of chest being created + :return: The chest id + """ + reservoir_item: ReservoirItem = ReservoirItem() + reservoir_id: bytes = (reservoir_write_pointer() + 1).to_bytes() + reservoir_item.set_id(reservoir_id) + reservoir_item.set_type(type) + reservoir_item.set_script_hash(script_hash) + reservoir_item.set_quantity(quantity) + reservoir_item.set_token_id(token_id) + + + key: bytes = mk_reservoir_key(reservoir_id) + put(key, serialize(reservoir_item)) + put(RESERVOIR_WRITE_POINTER, reservoir_id) + return reservoir_id + + +def reservoir_write_pointer() -> int: + total: bytes = get(RESERVOIR_WRITE_POINTER) + if len(total) == 0: + return 0 + return total.to_int() + + +@public +def create_chest(name: bytes, chest_type: int, eligible_epochs: [int], puppet_traits: [bytes]) -> bytes: + """ + Creates a new collection + :param name: The name of the chest + :param chest_type: The type of chest to create + :return: The chest id + """ + tx = cast(Transaction, script_container) + owner: UInt160 = tx.sender + + traits: Dict[str, str] = {} + for raw_trait in puppet_traits: + raw_trait_str: [str] = cast(List[str], raw_trait) + traits[raw_trait_str[0]] = raw_trait_str[1] + + chest_id: bytes = create_chest_internal(owner, name, chest_type, eligible_epochs, traits) + NewChest(chest_id) + return chest_id + + +@public +def loot_chest_with_puppet(chest_id: bytes, puppet_id: bytes) -> Dict[str, Any]: + + chest: Chest = get_chest(chest_id) + + tx = cast(Transaction, script_container) + signer: UInt160 = tx.sender + + puppet_json: Dict[str, Any] = ContractPuppet.get_puppet_json(puppet_id) + owner_uint: UInt160 = cast(UInt160, puppet_json['owner']) + assert owner_uint == signer, "You do not own this puppet" + + assert chest.is_puppet_eligible(puppet_json), "Ineligible Puppet" + + proceeds: ReservoirItem = chest.loot(signer, cast(bytes, puppet_json['tokenId'])) + + # return the loot proceeds here + return proceeds.format() + + +@public +def loot_chest_as_owner(chest_id: bytes) -> Dict[str, Any]: + chest: Chest = get_chest(chest_id) + owner: UInt160 = chest.get_author() + + tx = cast(Transaction, script_container) + signer: UInt160 = tx.sender + + assert signer == owner, "Signer is not the current owner of this chest" + + proceeds: ReservoirItem = chest.loot(signer, owner) + + return proceeds.format() + + +@public +def is_puppet_eligible(chest_id: bytes, puppet_id: bytes) -> bool: + chest: Chest = get_chest(chest_id) + puppet_json: Dict[str, Any] = ContractPuppet.get_puppet_json(puppet_id) + return chest.is_puppet_eligible(puppet_json) + +################################ + +class Chest: + """ + Chests: + + The chest type primarily changes the eligibilty settings in this release. + * Chest type 0: default and allows infinite minting from a chest as long as the looter is eligible + * Chest type 1: allows a single looting event as long as the looter is eligible + + Chest sampling using a ** reservoir mechanic for efficient non-repeating sampling. + * When loot is added to the chest, it is given a unique global incremental "reservoir_id" and stored using the + "reservoir_id" as the key. The "reservoir_id" is logged as the "reservoir_write_pointer" and always represents + the max index for the reservoir. + * The "reservoir_id" is also stored as the value under a separate incrementing "loot_id". New values are always + appended + * A "loot_available" value tracks the height of `loot_id` values and is used to determine the new "loot_id" of + added loot. + * When loot is added, a new entry for `loot_id` is added and the `loot_available` increases. + * When loot is removed, the `reservoir_id` at index `loot_available - 1` replaces the `reservoir_id` at the looted + index and the `loot_available` decreases by 1. + * This double pointer approach makes sampling cost uniform and cost efficient. + * The number of lootings is equal to `reservoir_write_pointer` - `loot_available` + """ + + def __init__(self): + # metadata + self._id: bytes = b'' + self._author: UInt160 = b'' + self._name: bytes = b'' + self._type: int = 0 + + # eligibility + self._eligible_epochs: [int] = [] + self._puppet_traits: Dict[str, str] = {} + + # looting + self._loot_available: int = 0 + + def get_id(self) -> bytes: + return self._id + + def get_author(self) -> UInt160: + return self._author + + def get_type(self) -> int: + return self._type + + def get_loot_available(self) -> int: + total: bytes = get(mk_chest_key(self._id) + b'la') + if len(total) == 0: + return 0 + total_int: int = total.to_int() + self._loot_available = total_int + return total_int + + def set_loot_available(self, amount: int) -> bool: + self._loot_available = amount + put(mk_chest_key(self._id) + b'la', amount) + return True + + def get_loot_key(self, loot_id: bytes) -> bytes: + return mk_chest_key(self._id) + b'l' + loot_id + + def get_reservoir_id_from_loot_id(self, loot_id: bytes) -> bytes: + loot_id_key: bytes = self.get_looter_key(loot_id) + return get(loot_id_key) + + def set_loot_id(self, loot_id: bytes, reservoir_id: bytes) -> bool: + loot_id_key: bytes = self.get_looter_key(loot_id) + put(loot_id_key, reservoir_id) + return True + + def get_reservoir_value_from_loot_id(self, loot_id: bytes) -> ReservoirItem: + reservoir_id: bytes = self.get_reservoir_id_from_loot_id(loot_id) + reservoir_value_bytes: bytes = get(mk_reservoir_key(reservoir_id)) + + reservoir_item: ReservoirItem = cast(ReservoirItem, deserialize(reservoir_value_bytes)) + return reservoir_item + + def get_looter_key(self, looter_id: bytes) -> bytes: + return mk_chest_key(self._id) + b'L' + looter_id + + def get_looter_yield(self, looter_id: bytes) -> int: + key: bytes = self.get_looter_key(looter_id) + yield_bytes: bytes = get(key) + if len(yield_bytes) == 0: + return 0 + return yield_bytes.to_int() + + def set_looter_yield(self, looter_id: bytes, amount: int) -> bool: + key: bytes = self.get_looter_key(looter_id) + put(key, amount.to_bytes()) + return True + + def set_author(self, author: UInt160) -> bool: + self._author = author + return True + + def set_id(self, chest_id: bytes) -> bool: + self._id = chest_id + return True + + def set_eligible_epochs(self, eligible_epochs: [int]) -> bool: + self._eligible_epochs = eligible_epochs + return True + + def set_puppet_traits(self, puppet_traits: Dict[str, str]) -> bool: + self._puppet_traits = puppet_traits + return True + + def set_name(self, name: bytes) -> bool: + self._name = name + return True + + def set_type(self, chest_type: int) -> bool: + self._type = chest_type + return True + + def export(self) -> Dict[str, Any]: + exported = { + 'id': self._id, + 'author': self._author, + 'name': self._name, + 'type': self._type, + 'eligible_epochs': self._eligible_epochs, + 'puppet_traits': self._puppet_traits, + 'loot_available': self._loot_available + } + return exported + + def loot(self, destination: UInt160, looter_id: bytes) -> ReservoirItem: + assert self._loot_available > 0 + loot_id: int = ContractDice.rand_between(0, self._loot_available - 1) + loot_id_bytes: bytes = loot_id.to_bytes() + + chest_loot: ReservoirItem = self.get_reservoir_value_from_loot_id(loot_id_bytes) + + ChestOpened(self._id) + + # replace the sampled loot_id pointer with the last loot_id pointer to defrag the storage + last_reservoir_id: bytes = self.get_reservoir_id_from_loot_id((self._loot_available - 1).to_bytes()) + self.set_loot_id(loot_id.to_bytes(), last_reservoir_id) + + # decrement loot available write pointer + self.set_loot_available(self._loot_available - 1) + + # update looter yield + yield_amount: int = self.get_looter_yield(looter_id) + self.set_looter_yield(looter_id, yield_amount + 1) + x: bool = chest_loot.transfer(destination) + return chest_loot + + def is_puppet_eligible(self, puppet: Dict[str, Any]) -> bool: + + epoch: int = cast(int, puppet['epochId']) + + # verify the puppet epoch is eligible + if epoch not in self._eligible_epochs: + return False + + traits: Dict[str, Any] = cast(Dict[str, Any], puppet['traits']) + + # check all the trait requirements for the chest + # this currently only supports a byte match for the entire trait field + for challenge_key in self._puppet_traits.keys(): + if self._puppet_traits[challenge_key] != traits[challenge_key]: + return False + + # type 0 only allows a single loot per puppet + if self._type == 0: + looter_id: bytes = cast(bytes, puppet['tokenId']) + looter_yield: int = self.get_looter_yield(looter_id) + if looter_yield != 0: + return False + + return True + + def fill_chest(self, reservoir_id: bytes) -> bool: + loot_available: int = self._loot_available + self.set_loot_available(loot_available + 1) + self.set_loot_id(loot_available.to_bytes(), reservoir_id) + return True + + +def create_chest_internal(author: UInt160, name: bytes, chest_type: int, eligible_epochs: [int], puppet_traits: Dict[str, str]) -> bytes: + """ + creates a new chest + :param author: The author of the chest + :param name: The name of the chest + :param chest_type: The type of chest being created + :return: The chest id + """ + chest: Chest = Chest() + chest_id: bytes = (total_chests() + 1).to_bytes() + chest.set_id(chest_id) + chest.set_author(author) + chest.set_name(name) + chest.set_type(chest_type) + chest.set_eligible_epochs(eligible_epochs) + chest.set_puppet_traits(puppet_traits) + + key: bytes = mk_chest_key(chest_id) + put(key, serialize(chest)) + put(TOTAL_CHESTS, chest_id) + return chest_id + + +@public +def get_chest_json(chest_id: bytes) -> Dict[str, Any]: + """ + Gets a JSON formatted collection + :param chest_id: The chest_id being requested + :return: A dictionary representing the collection + """ + chest: Chest = get_chest(chest_id) + return chest.export() + + +@public +def get_chest(chest_id: bytes) -> Chest: + """ + Gets a Collection instance + :param chest_id: The chest_id being requested + :return: A Collection class instance + """ + chest_bytes: bytes = get_chest_raw(chest_id) + chest: Chest = cast(Chest, deserialize(chest_bytes)) + x: int = chest.get_loot_available() + return chest + + +@public +def get_chest_raw(chest_id: bytes) -> bytes: + """ + Gets the raw bytes of a collection + :param chest_id: The chest_id being requested + :return: The serialized Collection class instance + """ + key: bytes = mk_chest_key(chest_id) + return get(key) + + +@public +def total_chests() -> int: + """ + Gets the total collections + :return: An integer representation of the total collections + """ + total: bytes = get(TOTAL_CHESTS) + if len(total) == 0: + return 0 + return total.to_int() + + +def mk_chest_key(chest_id: bytes) -> bytes: + return CHEST_KEY + chest_id + + +def mk_reservoir_key(reservoir_id: bytes) -> bytes: + return RESERVOIR_KEY + reservoir_id + + +############################### + + +@public +def onNEP11Payment(from_address: UInt160, amount: int, token_id: bytes, data: Any): + """ + :param from_address: the address of the one who is trying to send cryptocurrency to this smart contract + :type from_address: UInt160 + :param amount: the amount of cryptocurrency that is being sent to the this smart contract + :type amount: int + :param token_id: the token hash as bytes + :type token_id: bytes + :param data: any pertinent data that might validate the transaction + :type data: Any + """ + + ''' + Data: [ + chest_id + ] + ''' + + data_payload: [bytes] = cast(List[bytes], data) + chest: Chest = get_chest(data_payload[0]) + author: UInt160 = chest.get_author() + + assert from_address == author, "You don't have the right." + + # add to reservoir + reservoir_id = create_reservoir_item('NEP-11', calling_script_hash, amount, token_id) + # add to chest + chest.fill_chest(reservoir_id) + + +@public +def onNEP17Payment(from_address: UInt160, amount: int, data: Any): + """ + :param from_address: the address of the one who is trying to send cryptocurrency to this smart contract + :type from_address: UInt160 + :param amount: the amount of cryptocurrency that is being sent to the this smart contract + :type amount: int + :param data: any pertinent data that might validate the transaction + :type data: Any + """ + + """ + data = [ + chest_id, + amount_per_reservoir_item + ] + """ + data_payload: [bytes] = cast(List[bytes], data) + chest: Chest = get_chest(data_payload[0]) + author: UInt160 = chest.get_author() + assert from_address == author, "You don't have the right." + + amount_per_reservoir_item: int = cast(int, data_payload[1]) + assert amount >= amount_per_reservoir_item, "transfer amount is less than the amount_per_reservoir_item" + + + # fill the chests with the tokens + while amount >= amount_per_reservoir_item: + reservoir_id: bytes = create_reservoir_item('NEP-17', calling_script_hash, amount_per_reservoir_item, b'') + chest.fill_chest(reservoir_id) + amount = amount - amount_per_reservoir_item + if amount != 0: + reservoir_id: bytes = create_reservoir_item('NEP-17', calling_script_hash, amount, b'') + chest.fill_chest(reservoir_id) + + +@public +def update(script: bytes, manifest: bytes, data: Any): + """ + Updates the smart contract script + :param script: The new script to update to + :param manifest: The new manifest to update to + :param data: additional data field + :return: + :raise AssertionError: raised if the user lacks the "update" permission + """ + tx = cast(Transaction, script_container) + signer: UInt160 = tx.sender + + owner: UInt160 = get(OWNER_KEY) + + assert owner == signer, "User Permission Denied" + + update_contract(script, manifest, data) + + +@public +def _deploy(data: Any, update: bool): + if not update: + tx = cast(Transaction, script_container) + signer: UInt160 = tx.sender + put(OWNER_KEY, signer) + + +@contract('0x16d6a0be0506b26e0826dd352724cda0defa7131') +class ContractDice: + + @staticmethod + def rand_between(start: int, end: int) -> int: + pass + + +@contract('0xfefe63f07478394fbe514fda386ad8c7e2a485a0') +class ContractPuppet: + + @staticmethod + def get_puppet_json(token_id: bytes) -> Dict[str, Any]: + pass diff --git a/parameters/generators/2_paper_puppet.json b/parameters/generators/2_paper_puppet.json new file mode 100644 index 0000000..5bc8664 --- /dev/null +++ b/parameters/generators/2_paper_puppet.json @@ -0,0 +1,34 @@ +{ + "label": "Paper Puppet Generator", + "baseGeneratorFee": 1953125, + "traits": [ + { + "label": "color", + "slots": 1, + "traitLevels": [ + { + "dropScore": 1000000, + "mintMode": 0, + "traits": [ + { + "type": 0, + "maxMint": -1, + "args": { + "collectionId": 3, + "index": 0 + } + }, + { + "type": 0, + "maxMint": -1, + "args": { + "collectionId": 3, + "index": 5 + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/parameters/generators/3_golden_puppet.json b/parameters/generators/3_golden_puppet.json new file mode 100644 index 0000000..ca4c5ef --- /dev/null +++ b/parameters/generators/3_golden_puppet.json @@ -0,0 +1,25 @@ +{ + "label": "Golden Puppet Generator", + "baseGeneratorFee": 1562500, + "traits": [ + { + "label": "color", + "slots": 1, + "traitLevels": [ + { + "dropScore": 1000000, + "mintMode": 0, + "traits": [ + { + "type": 2, + "maxMint": -1, + "args": { + "value": "gold" + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/sdk/dist/Chest.d.ts b/sdk/dist/Chest.d.ts new file mode 100644 index 0000000..5dfa491 --- /dev/null +++ b/sdk/dist/Chest.d.ts @@ -0,0 +1,43 @@ +import { rpc, wallet } from '@cityofzion/neon-core'; +import { PropConstructorOptions } from "./interface"; +/** + TEMPLATE CONTRACT CLASS + Use this class template to build out the typescript interface for your smart contract. If you rename this or the + `api` equivalent, make sure to update the respective `index.ts` and rebuild. + */ +export declare class Chest { + private options; + private networkMagic; + constructor(options?: PropConstructorOptions); + /** + * DO NOT EDIT ME + * Gets the magic number for the network and configures the class instance. + */ + init(): Promise; + /** + * DO NOT EDIT ME + * The the node that the instance is connected to. + */ + get node(): rpc.RPCClient; + /** + * DO NOT EDIT ME + * The contract script hash that is being interfaced with. + */ + get scriptHash(): string; + /** + * + * EDIT ME!!! + * + * This template method is designed to be a passthough so you should really only be changing the name and parameter types. + * All the magic happens in the TemplateAPI.templateMethod. Check there to align your sdk with your smart contract. + * Create one of these pass throughs for each method you expose in your smart contract. The goal of this entire class is to + * simplify the network configuration steps which can be complicated. + */ + createChest(name: string, type: number, eligibleEpochs: [number], puppetTraits: any, signer: wallet.Account): Promise; + isPuppetEligible(chestId: string, puppetId: string, signer?: wallet.Account): Promise; + lootChestWithPuppet(chestId: string, puppetId: string, signer: wallet.Account): Promise; + lootChestWithPuppetVerified(chestId: string, puppetId: string, signer: wallet.Account): Promise; + lootChestAsOwner(chestId: string, signer: wallet.Account): Promise; + getChestJSON(chestId: string, signer?: wallet.Account): Promise; + totalChests(name: string, type: number, signer?: wallet.Account): Promise; +} diff --git a/sdk/dist/Chest.js b/sdk/dist/Chest.js new file mode 100644 index 0000000..171bc25 --- /dev/null +++ b/sdk/dist/Chest.js @@ -0,0 +1,113 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Chest = void 0; +const lodash_1 = require("lodash"); +const neon_core_1 = require("@cityofzion/neon-core"); +const api_1 = require("./api"); +const interface_1 = require("./interface"); +const helpers_1 = require("./helpers"); +const DEFAULT_OPTIONS = { + network: interface_1.NetworkOption.LocalNet +}; +/** + TEMPLATE CONTRACT CLASS + Use this class template to build out the typescript interface for your smart contract. If you rename this or the + `api` equivalent, make sure to update the respective `index.ts` and rebuild. + */ +class Chest { + // Once you get a scriptHash from deploying your smart contract via `npm run deploy`, update the `this.options.scriptHash` value. + // The default is analogous to localnet (neo-express) so you will most likely want to be updating that value. Remember to + // compile the sdk before use or your change wont take effect. Do that by running `tsc` in the sdk directory. + constructor(options = {}) { + this.options = DEFAULT_OPTIONS; + this.networkMagic = -1; + switch (options.network) { + case interface_1.NetworkOption.TestNet: + this.options.node = 'https://testnet1.neo.coz.io:443'; + this.options.scriptHash = ''; + break; + case interface_1.NetworkOption.MainNet: + this.options.node = 'https://mainnet1.neo.coz.io:443'; + this.options.scriptHash = ''; + break; + default: + this.options.node = 'http://localhost:50012'; + this.options.scriptHash = '0x3fb4df29c0c200eff40f465cd028647b8a82f002'; + break; + } + this.options = lodash_1.merge({}, this.options, options); + } + /** + * DO NOT EDIT ME + * Gets the magic number for the network and configures the class instance. + */ + async init() { + const getVersionRes = await this.node.getVersion(); + this.networkMagic = getVersionRes.protocol.network; + } + /** + * DO NOT EDIT ME + * The the node that the instance is connected to. + */ + get node() { + if (this.options.node) { + return new neon_core_1.rpc.RPCClient(this.options.node); + } + throw new Error('no node selected!'); + } + /** + * DO NOT EDIT ME + * The contract script hash that is being interfaced with. + */ + get scriptHash() { + if (this.options.scriptHash) { + return this.options.scriptHash; + } + throw new Error('node scripthash defined'); + } + /** + * + * EDIT ME!!! + * + * This template method is designed to be a passthough so you should really only be changing the name and parameter types. + * All the magic happens in the TemplateAPI.templateMethod. Check there to align your sdk with your smart contract. + * Create one of these pass throughs for each method you expose in your smart contract. The goal of this entire class is to + * simplify the network configuration steps which can be complicated. + */ + async createChest(name, type, eligibleEpochs, puppetTraits, signer) { + return api_1.ChestAPI.createChest(this.node.url, this.networkMagic, this.scriptHash, name, type, eligibleEpochs, puppetTraits, signer); + } + async isPuppetEligible(chestId, puppetId, signer) { + return api_1.ChestAPI.isPuppetEligible(this.node.url, this.networkMagic, this.scriptHash, chestId, puppetId, signer); + } + async lootChestWithPuppet(chestId, puppetId, signer) { + return api_1.ChestAPI.lootChestWithPuppet(this.node.url, this.networkMagic, this.scriptHash, chestId, puppetId, signer); + } + async lootChestWithPuppetVerified(chestId, puppetId, signer) { + const timeout = 60000; + let age = 0; + const txid = await api_1.ChestAPI.lootChestWithPuppet(this.node.url, this.networkMagic, this.scriptHash, chestId, puppetId, signer); + while (timeout >= age) { + try { + let res = await helpers_1.txDidComplete(this.node.url, txid, true); + return res[0]; + } + catch (e) { + await helpers_1.sleep(1000); + age += 1000; + } + } + throw new Error("timeout exceeded"); + } + async lootChestAsOwner(chestId, signer) { + return api_1.ChestAPI.lootChestAsOwner(this.node.url, this.networkMagic, this.scriptHash, chestId, signer); + } + async getChestJSON(chestId, signer) { + return api_1.ChestAPI.getChestJSON(this.node.url, this.networkMagic, this.scriptHash, chestId, signer); + } + async totalChests(name, type, signer) { + return api_1.ChestAPI.totalChests(this.node.url, this.networkMagic, this.scriptHash, signer); + } +} +exports.Chest = Chest; +//# sourceMappingURL=Chest.js.map \ No newline at end of file diff --git a/sdk/dist/Chest.js.map b/sdk/dist/Chest.js.map new file mode 100644 index 0000000..5fe420c --- /dev/null +++ b/sdk/dist/Chest.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Chest.js","sourceRoot":"","sources":["../src/Chest.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,qDAAiD;AACjD,+BAA2C;AAC3C,2CAAkE;AAClE,uCAA+C;AAE/C,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED;;;;GAIG;AAEH,MAAa,KAAK;IAIhB,iIAAiI;IACjI,0HAA0H;IAC1H,8GAA8G;IAC9G,YAAY,UAAkC,EAAE;QANxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAM/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,EAAE,CAAA;gBAC5B,MAAK;YACP,KAAK,yBAAa,CAAC,OAAO;gBACx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C,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,OAAe,EAAE,MAAsB;QAC5D,OAAO,cAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IACtG,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAAe,EAAE,MAAuB;QACzD,OAAO,cAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IAClG,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,IAAY,EAAE,IAAY,EAAE,MAAuB;QACnE,OAAO,cAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACxF,CAAC;CAEF;AAzGD,sBAyGC"} \ No newline at end of file diff --git a/sdk/dist/api/chest.d.ts b/sdk/dist/api/chest.d.ts new file mode 100644 index 0000000..96ac239 --- /dev/null +++ b/sdk/dist/api/chest.d.ts @@ -0,0 +1,9 @@ +import { wallet } from "@cityofzion/neon-core"; +export declare class ChestAPI { + static createChest(node: string, networkMagic: number, contractHash: string, name: string, type: number, eligibleEpochs: [number], puppetTraits: any, signer: wallet.Account): Promise; + static isPuppetEligible(node: string, networkMagic: number, contractHash: string, chestId: string, puppetId: string, signer?: wallet.Account): Promise; + static lootChestWithPuppet(node: string, networkMagic: number, contractHash: string, chestId: string, puppetId: string, signer: wallet.Account): Promise; + static lootChestAsOwner(node: string, networkMagic: number, contractHash: string, chestId: string, signer: wallet.Account): Promise; + static getChestJSON(node: string, networkMagic: number, contractHash: string, chestId: string, signer?: wallet.Account): Promise; + static totalChests(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; +} diff --git a/sdk/dist/api/chest.js b/sdk/dist/api/chest.js new file mode 100644 index 0000000..83e16b0 --- /dev/null +++ b/sdk/dist/api/chest.js @@ -0,0 +1,83 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ChestAPI = void 0; +const neon_js_1 = require("@cityofzion/neon-js"); +const helpers_1 = require("../helpers"); +class ChestAPI { + static async createChest(node, networkMagic, contractHash, name, type, eligibleEpochs, puppetTraits, signer) { + const method = "create_chest"; + const epochs = eligibleEpochs.map((value) => { + return neon_js_1.sc.ContractParam.integer(value); + }); + const traits = Object.keys(puppetTraits).map((key) => { + return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.string(key), neon_js_1.sc.ContractParam.string(puppetTraits[key])); + }); + const param = [ + neon_js_1.sc.ContractParam.string(name), + neon_js_1.sc.ContractParam.integer(type), + neon_js_1.sc.ContractParam.array(...epochs), + neon_js_1.sc.ContractParam.array(...traits) + ]; + const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return helpers_1.formatter(res[0]); + } + static async isPuppetEligible(node, networkMagic, contractHash, chestId, puppetId, signer) { + const method = "is_puppet_eligible"; + const param = [ + neon_js_1.sc.ContractParam.string(chestId), + neon_js_1.sc.ContractParam.string(puppetId), + ]; + const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return helpers_1.formatter(res[0]); + } + static async lootChestWithPuppet(node, networkMagic, contractHash, chestId, puppetId, signer) { + const method = "loot_chest_with_puppet"; + const param = [ + neon_js_1.sc.ContractParam.string(chestId), + neon_js_1.sc.ContractParam.string(puppetId), + ]; + const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return helpers_1.formatter(res[0]); + } + static async lootChestAsOwner(node, networkMagic, contractHash, chestId, signer) { + const method = "loot_chest_as_owner"; + const param = [ + neon_js_1.sc.ContractParam.string(chestId), + ]; + const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return helpers_1.formatter(res[0]); + } + static async getChestJSON(node, networkMagic, contractHash, chestId, signer) { + const method = "get_chest_json"; + const param = [ + neon_js_1.sc.ContractParam.string(chestId), + ]; + const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return helpers_1.formatter(res[0]); + } + static async totalChests(node, networkMagic, contractHash, signer) { + const method = "total_chests"; + const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return helpers_1.formatter(res[0]); + } +} +exports.ChestAPI = ChestAPI; +//# sourceMappingURL=chest.js.map \ No newline at end of file diff --git a/sdk/dist/api/chest.js.map b/sdk/dist/api/chest.js.map new file mode 100644 index 0000000..edcd382 --- /dev/null +++ b/sdk/dist/api/chest.js.map @@ -0,0 +1 @@ +{"version":3,"file":"chest.js","sourceRoot":"","sources":["../../src/api/chest.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AAEvC,wCAAqD;AAErD,MAAa,QAAQ;IAEnB,MAAM,CAAC,KAAK,CAAC,WAAW,CACtB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,IAAY,EACZ,IAAY,EACZ,cAAwB,EACxB,YAAiB,EACjB,MAAsB;QAEtB,MAAM,MAAM,GAAG,cAAc,CAAC;QAE9B,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,CAAE,CAAC,KAAK,EAAE,EAAE;YAC3C,OAAO,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACxC,CAAC,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAE,CAAC,GAAG,EAAE,EAAE;YACpD,OAAO,YAAE,CAAC,aAAa,CAAC,KAAK,CAC3B,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,EAC5B,YAAE,CAAC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,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,mBAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,WAAW,CACtB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,MAAuB;QAEvB,MAAM,MAAM,GAAG,cAAc,CAAC;QAE9B,MAAM,GAAG,GAAG,MAAM,wBAAc,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;QACtF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,mBAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;CAEF;AAzID,4BAyIC"} \ No newline at end of file diff --git a/sdk/dist/api/index.d.ts b/sdk/dist/api/index.d.ts index fc0e6a0..955f33d 100644 --- a/sdk/dist/api/index.d.ts +++ b/sdk/dist/api/index.d.ts @@ -1,4 +1,5 @@ export * from "./dice"; +export * from "./chest"; export * from "./puppet"; export * from "./interface"; export * from "./collection"; diff --git a/sdk/dist/api/index.js b/sdk/dist/api/index.js index 7126027..5a378bd 100644 --- a/sdk/dist/api/index.js +++ b/sdk/dist/api/index.js @@ -11,6 +11,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) { }; Object.defineProperty(exports, "__esModule", { value: true }); __exportStar(require("./dice"), exports); +__exportStar(require("./chest"), exports); __exportStar(require("./puppet"), exports); __exportStar(require("./interface"), exports); __exportStar(require("./collection"), exports); diff --git a/sdk/dist/api/index.js.map b/sdk/dist/api/index.js.map index 0595ee4..356f7e6 100644 --- a/sdk/dist/api/index.js.map +++ b/sdk/dist/api/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAsB;AACtB,2CAAyB;AACzB,8CAA2B;AAC3B,+CAA4B;AAC5B,8CAA2B;AAC3B,6CAA0B"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAsB;AACtB,0CAAuB;AACvB,2CAAyB;AACzB,8CAA2B;AAC3B,+CAA4B;AAC5B,8CAA2B;AAC3B,6CAA0B"} \ No newline at end of file diff --git a/sdk/dist/index.d.ts b/sdk/dist/index.d.ts index df6cefd..acedb9d 100644 --- a/sdk/dist/index.d.ts +++ b/sdk/dist/index.d.ts @@ -1,6 +1,7 @@ export * as api from "./api"; export * as helpers from "./helpers"; export * as types from "./interface"; +export * from "./Chest"; export * from "./Collection"; export * from "./Dice"; export * from "./Puppet"; diff --git a/sdk/dist/index.js b/sdk/dist/index.js index 087d2b0..0ef8bee 100644 --- a/sdk/dist/index.js +++ b/sdk/dist/index.js @@ -26,6 +26,7 @@ exports.types = exports.helpers = exports.api = void 0; exports.api = __importStar(require("./api")); exports.helpers = __importStar(require("./helpers")); exports.types = __importStar(require("./interface")); +__exportStar(require("./Chest"), exports); __exportStar(require("./Collection"), exports); __exportStar(require("./Dice"), exports); __exportStar(require("./Puppet"), exports); diff --git a/sdk/dist/index.js.map b/sdk/dist/index.js.map index 1c9d448..239deb5 100644 --- a/sdk/dist/index.js.map +++ b/sdk/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA6B;AAC7B,qDAAoC;AACpC,qDAAoC;AACpC,+CAA4B;AAC5B,yCAAsB;AACtB,2CAAwB;AACxB,8CAA2B;AAC3B,6CAA0B"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA6B;AAC7B,qDAAoC;AACpC,qDAAoC;AACpC,0CAAuB;AACvB,+CAA4B;AAC5B,yCAAsB;AACtB,2CAAwB;AACxB,8CAA2B;AAC3B,6CAA0B"} \ No newline at end of file diff --git a/sdk/src/Chest.ts b/sdk/src/Chest.ts new file mode 100644 index 0000000..2b70d35 --- /dev/null +++ b/sdk/src/Chest.ts @@ -0,0 +1,122 @@ +import {merge} from 'lodash' +import {rpc, wallet} from '@cityofzion/neon-core' +import {ChestAPI, TemplateAPI} from './api' +import {NetworkOption, PropConstructorOptions} from "./interface"; +import {sleep, txDidComplete} from "./helpers"; + +const DEFAULT_OPTIONS: PropConstructorOptions = { + network: NetworkOption.LocalNet +} + +/** + TEMPLATE CONTRACT CLASS + Use this class template to build out the typescript interface for your smart contract. If you rename this or the + `api` equivalent, make sure to update the respective `index.ts` and rebuild. + */ + +export class Chest { + private options: PropConstructorOptions = DEFAULT_OPTIONS + private networkMagic: number = -1 + + // Once you get a scriptHash from deploying your smart contract via `npm run deploy`, update the `this.options.scriptHash` value. + // The default is analogous to localnet (neo-express) so you will most likely want to be updating that value. Remember to + // compile the sdk before use or your change wont take effect. Do that by running `tsc` in the sdk directory. + constructor(options: PropConstructorOptions = {}) { + switch(options.network) { + case NetworkOption.TestNet: + this.options.node = 'https://testnet1.neo.coz.io:443' + this.options.scriptHash = '' + break + case NetworkOption.MainNet: + this.options.node = 'https://mainnet1.neo.coz.io:443' + this.options.scriptHash = '' + break + default: + this.options.node = 'http://localhost:50012' + this.options.scriptHash = '0x3fb4df29c0c200eff40f465cd028647b8a82f002' + break + } + this.options = merge({}, this.options, options) + } + + /** + * DO NOT EDIT ME + * Gets the magic number for the network and configures the class instance. + */ + async init() { + const getVersionRes = await this.node.getVersion() + this.networkMagic = getVersionRes.protocol.network + } + + /** + * DO NOT EDIT ME + * The the node that the instance is connected to. + */ + get node(): rpc.RPCClient { + if (this.options.node) { + return new rpc.RPCClient(this.options.node) + } + throw new Error('no node selected!') + } + + /** + * DO NOT EDIT ME + * The contract script hash that is being interfaced with. + */ + get scriptHash() : string { + if (this.options.scriptHash) { + return this.options.scriptHash + } + throw new Error('node scripthash defined') + } + + /** + * + * EDIT ME!!! + * + * This template method is designed to be a passthough so you should really only be changing the name and parameter types. + * All the magic happens in the TemplateAPI.templateMethod. Check there to align your sdk with your smart contract. + * Create one of these pass throughs for each method you expose in your smart contract. The goal of this entire class is to + * simplify the network configuration steps which can be complicated. + */ + async createChest(name: string, type: number, eligibleEpochs: [number], puppetTraits: any, signer: wallet.Account): Promise { + return ChestAPI.createChest(this.node.url, this.networkMagic, this.scriptHash, name, type, eligibleEpochs, puppetTraits, signer) + } + + async isPuppetEligible(chestId: string, puppetId: string, signer?: wallet.Account): Promise { + return ChestAPI.isPuppetEligible(this.node.url, this.networkMagic, this.scriptHash, chestId, puppetId, signer) + } + + async lootChestWithPuppet(chestId: string, puppetId: string, signer: wallet.Account): Promise { + return ChestAPI.lootChestWithPuppet(this.node.url, this.networkMagic, this.scriptHash, chestId, puppetId, signer) + } + + async lootChestWithPuppetVerified(chestId: string, puppetId: string, signer: wallet.Account): Promise { + const timeout = 60000 + let age = 0 + const txid = await ChestAPI.lootChestWithPuppet(this.node.url, this.networkMagic, this.scriptHash, chestId, puppetId, signer) + while (timeout >= age) { + try { + let res = await txDidComplete(this.node.url, txid, true) + return res[0] + } catch (e) { + await sleep(1000) + age += 1000 + } + } + throw new Error("timeout exceeded") + } + + async lootChestAsOwner(chestId: string, signer: wallet.Account): Promise { + return ChestAPI.lootChestAsOwner(this.node.url, this.networkMagic, this.scriptHash, chestId, signer) + } + + async getChestJSON(chestId: string, signer?: wallet.Account): Promise { + return ChestAPI.getChestJSON(this.node.url, this.networkMagic, this.scriptHash, chestId, signer) + } + + async totalChests(name: string, type: number, signer?: wallet.Account): Promise { + return ChestAPI.totalChests(this.node.url, this.networkMagic, this.scriptHash, signer) + } + +} diff --git a/sdk/src/api/chest.ts b/sdk/src/api/chest.ts new file mode 100644 index 0000000..7747f5d --- /dev/null +++ b/sdk/src/api/chest.ts @@ -0,0 +1,142 @@ +import {sc} from "@cityofzion/neon-js"; +import {wallet} from "@cityofzion/neon-core"; +import {formatter, variableInvoke} from "../helpers"; + +export class ChestAPI { + + static async createChest( + node: string, + networkMagic: number, + contractHash: string, + name: string, + type: number, + eligibleEpochs: [number], + puppetTraits: any, + signer: wallet.Account, //this field can be optional if you are doing a test invocation(you arent changing contract state and dont rely on block entropy) + ): Promise { + const method = "create_chest"; + + const epochs = eligibleEpochs.map( (value) => { + return sc.ContractParam.integer(value) + }) + + const traits = Object.keys(puppetTraits).map( (key) => { + return sc.ContractParam.array( + sc.ContractParam.string(key), + sc.ContractParam.string(puppetTraits[key]) + ) + }) + const param = [ + sc.ContractParam.string(name), + sc.ContractParam.integer(type), + sc.ContractParam.array(...epochs), + sc.ContractParam.array(...traits) + ]; + + const res = await variableInvoke(node, networkMagic, contractHash, method, param, signer) + if (signer) { + return res + } + return formatter(res[0]) + } + + static async isPuppetEligible( + node: string, + networkMagic: number, + contractHash: string, + chestId: string, + puppetId: string, + signer?: wallet.Account, //this field can be optional if you are doing a test invocation(you arent changing contract state and dont rely on block entropy) + ): Promise { + const method = "is_puppet_eligible"; + + const param = [ + sc.ContractParam.string(chestId), + sc.ContractParam.string(puppetId), + ]; + + const res = await variableInvoke(node, networkMagic, contractHash, method, param, signer) + if (signer) { + return res + } + return formatter(res[0]) + } + + static async lootChestWithPuppet( + node: string, + networkMagic: number, + contractHash: string, + chestId: string, + puppetId: string, + signer: wallet.Account, //this field can be optional if you are doing a test invocation(you arent changing contract state and dont rely on block entropy) + ): Promise { + const method = "loot_chest_with_puppet"; + + const param = [ + sc.ContractParam.string(chestId), + sc.ContractParam.string(puppetId), + ]; + + const res = await variableInvoke(node, networkMagic, contractHash, method, param, signer) + if (signer) { + return res + } + return formatter(res[0]) + } + + static async lootChestAsOwner( + node: string, + networkMagic: number, + contractHash: string, + chestId: string, + signer: wallet.Account, //this field can be optional if you are doing a test invocation(you arent changing contract state and dont rely on block entropy) + ): Promise { + const method = "loot_chest_as_owner"; + + const param = [ + sc.ContractParam.string(chestId), + ]; + + const res = await variableInvoke(node, networkMagic, contractHash, method, param, signer) + if (signer) { + return res + } + return formatter(res[0]) + } + + static async getChestJSON( + node: string, + networkMagic: number, + contractHash: string, + chestId: string, + signer?: wallet.Account, //this field can be optional if you are doing a test invocation(you arent changing contract state and dont rely on block entropy) + ): Promise { + const method = "get_chest_json"; + + const param = [ + sc.ContractParam.string(chestId), + ]; + + const res = await variableInvoke(node, networkMagic, contractHash, method, param, signer) + if (signer) { + return res + } + return formatter(res[0]) + } + + static async totalChests( + node: string, + networkMagic: number, + contractHash: string, + signer?: wallet.Account, //this field can be optional if you are doing a test invocation(you arent changing contract state and dont rely on block entropy) + ): Promise { + const method = "total_chests"; + + const res = await variableInvoke(node, networkMagic, contractHash, method, [], signer) + if (signer) { + return res + } + return formatter(res[0]) + } + +} \ No newline at end of file diff --git a/sdk/src/api/index.ts b/sdk/src/api/index.ts index dcdceaf..60a1331 100644 --- a/sdk/src/api/index.ts +++ b/sdk/src/api/index.ts @@ -1,4 +1,5 @@ export * from "./dice" +export * from "./chest" export * from "./puppet"; export * from "./interface" export * from "./collection" diff --git a/sdk/src/index.ts b/sdk/src/index.ts index 6803a49..5fcb601 100644 --- a/sdk/src/index.ts +++ b/sdk/src/index.ts @@ -1,6 +1,7 @@ export * as api from "./api"; export * as helpers from "./helpers" export * as types from "./interface" +export * from "./Chest" export * from "./Collection" export * from "./Dice" export * from "./Puppet" diff --git a/sdk/test/integration/chest.js b/sdk/test/integration/chest.js new file mode 100644 index 0000000..852987c --- /dev/null +++ b/sdk/test/integration/chest.js @@ -0,0 +1,364 @@ +const sdk = require("../../dist") +const Neon = require("@cityofzion/neon-js") +const fs = require("fs") +const crypto = require('crypto') +const process = require('process') + +var assert = require('assert'); + +describe("Basic Chest Test Suite", function() { + this.timeout(60000); + let TIME_CONSTANT = 2000 + let chest, puppet, network + + beforeEach( async function () { + this.timeout(0); + //initialize the contract puppet + + const targetNetwork = sdk.types.NetworkOption.LocalNet + + chest = await new sdk.Chest({ + network: targetNetwork + }) + puppet = await new sdk.Puppet({ + network: targetNetwork + }) + await chest.init() + await puppet.init() + + + //load any wallets and network settings we may want later (helpful if we're local) + network = JSON.parse(fs.readFileSync("../default.neo-express").toString()); + network.wallets.forEach( (walletObj) => { + walletObj.wallet = new Neon.wallet.Account(walletObj.accounts[0]['private-key']) + }) + }) + + + it("should get the total supply", async () => { + const totalSupply = await chest.totalChests() + console.log(totalSupply) + assert(totalSupply >= 0) + }) + + it("should create a new chest", async () => { + this.timeout(0) + const cozWallet = network.wallets[0].wallet + + const oldChestCount = await chest.totalChests() + + // create a chest and get the json + const txid = await chest.createChest("A test chest", + 0, + [1], + { + color: 'blue' + }, + cozWallet) + await sdk.helpers.sleep(TIME_CONSTANT) + const res = await sdk.helpers.txDidComplete(chest.node.url, txid, true) + console.log(res[0]) + assert(res[0].length > 0) + + const chestJSON = await chest.getChestJSON(res[0]) + console.log(chestJSON) + + const newChestCount = await chest.totalChests() + assert(newChestCount === oldChestCount + 1) + }) + + it("should create a new chest and transfer some NFTs to it", async() => { + this.timeout(0) + const cozWallet = network.wallets[0].wallet + + const contractAddress = Neon.wallet.getAddressFromScriptHash(chest.scriptHash.slice(2)) + let puppetTokens = await puppet.tokensOf(cozWallet.address) + const oldBalance = await puppet.balanceOf(cozWallet.address) + + console.log("puppet balance: ", oldBalance) + + let txid = await chest.createChest("A test chest", + 1, + [1], + { + color: 'blue' + }, + cozWallet) + await sdk.helpers.sleep(TIME_CONSTANT) + let res = await sdk.helpers.txDidComplete(chest.node.url, txid, true) + console.log(`new chest: ${res[0]}`) + let chestJSON = await chest.getChestJSON(res[0]) + + + //Transfer to the chest + const transferAmount = 5 + const txids = [] + for (let i = 0; i < transferAmount; i++) { + await puppet.transfer(contractAddress, puppetTokens[i], cozWallet, [res[0]]) + } + + await sdk.helpers.sleep(2000) + for (let txid of txids) { + await sdk.helpers.txDidComplete(chest.node.url, txid, true) + } + + const newPuppetBalance = await puppet.balanceOf(cozWallet.address) + assert(newPuppetBalance === oldBalance - transferAmount) + + chestJSON = await chest.getChestJSON(res[0]) + assert(chestJSON.loot_available === transferAmount) + console.log("new chest", chestJSON) + }) + + it("should create a new chest and transfer some GAS to it", async() => { + this.timeout(0) + const cozWallet = network.wallets[0].wallet + + + const contractAddress = Neon.wallet.getAddressFromScriptHash(chest.scriptHash.slice(2)) + + const transferAmount = 1000 * 10**8 + const amountPerReservoirItem = 1 * 10**8 + + let txid = await chest.createChest("A test chest", + 1, + [1], + { + color: 'blue' + }, + cozWallet) + await sdk.helpers.sleep(TIME_CONSTANT) + let res = await sdk.helpers.txDidComplete(chest.node.url, txid, true) + console.log(`new chest: ${res[0]}`) + let chestJSON = await chest.getChestJSON(res[0]) + console.log(chestJSON) + + + //transfer some GAS + const params = [ + Neon.sc.ContractParam.hash160(cozWallet.address), + Neon.sc.ContractParam.hash160(contractAddress), + Neon.sc.ContractParam.integer(transferAmount), + //Neon.sc.ContractParam.any('') + Neon.sc.ContractParam.array( + Neon.sc.ContractParam.string(res[0]), + Neon.sc.ContractParam.integer(amountPerReservoirItem) + ) + ] + txid = await sdk.api.NeoInterface.publishInvoke(chest.node.url, chest.networkMagic, + "0xd2a4cff31913016155e38e474a2c06d08be276cf", + "transfer", + params, + cozWallet + ); + + await sdk.helpers.sleep(TIME_CONSTANT) + let resB = await sdk.helpers.txDidComplete(chest.node.url, txid, true) + + chestJSON = await chest.getChestJSON(res[0]) + console.log(chestJSON) + + }) + + it("should attempt to loot an empty chest as the author", async () => { + this.timeout(0) + const cozWallet = network.wallets[0].wallet + + // create a chest and get the json + let txid = await chest.createChest("A test chest", + 0, + [1], + { + color: 'blue' + }, + cozWallet) + await sdk.helpers.sleep(TIME_CONSTANT) + let res = await sdk.helpers.txDidComplete(chest.node.url, txid, true) + + try { + txid = await chest.lootChestAsOwner(res[0], cozWallet) + await sdk.helpers.sleep(TIME_CONSTANT) + res = await sdk.helpers.txDidComplete(chest.node.url, txid, true) + assert.fail() + } catch {} + }) + + //attempt to loot an empty chest with a puppet + it("should attempt to loot an empty chest with a puppet", async () => { + this.timeout(0) + const cozWallet = network.wallets[0].wallet + let puppetTokens = await puppet.tokensOf(cozWallet.address) + // create a chest and get the json + let txid = await chest.createChest("A test chest", + 1, + [1], + { + color: 'blue' + }, + cozWallet) + await sdk.helpers.sleep(TIME_CONSTANT) + let res = await sdk.helpers.txDidComplete(chest.node.url, txid, true) + const chestJSON = await chest.getChestJSON(res[0]) + console.log(chestJSON) + + let eligibility = await chest.isPuppetEligible(res[0], puppetTokens[0]) + console.log(`is eligible: ${eligibility}`) + + try { + txid = await chest.lootChestWithPuppet(res[0], puppetTokens[0], cozWallet) + await sdk.helpers.sleep(TIME_CONSTANT) + res = await sdk.helpers.txDidComplete(chest.node.url, txid, true) + assert.fail() + } catch {} + }) + + //attempt to loot a full chest as owner + it("should loot a chest as the owner (NEP-11)", async() => { + this.timeout(0) + const cozWallet = network.wallets[0].wallet + const chestId = "\u0001" + + //get the original puppet balance and chest balance + let puppetBalance = await puppet.balanceOf(cozWallet.address) + let chestJSON = await chest.getChestJSON(chestId) + console.log(puppetBalance) + console.log(chestJSON) + + let txid = await chest.lootChestAsOwner(chestId, cozWallet) + await sdk.helpers.sleep(TIME_CONSTANT) + let res = await sdk.helpers.txDidComplete(chest.node.url, txid, true) + console.log(`Chest response: ${JSON.stringify(res[0])}`) + + let newChestJSON = await chest.getChestJSON(chestId) + console.log(newChestJSON) + + puppetBalance = await puppet.balanceOf(cozWallet.address) + console.log(puppetBalance) + }) + + it("should loot a chest as the owner (NEP-17)", async() => { + this.timeout(0) + const cozWallet = network.wallets[0].wallet + const chestId = "\u0002" + + const rpcClient = new Neon.rpc.RPCClient(chest.node.url); + + + //get the original balance and chest balance + const oldbalances = await rpcClient.getNep17Balances(cozWallet.address) + let chestJSON = await chest.getChestJSON(chestId) + + console.log(`GAS: ${oldbalances.balance[0].amount}`) + console.log(chestJSON) + + let txid = await chest.lootChestAsOwner(chestId, cozWallet) + await sdk.helpers.sleep(TIME_CONSTANT) + let res = await sdk.helpers.txDidComplete(chest.node.url, txid, true) + console.log(`Chest response: ${JSON.stringify(res[0])}`) + + let newChestJSON = await chest.getChestJSON(chestId) + console.log(newChestJSON) + + const newbalances = await rpcClient.getNep17Balances(cozWallet.address) + console.log(`GAS: ${newbalances.balance[0].amount}`) + assert(newbalances.balance[0].amount > oldbalances.balance[0].amount) + assert(chestJSON.loot_available > newChestJSON.loot_available) + }) + + //attempt to loot a full chest with an eligible puppet (both owned and not owned) + + it("should loot a chest using an eligible puppet", async() => { + this.timeout(0) + const cozWallet = network.wallets[0].wallet + const chestId = "\u0002" + + const rpcClient = new Neon.rpc.RPCClient(chest.node.url); + + const puppets = await puppet.tokensOf(cozWallet.address) + let txids = [] + //test puppets with blue and green traits + for (let p of puppets) { + let props = await puppet.getPuppetJSON(p.toString()) + let eligibility = await chest.isPuppetEligible(chestId, p.toString()) + let absoluteEligibility = props.traits.color === 'blue' + console.log(props.traits.color, eligibility, absoluteEligibility) + assert(eligibility === absoluteEligibility) + + if (eligibility) { + let res = await chest.lootChestWithPuppetVerified(chestId, p.toString(), cozWallet) + assert(res) + } + } + }) + + it("should loot a chest using an ineligible puppet", async() => { + this.timeout(0) + const cozWallet = network.wallets[0].wallet + const chestId = '\x03' + + const rpcClient = new Neon.rpc.RPCClient(chest.node.url); + + const puppets = await puppet.tokensOf(cozWallet.address) + let txids = [] + //test puppets with blue and green traits + for (let p of puppets) { + let props = await puppet.getPuppetJSON(p.toString()) + let eligibility = await chest.isPuppetEligible(chestId, p.toString()) + let absoluteEligibility = props.traits.color === 'blue' + console.log(props.traits.color, eligibility, absoluteEligibility) + assert(eligibility === absoluteEligibility) + + if (!eligibility) { + let txid = await chest.lootChestWithPuppet(chestId, p.toString(), cozWallet) + txids.push(txid) + } + } + + await sdk.helpers.sleep(TIME_CONSTANT) + + for (let txid of txids) { + console.log(txid) + let res = await sdk.helpers.txDidComplete(chest.node.url, txid, true) + console.log(`Chest response: ${JSON.stringify(res[0])}`) + } + }) + + //attempt to loot a full chest with an ineligible puppet + // verify the response + // verify the chest json + + //attempt to loot a full chest as an eligible puppet who has already minted + it("should loot a chest using an eligible puppet which has already minted", async() => { + this.timeout(0) + const cozWallet = network.wallets[0].wallet + const chestId = "\u0001" + + const rpcClient = new Neon.rpc.RPCClient(chest.node.url); + + const puppets = await puppet.tokensOf(cozWallet.address) + let txids = [] + //test puppets with blue and green traits + for (let p of puppets) { + let props = await puppet.getPuppetJSON(p.toString()) + let eligibility = await chest.isPuppetEligible(chestId, p.toString()) + let absoluteEligibility = props.traits.color === 'blue' + console.log(props.traits.color, eligibility, absoluteEligibility) + assert(eligibility === absoluteEligibility, props.traits.color) + + + if (eligibility) { + let txid = await chest.lootChestWithPuppet(chestId, p.toString(), cozWallet) + txids.push(txid) + } + } + + await sdk.helpers.sleep(TIME_CONSTANT) + + for (let txid of txids) { + console.log(txid) + let res = await sdk.helpers.txDidComplete(chest.node.url, txid, true) + console.log(`Chest response: ${JSON.stringify(res[0])}`) + } + }) + +}) From 902b888eeef6969c741135d0036a015e775f5274 Mon Sep 17 00:00:00 2001 From: lllwvlvwlll Date: Mon, 30 May 2022 18:49:23 -0600 Subject: [PATCH 2/9] update mainnet hash --- parameters/collections/7_traits.metals.json | 99 +++++++++++++++++++++ parameters/generators/3_golden_puppet.json | 7 +- sdk/dist/Chest.js | 2 +- sdk/dist/Chest.js.map | 2 +- sdk/src/Chest.ts | 2 +- 5 files changed, 106 insertions(+), 6 deletions(-) create mode 100644 parameters/collections/7_traits.metals.json diff --git a/parameters/collections/7_traits.metals.json b/parameters/collections/7_traits.metals.json new file mode 100644 index 0000000..f73891f --- /dev/null +++ b/parameters/collections/7_traits.metals.json @@ -0,0 +1,99 @@ +{ + "description": "A small collection of colors", + "type": "string", + "extra": "", + "values": [ + "lithium", + "beryllium", + "sodium", + "magnesium", + "aluminum", + "potassium", + "calcium", + "scandium", + "titanium", + "vanadium", + "chromium", + "manganese", + "iron", + "cobalt", + "nickel", + "copper", + "zinc", + "gallium", + "rubidium", + "strontium", + "yttrium", + "zirconium", + "niobium", + "molybdenum", + "technetium", + "ruthenium", + "rhodium", + "palladium", + "silver", + "cadmium", + "indium", + "tin", + "cesium", + "barium", + "lanthanum", + "cerium", + "praseodymium", + "neodymium", + "promethium", + "samarium", + "europium", + "gadolinium", + "terbium", + "dysprosium", + "holmium", + "erbium", + "thulium", + "ytterbium", + "lutetium", + "hafnium", + "tantalum", + "tungsten", + "rhenium", + "osmium", + "iridium", + "platinum", + "gold", + "mercury", + "thallium", + "lead", + "bismuth", + "polonium", + "francium", + "radium", + "actinium", + "thorium", + "protactinium", + "uranium", + "neptunium", + "plutonium", + "americium", + "curium", + "berkelium", + "californium", + "einsteinium", + "fermium", + "mendelevium", + "nobelium", + "lawrencium", + "rutherfordium", + "dubnium", + "seaborgium", + "bohrium", + "hassium", + "meitnerium", + "darmstadtium", + "roentgenium", + "copernicium", + "nihonium", + "flerovium", + "moscovium", + "livermorium" + ] +} \ No newline at end of file diff --git a/parameters/generators/3_golden_puppet.json b/parameters/generators/3_golden_puppet.json index ca4c5ef..ec11380 100644 --- a/parameters/generators/3_golden_puppet.json +++ b/parameters/generators/3_golden_puppet.json @@ -1,6 +1,6 @@ { "label": "Golden Puppet Generator", - "baseGeneratorFee": 1562500, + "baseGeneratorFee": 1953125, "traits": [ { "label": "color", @@ -11,10 +11,11 @@ "mintMode": 0, "traits": [ { - "type": 2, + "type": 0, "maxMint": -1, "args": { - "value": "gold" + "collectionId": 7, + "index": 56 } } ] diff --git a/sdk/dist/Chest.js b/sdk/dist/Chest.js index 171bc25..c6eddf2 100644 --- a/sdk/dist/Chest.js +++ b/sdk/dist/Chest.js @@ -28,7 +28,7 @@ class Chest { break; case interface_1.NetworkOption.MainNet: this.options.node = 'https://mainnet1.neo.coz.io:443'; - this.options.scriptHash = ''; + this.options.scriptHash = '0xb94e721f5425ba1d8830ad752e50e0474f989da5'; break; default: this.options.node = 'http://localhost:50012'; diff --git a/sdk/dist/Chest.js.map b/sdk/dist/Chest.js.map index 5fe420c..333066e 100644 --- a/sdk/dist/Chest.js.map +++ b/sdk/dist/Chest.js.map @@ -1 +1 @@ -{"version":3,"file":"Chest.js","sourceRoot":"","sources":["../src/Chest.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,qDAAiD;AACjD,+BAA2C;AAC3C,2CAAkE;AAClE,uCAA+C;AAE/C,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED;;;;GAIG;AAEH,MAAa,KAAK;IAIhB,iIAAiI;IACjI,0HAA0H;IAC1H,8GAA8G;IAC9G,YAAY,UAAkC,EAAE;QANxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAM/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,EAAE,CAAA;gBAC5B,MAAK;YACP,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,EAAE,CAAA;gBAC5B,MAAK;YACP;gBACE,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,wBAAwB,CAAA;gBAC5C,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;SACR;QACD,IAAI,CAAC,OAAO,GAAG,cAAK,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,aAAa,G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IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IAClG,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,IAAY,EAAE,IAAY,EAAE,MAAuB;QACnE,OAAO,cAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACxF,CAAC;CAEF;AAzGD,sBAyGC"} \ No newline at end of file diff --git a/sdk/src/Chest.ts b/sdk/src/Chest.ts index 2b70d35..433f091 100644 --- a/sdk/src/Chest.ts +++ b/sdk/src/Chest.ts @@ -29,7 +29,7 @@ export class Chest { break case NetworkOption.MainNet: this.options.node = 'https://mainnet1.neo.coz.io:443' - this.options.scriptHash = '' + this.options.scriptHash = '0xb94e721f5425ba1d8830ad752e50e0474f989da5' break default: this.options.node = 'http://localhost:50012' From 9f2685bd8b4c66a2c997ed6c86eef72b66f32224 Mon Sep 17 00:00:00 2001 From: lllwvlvwlll Date: Fri, 3 Jun 2022 07:52:08 -0600 Subject: [PATCH 3/9] v0.1.6 --- sdk/dist/Chest.js | 4 +++- sdk/dist/Chest.js.map | 2 +- sdk/dist/api/chest.js | 14 +++++++++++--- sdk/dist/api/chest.js.map | 2 +- sdk/package-lock.json | 4 ++-- sdk/package.json | 5 ++++- sdk/src/Chest.ts | 8 +++++--- sdk/src/api/chest.ts | 7 +++++-- 8 files changed, 32 insertions(+), 14 deletions(-) diff --git a/sdk/dist/Chest.js b/sdk/dist/Chest.js index c6eddf2..b7c9ebd 100644 --- a/sdk/dist/Chest.js +++ b/sdk/dist/Chest.js @@ -90,7 +90,9 @@ class Chest { while (timeout >= age) { try { let res = await helpers_1.txDidComplete(this.node.url, txid, true); - return res[0]; + let formattedRes = helpers_1.formatter(res[0]); + formattedRes.scriptHash = neon_core_1.u.reverseHex(neon_core_1.u.str2hexstring(formattedRes.scripHash)); + return formattedRes; } catch (e) { await helpers_1.sleep(1000); diff --git a/sdk/dist/Chest.js.map b/sdk/dist/Chest.js.map index 333066e..dc83cf7 100644 --- a/sdk/dist/Chest.js.map +++ b/sdk/dist/Chest.js.map @@ -1 +1 @@ -{"version":3,"file":"Chest.js","sourceRoot":"","sources":["../src/Chest.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,qDAAiD;AACjD,+BAA2C;AAC3C,2CAAkE;AAClE,uCAA+C;AAE/C,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED;;;;GAIG;AAEH,MAAa,KAAK;IAIhB,iIAAiI;IACjI,0HAA0H;IAC1H,8GAA8G;IAC9G,YAAY,UAAkC,EAAE;QANxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAM/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,EAAE,CAAA;gBAC5B,MAAK;YACP,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP;gBACE,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,wBAAwB,CAAA;gBAC5C,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;SACR;QACD,IAAI,CAAC,OAAO,GAAG,cAAK,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC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,CAAA;IACtG,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAAe,EAAE,MAAuB;QACzD,OAAO,cAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IAClG,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,IAAY,EAAE,IAAY,EAAE,MAAuB;QACnE,OAAO,cAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACxF,CAAC;CAEF;AA3GD,sBA2GC"} \ No newline at end of file diff --git a/sdk/dist/api/chest.js b/sdk/dist/api/chest.js index 83e16b0..bfbb744 100644 --- a/sdk/dist/api/chest.js +++ b/sdk/dist/api/chest.js @@ -2,6 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.ChestAPI = void 0; const neon_js_1 = require("@cityofzion/neon-js"); +const neon_core_1 = require("@cityofzion/neon-core"); const helpers_1 = require("../helpers"); class ChestAPI { static async createChest(node, networkMagic, contractHash, name, type, eligibleEpochs, puppetTraits, signer) { @@ -46,7 +47,9 @@ class ChestAPI { if (signer) { return res; } - return helpers_1.formatter(res[0]); + let formattedRes = helpers_1.formatter(res[0]); + formattedRes.scriptHash = neon_core_1.u.reverseHex(neon_core_1.u.str2hexstring(formattedRes.scripHash)); + return formattedRes; } static async lootChestAsOwner(node, networkMagic, contractHash, chestId, signer) { const method = "loot_chest_as_owner"; @@ -57,7 +60,9 @@ class ChestAPI { if (signer) { return res; } - return helpers_1.formatter(res[0]); + let formattedRes = helpers_1.formatter(res[0]); + formattedRes.scriptHash = neon_core_1.u.reverseHex(neon_core_1.u.str2hexstring(formattedRes.scripHash)); + return formattedRes; } static async getChestJSON(node, networkMagic, contractHash, chestId, signer) { const method = "get_chest_json"; @@ -68,7 +73,10 @@ class ChestAPI { if (signer) { return res; } - return helpers_1.formatter(res[0]); + let formattedRes = helpers_1.formatter(res[0]); + const author = neon_core_1.u.reverseHex(neon_core_1.u.str2hexstring(formattedRes.author)); + formattedRes.author = new neon_core_1.wallet.Account(author); + return formattedRes; } static async totalChests(node, networkMagic, contractHash, signer) { const method = "total_chests"; diff --git a/sdk/dist/api/chest.js.map b/sdk/dist/api/chest.js.map index edcd382..6771d4f 100644 --- a/sdk/dist/api/chest.js.map +++ b/sdk/dist/api/chest.js.map @@ -1 +1 @@ -{"version":3,"file":"chest.js","sourceRoot":"","sources":["../../src/api/chest.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AAEvC,wCAAqD;AAErD,MAAa,QAAQ;IAEnB,MAAM,CAAC,KAAK,CAAC,WAAW,CACtB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,IAAY,EACZ,IAAY,EACZ,cAAwB,EACxB,YAAiB,EACjB,MAAsB;QAEtB,MAAM,MAAM,GAAG,cAAc,CAAC;QAE9B,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,CAAE,CAAC,KAAK,EAAE,EAAE;YAC3C,OAAO,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACxC,CAAC,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAE,CAAC,GAAG,EAAE,EAAE;YACpD,OAAO,YAAE,CAAC,aAAa,CAAC,KAAK,CAC3B,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,EAC5B,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAC3C,CAAA;QACH,CAAC,CAAC,CAAA;QACF,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC;YAC7B,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC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AAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC;SACjC,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,wBAAc,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,IAAI,YAAY,GAAG,mBAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QACpC,MAAM,MAAM,GAAG,aAAC,CAAC,UAAU,CAAC,aAAC,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAA;QACjE,YAAY,CAAC,MAAM,GAAG,IAAI,kBAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAChD,OAAO,YAAY,CAAA;IACrB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,WAAW,CACtB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,MAAuB;QAEvB,MAAM,MAAM,GAAG,cAAc,CAAC;QAE9B,MAAM,GAAG,GAAG,MAAM,wBAAc,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;QACtF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,mBAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;CAEF;AAhJD,4BAgJC"} \ No newline at end of file diff --git a/sdk/package-lock.json b/sdk/package-lock.json index 0d87468..5438d72 100644 --- a/sdk/package-lock.json +++ b/sdk/package-lock.json @@ -1,6 +1,6 @@ { "name": "@cityofzion/props", - "version": "0.0.5", + "version": "0.1.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -460,7 +460,7 @@ "fs": { "version": "0.0.1-security", "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", - "integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=", + "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==", "dev": true }, "fs.realpath": { diff --git a/sdk/package.json b/sdk/package.json index 6f3768f..6e6ef45 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@cityofzion/props", - "version": "0.1.1", + "version": "0.1.6", "description": "an sdk for interfacing with props to use in decentralized applications", "main": "dist/index", "types": "dist/index", @@ -17,6 +17,9 @@ "fmt": "prettier --write ./src/**/*.ts", "test": "mocha test --recursive --exit --timeout 10000" }, + "browser": { + "fs": false + }, "keywords": [], "author": "COZ, Inc.", "license": "ISC", diff --git a/sdk/src/Chest.ts b/sdk/src/Chest.ts index 433f091..e441d98 100644 --- a/sdk/src/Chest.ts +++ b/sdk/src/Chest.ts @@ -1,8 +1,8 @@ import {merge} from 'lodash' -import {rpc, wallet} from '@cityofzion/neon-core' +import {rpc, u, wallet} from '@cityofzion/neon-core' import {ChestAPI, TemplateAPI} from './api' import {NetworkOption, PropConstructorOptions} from "./interface"; -import {sleep, txDidComplete} from "./helpers"; +import {formatter, sleep, txDidComplete} from "./helpers"; const DEFAULT_OPTIONS: PropConstructorOptions = { network: NetworkOption.LocalNet @@ -98,7 +98,9 @@ export class Chest { while (timeout >= age) { try { let res = await txDidComplete(this.node.url, txid, true) - return res[0] + let formattedRes = formatter(res[0]) + formattedRes.scriptHash = u.reverseHex(u.str2hexstring(formattedRes.scripHash)) + return formattedRes } catch (e) { await sleep(1000) age += 1000 diff --git a/sdk/src/api/chest.ts b/sdk/src/api/chest.ts index 7747f5d..e6e5608 100644 --- a/sdk/src/api/chest.ts +++ b/sdk/src/api/chest.ts @@ -1,5 +1,5 @@ import {sc} from "@cityofzion/neon-js"; -import {wallet} from "@cityofzion/neon-core"; +import {u, wallet} from "@cityofzion/neon-core"; import {formatter, variableInvoke} from "../helpers"; export class ChestAPI { @@ -121,7 +121,10 @@ export class ChestAPI { if (signer) { return res } - return formatter(res[0]) + let formattedRes = formatter(res[0]) + const author = u.reverseHex(u.str2hexstring(formattedRes.author)) + formattedRes.author = new wallet.Account(author) + return formattedRes } static async totalChests( From cd6ece73d80f0723c7545934a9248759e95992d9 Mon Sep 17 00:00:00 2001 From: lllwvlvwlll Date: Sat, 17 Dec 2022 10:03:46 -0700 Subject: [PATCH 4/9] token2049 checkpoint --- contracts/chest/chest.manifest.json | 9 ---- contracts/chest/chest.nef | Bin 4184 -> 4169 bytes contracts/chest/chest.py | 4 +- package.json | 2 +- sdk/dist/Chest.js | 11 ++--- sdk/dist/Chest.js.map | 2 +- sdk/dist/Collection.js | 2 +- sdk/dist/Collection.js.map | 2 +- sdk/dist/Dice.js | 2 +- sdk/dist/Dice.js.map | 2 +- sdk/dist/Generator.js | 8 +-- sdk/dist/Generator.js.map | 2 +- sdk/dist/Puppet.js | 2 +- sdk/dist/Puppet.js.map | 2 +- sdk/dist/Template.js | 2 +- sdk/dist/Template.js.map | 2 +- sdk/dist/api/chest.js | 28 +++++------ sdk/dist/api/chest.js.map | 2 +- sdk/dist/api/collection.js | 30 ++++++------ sdk/dist/api/collection.js.map | 2 +- sdk/dist/api/dice.js | 8 +-- sdk/dist/api/dice.js.map | 2 +- sdk/dist/api/generator.js | 32 ++++++------ sdk/dist/api/generator.js.map | 2 +- sdk/dist/api/interface.js | 27 ++++++++++ sdk/dist/api/interface.js.map | 2 +- sdk/dist/api/puppet.js | 73 +++++++++++++++------------- sdk/dist/api/puppet.js.map | 2 +- sdk/dist/api/template.js | 4 +- sdk/dist/api/template.js.map | 2 +- sdk/package-lock.json | 57 +++++++++++++++++++++- sdk/package.json | 3 +- sdk/src/Chest.ts | 5 +- sdk/src/api/interface.ts | 24 +++++++++ sdk/src/api/puppet.ts | 21 ++++---- 35 files changed, 237 insertions(+), 143 deletions(-) diff --git a/contracts/chest/chest.manifest.json b/contracts/chest/chest.manifest.json index 43f74ae..f43ab7c 100644 --- a/contracts/chest/chest.manifest.json +++ b/contracts/chest/chest.manifest.json @@ -220,15 +220,6 @@ "type": "ByteArray" } ] - }, - { - "name": "Debug", - "parameters": [ - { - "name": "debug", - "type": "Any" - } - ] } ] }, diff --git a/contracts/chest/chest.nef b/contracts/chest/chest.nef index af65d199731f5d3d245293c945b44471bf56c49c..d7983e036720a0e8aaf9215faeda742efe30ec54 100644 GIT binary patch delta 171 zcmcbia8hA{7t>GvjXr*iB4ObhdpCUXoatuGXgq5Z!VK2$g zPR;X7Iai!rVY=_{|NkYEWd$Ua4*&W8-?cL1wnl}i2vE>f@V0_OI0It^gm4Y<>jD7v C7D^QW delta 186 zcmX@9a6@5&7ZZoTMjt;$kp-?Qfx zsd=6$=Zdo{O!xi$|Gy+h@Bk01OKMVSy5m&F{KUz80+LEw{`~*%TA6WMqr#LGsK! int: pass -@contract('0xfefe63f07478394fbe514fda386ad8c7e2a485a0') +@contract('0x76a8f8a7a901b29a33013b469949f4b08db15756') class ContractPuppet: @staticmethod diff --git a/package.json b/package.json index c2c029f..0e325ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "props", - "version": "1.3.0", + "version": "1.4.1", "description": "isengard project", "main": "index.js", "scripts": { diff --git a/sdk/dist/Chest.js b/sdk/dist/Chest.js index b7c9ebd..d935902 100644 --- a/sdk/dist/Chest.js +++ b/sdk/dist/Chest.js @@ -35,7 +35,7 @@ class Chest { this.options.scriptHash = '0x3fb4df29c0c200eff40f465cd028647b8a82f002'; break; } - this.options = lodash_1.merge({}, this.options, options); + this.options = (0, lodash_1.merge)({}, this.options, options); } /** * DO NOT EDIT ME @@ -89,13 +89,12 @@ class Chest { const txid = await api_1.ChestAPI.lootChestWithPuppet(this.node.url, this.networkMagic, this.scriptHash, chestId, puppetId, signer); while (timeout >= age) { try { - let res = await helpers_1.txDidComplete(this.node.url, txid, true); - let formattedRes = helpers_1.formatter(res[0]); - formattedRes.scriptHash = neon_core_1.u.reverseHex(neon_core_1.u.str2hexstring(formattedRes.scripHash)); - return formattedRes; + let res = await (0, helpers_1.txDidComplete)(this.node.url, txid, true); + res[0].scriptHash = neon_core_1.u.reverseHex(neon_core_1.u.str2hexstring(res[0].scriptHash)); + return res; } catch (e) { - await helpers_1.sleep(1000); + await (0, helpers_1.sleep)(1000); age += 1000; } } diff --git a/sdk/dist/Chest.js.map b/sdk/dist/Chest.js.map index dc83cf7..a2e311c 100644 --- a/sdk/dist/Chest.js.map +++ b/sdk/dist/Chest.js.map @@ -1 +1 @@ -{"version":3,"file":"Chest.js","sourceRoot":"","sources":["../src/Chest.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,qDAAoD;AACpD,+BAA2C;AAC3C,2CAAkE;AAClE,uCAA0D;AAE1D,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED;;;;GAIG;AAEH,MAAa,KAAK;IAIhB,iIAAiI;IACjI,0HAA0H;IAC1H,8GAA8G;IAC9G,YAAY,UAAkC,EAAE;QANxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAM/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,EAAE,CAAA;gBAC5B,MAAK;YACP,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP;gBACE,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,wBAAwB,CAAA;gBAC5C,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;SAC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BACV,MAAM,IAAA,eAAK,EAAC,IAAI,CAAC,CAAA;gBACjB,GAAG,IAAI,IAAI,CAAA;aACZ;SACF;QACD,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,OAAe,EAAE,MAAsB;QAC5D,OAAO,cAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IACtG,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAAe,EAAE,MAAuB;QACzD,OAAO,cAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IAClG,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,IAAY,EAAE,IAAY,EAAE,MAAuB;QACnE,OAAO,cAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACxF,CAAC;CAEF;AA1GD,sBA0GC"} \ No newline at end of file diff --git a/sdk/dist/Collection.js b/sdk/dist/Collection.js index eb620e5..40895f6 100644 --- a/sdk/dist/Collection.js +++ b/sdk/dist/Collection.js @@ -55,7 +55,7 @@ class Collection { this.options.scriptHash = '0xacf2aa5d0899e860eebd8b8a5454aa3017543848'; break; } - this.options = lodash_1.merge({}, this.options, options); + this.options = (0, lodash_1.merge)({}, this.options, options); } /** * Gets the magic number for the network and configures the class instance. diff --git a/sdk/dist/Collection.js.map b/sdk/dist/Collection.js.map index 8e0389a..6022819 100644 --- a/sdk/dist/Collection.js.map +++ b/sdk/dist/Collection.js.map @@ -1 +1 @@ -{"version":3,"file":"Collection.js","sourceRoot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IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,gBAAgB,CAAC,MAAuB;QAC5C,OAAO,mBAAa,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IAClG,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,QAAgB,EAAE,MAAsB;QACnE,OAAO,mBAAa,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;IAC9G,CAAC;CAEF;AA3ND,gCA2NC"} \ No newline at end of file diff --git a/sdk/dist/Dice.js b/sdk/dist/Dice.js index 4c337fa..73d0204 100644 --- a/sdk/dist/Dice.js +++ b/sdk/dist/Dice.js @@ -49,7 +49,7 @@ class Dice { this.options.scriptHash = '0x16d6a0be0506b26e0826dd352724cda0defa7131'; break; } - this.options = lodash_1.merge({}, this.options, options); + this.options = (0, lodash_1.merge)({}, this.options, options); } /** * Gets the magic number for the network and configures the class instance. diff --git a/sdk/dist/Dice.js.map b/sdk/dist/Dice.js.map index 57646e2..fb0c68a 100644 --- a/sdk/dist/Dice.js.map +++ b/sdk/dist/Dice.js.map @@ -1 +1 @@ -{"version":3,"file":"Dice.js","sourceRoot":"","sources":["../src/Dice.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,qDAAiD;AACjD,+BAA6B;AAC7B,2CAAkE;AAElE,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAa,IAAI;IAIf,YAAY,UAAkC,EAAE;QAHxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;Q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AAC,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IACxH,CAAC;CAEF;AAtHD,oBAsHC"} \ No newline at end of file diff --git a/sdk/dist/Generator.js b/sdk/dist/Generator.js index 570a84e..1570907 100644 --- a/sdk/dist/Generator.js +++ b/sdk/dist/Generator.js @@ -31,7 +31,7 @@ class Generator { this.options.scriptHash = '0xa3e59ddc61b2d8ac42c519cee5ddaac83c7df276'; break; } - this.options = lodash_1.merge({}, this.options, options); + this.options = (0, lodash_1.merge)({}, this.options, options); } async init() { const getVersionRes = await this.node.getVersion(); @@ -53,13 +53,13 @@ class Generator { const txids = []; let txid = await api_1.GeneratorAPI.createGenerator(this.node.url, this.networkMagic, this.scriptHash, generator.label, generator.baseGeneratorFee, signer); txids.push(txid); - await helpers_1.sleep(timeConstantMS); - const res = await helpers_1.txDidComplete(this.node.url, txid, false); + await (0, helpers_1.sleep)(timeConstantMS); + const res = await (0, helpers_1.txDidComplete)(this.node.url, txid, false); for await (let trait of generator.traits) { trait = trait; txid = await api_1.GeneratorAPI.createTrait(this.node.url, this.networkMagic, this.scriptHash, res[0], trait.label, trait.slots, trait.traitLevels, signer); txids.push(txid); - await helpers_1.sleep(timeConstantMS); + await (0, helpers_1.sleep)(timeConstantMS); } return txids; } diff --git a/sdk/dist/Generator.js.map b/sdk/dist/Generator.js.map index 2ad34c5..e90c1b2 100644 --- a/sdk/dist/Generator.js.map +++ b/sdk/dist/Generator.js.map @@ -1 +1 @@ -{"version":3,"file":"Generator.js","sourceRoot":"","sources":["../src/Generator.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA8B;AAC9B,qDAAiD;AACjD,+BAAkC;AAClC,2CAMqB;AACrB,uCAA+C;AAC/C,4CAAoB;AAEpB,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED,MAAa,SAAS;IAIpB,YAAY,UAAkC,EAAE;QAHxC,YAAO,GAA2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AAY,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IAChG,CAAC;IAED,KAAK,CAAC,uBAAuB,CAAC,MAAuB;QACnD,OAAO,kBAAY,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACxG,CAAC;CACF;AAjHD,8BAiHC"} \ No newline at end of file diff --git a/sdk/dist/Puppet.js b/sdk/dist/Puppet.js index bff1cae..c212cbc 100644 --- a/sdk/dist/Puppet.js +++ b/sdk/dist/Puppet.js @@ -27,7 +27,7 @@ class Puppet { this.options.scriptHash = '0xfefe63f07478394fbe514fda386ad8c7e2a485a0'; break; } - this.options = lodash_1.merge({}, this.options, options); + this.options = (0, lodash_1.merge)({}, this.options, options); } async init() { const getVersionRes = await this.node.getVersion(); diff --git a/sdk/dist/Puppet.js.map b/sdk/dist/Puppet.js.map index be9e537..1f3ba4d 100644 --- a/sdk/dist/Puppet.js.map +++ b/sdk/dist/Puppet.js.map @@ -1 +1 @@ -{"version":3,"file":"Puppet.js","sourceRoot":"","sources":["../src/Puppet.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,qDAAiD;AACjD,+BAA6C;AAC7C,iDAAuC;AACvC,2CAAyF;AAEzF,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED,MAAa,MAAM;IAIjB,YAAY,UAAkC,EAAE;QAHxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAG/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,C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@@ class Template { this.options.scriptHash = '0x16d6a0be0506b26e0826dd352724cda0defa7131'; break; } - this.options = lodash_1.merge({}, this.options, options); + this.options = (0, lodash_1.merge)({}, this.options, options); } /** * DO NOT EDIT ME diff --git a/sdk/dist/Template.js.map b/sdk/dist/Template.js.map index 8232d1c..405a20d 100644 --- a/sdk/dist/Template.js.map +++ b/sdk/dist/Template.js.map @@ -1 +1 @@ -{"version":3,"file":"Template.js","sourceRoot":"","sources":["../src/Template.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,qDAAiD;AACjD,+BAAiC;AACjC,2CAAkE;AAElE,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED;;;;GAIG;AAEH,MAAa,QAAQ;IAInB,iIAAiI;IACjI,0HAA0H;IAC1H,8GAA8G;IAC9G,YAAY,UAAkC,EAAE;QANxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAM/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP;gBACE,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,wBAAwB,CAAA;gBAC5C,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;SACR;QACD,IAAI,CAAC,OAAO,GAAG,cAAK,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAED;;;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AC,OAAO,CAAC,UAAU,CAAA;SAC/B;QACD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC5C,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,cAAc,CAAC,MAAc,EAAE,MAAc,EAAE,MAAc,EAAE,MAAe,EAAE,MAAgB,EAAE,MAAuB;QAC7H,OAAO,iBAAW,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACtI,CAAC;CAIF;AAvED,4BAuEC"} \ No newline at end of file diff --git a/sdk/dist/api/chest.js b/sdk/dist/api/chest.js index bfbb744..9aa7581 100644 --- a/sdk/dist/api/chest.js +++ b/sdk/dist/api/chest.js @@ -19,11 +19,11 @@ class ChestAPI { neon_js_1.sc.ContractParam.array(...epochs), neon_js_1.sc.ContractParam.array(...traits) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } - return helpers_1.formatter(res[0]); + return (0, helpers_1.formatter)(res[0]); } static async isPuppetEligible(node, networkMagic, contractHash, chestId, puppetId, signer) { const method = "is_puppet_eligible"; @@ -31,11 +31,11 @@ class ChestAPI { neon_js_1.sc.ContractParam.string(chestId), neon_js_1.sc.ContractParam.string(puppetId), ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } - return helpers_1.formatter(res[0]); + return (0, helpers_1.formatter)(res[0]); } static async lootChestWithPuppet(node, networkMagic, contractHash, chestId, puppetId, signer) { const method = "loot_chest_with_puppet"; @@ -43,48 +43,44 @@ class ChestAPI { neon_js_1.sc.ContractParam.string(chestId), neon_js_1.sc.ContractParam.string(puppetId), ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } - let formattedRes = helpers_1.formatter(res[0]); - formattedRes.scriptHash = neon_core_1.u.reverseHex(neon_core_1.u.str2hexstring(formattedRes.scripHash)); - return formattedRes; + return (0, helpers_1.formatter)(res[0]); } static async lootChestAsOwner(node, networkMagic, contractHash, chestId, signer) { const method = "loot_chest_as_owner"; const param = [ neon_js_1.sc.ContractParam.string(chestId), ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } - let formattedRes = helpers_1.formatter(res[0]); - formattedRes.scriptHash = neon_core_1.u.reverseHex(neon_core_1.u.str2hexstring(formattedRes.scripHash)); - return formattedRes; + return (0, helpers_1.formatter)(res[0]); } static async getChestJSON(node, networkMagic, contractHash, chestId, signer) { const method = "get_chest_json"; const param = [ neon_js_1.sc.ContractParam.string(chestId), ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } - let formattedRes = helpers_1.formatter(res[0]); + let formattedRes = (0, helpers_1.formatter)(res[0]); const author = neon_core_1.u.reverseHex(neon_core_1.u.str2hexstring(formattedRes.author)); formattedRes.author = new neon_core_1.wallet.Account(author); return formattedRes; } static async totalChests(node, networkMagic, contractHash, signer) { const method = "total_chests"; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, [], signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); if (signer) { return res; } - return helpers_1.formatter(res[0]); + return (0, helpers_1.formatter)(res[0]); } } exports.ChestAPI = ChestAPI; diff --git a/sdk/dist/api/chest.js.map b/sdk/dist/api/chest.js.map index 6771d4f..5386b94 100644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KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC;SACjC,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,IAAI,YAAY,GAAG,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QACpC,MAAM,MAAM,GAAG,aAAC,CAAC,UAAU,CAAC,aAAC,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAA;QACjE,YAAY,CAAC,MAAM,GAAG,IAAI,kBAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAChD,OAAO,YAAY,CAAA;IACrB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,WAAW,CACtB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,MAAuB;QAEvB,MAAM,MAAM,GAAG,cAAc,CAAC;QAE9B,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;QACtF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;CAEF;AA5ID,4BA4IC"} \ No newline at end of file diff --git a/sdk/dist/api/collection.js b/sdk/dist/api/collection.js index 66d84cb..a38ab91 100644 --- a/sdk/dist/api/collection.js +++ b/sdk/dist/api/collection.js @@ -16,7 +16,7 @@ class CollectionAPI { neon_js_1.sc.ContractParam.string(extra), neon_js_1.sc.ContractParam.array(...raw_traits) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } @@ -30,7 +30,7 @@ class CollectionAPI { neon_js_1.sc.ContractParam.string(extra), neon_js_1.sc.ContractParam.array(...values) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } @@ -41,7 +41,7 @@ class CollectionAPI { const param = [ neon_js_1.sc.ContractParam.integer(collectionId) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } @@ -74,12 +74,12 @@ class CollectionAPI { switch (result.type) { case "string": result.values = result.valuesRaw.map((value) => { - return helpers_1.formatter(value); + return (0, helpers_1.formatter)(value); }); break; case "int": result.values = result.valuesRaw.map((value) => { - let bytes = helpers_1.formatter(value); + let bytes = (0, helpers_1.formatter)(value); return parseInt(bytes, 16); }); break; @@ -91,7 +91,7 @@ class CollectionAPI { const param = [ neon_js_1.sc.ContractParam.integer(collectionId) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } @@ -103,7 +103,7 @@ class CollectionAPI { neon_js_1.sc.ContractParam.integer(collectionId), neon_js_1.sc.ContractParam.integer(index) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } @@ -114,7 +114,7 @@ class CollectionAPI { const param = [ neon_js_1.sc.ContractParam.integer(collectionId) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } @@ -125,7 +125,7 @@ class CollectionAPI { const param = [ neon_js_1.sc.ContractParam.integer(collectionId) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } @@ -139,7 +139,7 @@ class CollectionAPI { neon_js_1.sc.ContractParam.integer(collectionId), neon_js_1.sc.ContractParam.string(entropy) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } @@ -151,7 +151,7 @@ class CollectionAPI { neon_js_1.sc.ContractParam.integer(collectionId), neon_js_1.sc.ContractParam.integer(samples) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } @@ -167,7 +167,7 @@ class CollectionAPI { neon_js_1.sc.ContractParam.integer(samples), neon_js_1.sc.ContractParam.boolean(pick) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } @@ -175,7 +175,7 @@ class CollectionAPI { } static async totalCollections(node, networkMagic, contractHash, signer) { const method = "total_collections"; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, [], signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); if (signer) { return res; } @@ -191,11 +191,11 @@ class CollectionAPI { neon_js_1.sc.ContractParam.string(manifest), neon_js_1.sc.ContractParam.any(data) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, params, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); if (signer) { return res; } - return helpers_1.formatter(res); + return (0, helpers_1.formatter)(res); } } exports.CollectionAPI = CollectionAPI; diff --git a/sdk/dist/api/collection.js.map b/sdk/dist/api/collection.js.map index ca4ff4f..b9caff8 100644 --- a/sdk/dist/api/collection.js.map +++ b/sdk/dist/api/collection.js.map @@ -1 +1 @@ -{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../src/api/collection.ts"],"names":[],"mappings":";;;AAAA,iDAA0C;AAE1C,qDAA6C;AAG7C,wCAAqD;AAErD,MAAa,aAAa;IAExB,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,WAAmB,EACnB,eAAuB,EACvB,KAAU,EACV,MAAgB,EAChB,MAAsB;QAEtB,MAAM,MAAM,GAAG,mBAAmB,CAAC;QAEnC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAE,CAAC,KAAK,EAAE,EAAE;YACvC,OAAO,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACvC,CAAC,CAAC,CAAA;QAEF,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC;YACpC,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,eAAe,CAAC;YACxC,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;YAC9B,YAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC;SACtC,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,wBAAc,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,WAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAA;IAC7C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAC9B,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,WAAmB,EACnB,eAAuB,EACvB,KAAU,EACV,MAA2B,EAC3B,MAAsB;QAEtB,MAAM,MAAM,GAAG,mBAAmB,CAAC;QAE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,IAAS,EACT,MAAsB;QAEtB,MAAM,MAAM,GAAG,QAAQ,CAAC;QACxB,MAAM,MAAM,GAAG;YACb,YAAE,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC;YAClC,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC;YACjC,YAAE,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC;SAC3B,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,wBAAc,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QAC1F,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,mBAAS,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;CAEF;AA/SD,sCA+SC"} \ No newline at end of file +{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../src/api/collection.ts"],"names":[],"mappings":";;;AAAA,iDAA0C;AAE1C,qDAA6C;AAG7C,wCAAqD;AAErD,MAAa,aAAa;IAExB,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,WAAmB,EACnB,eAAuB,EACvB,KAAU,EACV,MAAgB,EAChB,MAAsB;QAEtB,MAAM,MAAM,GAAG,mBAAmB,CAAC;QAEnC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAE,CAAC,KAAK,EAAE,EAAE;YACvC,OAAO,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACvC,CAAC,CAAC,CAAA;QAEF,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC;YACpC,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,eAAe,CAAC;YACxC,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;YAC9B,YAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,U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AAoB,EACpB,MAAuB;QAEvB,MAAM,MAAM,GAAG,mBAAmB,CAAC;QAEnC,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;QACtF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;YACzC,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;SAC1C;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,MAAc,EACd,QAAgB,EAChB,IAAS,EACT,MAAsB;QAEtB,MAAM,MAAM,GAAG,QAAQ,CAAC;QACxB,MAAM,MAAM,GAAG;YACb,YAAE,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC;YAClC,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC;YACjC,YAAE,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC;SAC3B,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QAC1F,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC;IACxB,CAAC;CAEF;AA/SD,sCA+SC"} \ No newline at end of file diff --git a/sdk/dist/api/dice.js b/sdk/dist/api/dice.js index 8a2316a..2390c80 100644 --- a/sdk/dist/api/dice.js +++ b/sdk/dist/api/dice.js @@ -9,7 +9,7 @@ class DiceAPI { const param = [ neon_js_1.sc.ContractParam.string(die) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } @@ -22,7 +22,7 @@ class DiceAPI { neon_js_1.sc.ContractParam.integer(precision), neon_js_1.sc.ContractParam.string(entropy) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } @@ -34,7 +34,7 @@ class DiceAPI { neon_js_1.sc.ContractParam.integer(start), neon_js_1.sc.ContractParam.integer(end) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } @@ -47,7 +47,7 @@ class DiceAPI { neon_js_1.sc.ContractParam.integer(end), neon_js_1.sc.ContractParam.string(entropy) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } diff --git a/sdk/dist/api/dice.js.map b/sdk/dist/api/dice.js.map index 3f5fba8..7fcbc3b 100644 --- a/sdk/dist/api/dice.js.map +++ b/sdk/dist/api/dice.js.map @@ -1 +1 @@ -{"version":3,"file":"dice.js","sourceRoot":"","sources":["../../src/api/dice.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AAGvC,wCAA0C;AAE1C,MAAa,OAAO;IAElB,MAAM,CAAC,KAAK,CAAC,OAAO,CAClB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,GAAW,EACX,MAAuB;QAEvB,MAAM,MAAM,GAAG,UAAU,CAAC;QAC1B,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC;SAC7B,CAAA;QACD,MAAM,GAAG,GAAG,MAAM,wBAAc,CAAC,IAAI,EA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AAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAC5B,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,KAAa,EACb,GAAW,EACX,OAAe,EACf,MAAuB;QAEvB,MAAM,MAAM,GAAG,sBAAsB,CAAC;QACtC,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC;YAC/B,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC;YAC7B,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC;SACjC,CAAA;QACD,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC;IAC1C,CAAC;CACF;AAnFD,0BAmFC"} \ No newline at end of file diff --git a/sdk/dist/api/generator.js b/sdk/dist/api/generator.js index 882a3dd..1cafc0f 100644 --- a/sdk/dist/api/generator.js +++ b/sdk/dist/api/generator.js @@ -11,14 +11,14 @@ class GeneratorAPI { neon_js_1.sc.ContractParam.string(label), neon_js_1.sc.ContractParam.integer(baseGeneratorFee) ]; - return await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); } static async createInstance(node, networkMagic, contractHash, generatorId, signer) { const method = "create_instance"; const param = [ neon_js_1.sc.ContractParam.integer(generatorId) ]; - return await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); } static async createTrait(node, networkMagic, contractHash, generatorId, label, slots, levels, signer) { const method = "create_trait"; @@ -49,7 +49,7 @@ class GeneratorAPI { neon_js_1.sc.ContractParam.integer(slots), neon_js_1.sc.ContractParam.array(...traitLevelsFormatted) ]; - return await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); } //getGenerator static async getGeneratorJSON(node, networkMagic, contractHash, generatorId, signer) { @@ -57,22 +57,22 @@ class GeneratorAPI { const param = [ neon_js_1.sc.ContractParam.integer(generatorId) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } - return helpers_1.formatter(res[0]); + return (0, helpers_1.formatter)(res[0]); } static async getTraitJSON(node, networkMagic, contractHash, traitId, signer) { const method = "get_trait_json"; const param = [ neon_js_1.sc.ContractParam.string(traitId) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } - return helpers_1.formatter(res[0]); + return (0, helpers_1.formatter)(res[0]); } //getGeneratorInstance static async getGeneratorInstanceJSON(node, networkMagic, contractHash, instanceId, signer) { @@ -80,11 +80,11 @@ class GeneratorAPI { const param = [ neon_js_1.sc.ContractParam.integer(instanceId) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } - return helpers_1.formatter(res[0]); + return (0, helpers_1.formatter)(res[0]); } static async mintFromInstance(node, networkMagic, contractHash, instanceId, signer) { const method = "mint_from_instance"; @@ -92,7 +92,7 @@ class GeneratorAPI { neon_js_1.sc.ContractParam.string(''), neon_js_1.sc.ContractParam.integer(instanceId) ]; - return await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); } static async setInstanceAccessMode(node, networkMagic, contractHash, instanceId, accessMode, signer) { const method = "set_instance_access_mode"; @@ -100,7 +100,7 @@ class GeneratorAPI { neon_js_1.sc.ContractParam.integer(instanceId), neon_js_1.sc.ContractParam.integer(accessMode) ]; - return await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); } static async setInstanceAuthorizedUsers(node, networkMagic, contractHash, instanceId, authorizedUsers, signer) { const method = "set_instance_authorized_users"; @@ -111,7 +111,7 @@ class GeneratorAPI { neon_js_1.sc.ContractParam.integer(instanceId), neon_js_1.sc.ContractParam.array(...usersFormatted) ]; - return await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); } static async setInstanceAuthorizedContracts(node, networkMagic, contractHash, instanceId, authorizedContracts, signer) { const method = "set_instance_authorized_contracts"; @@ -122,7 +122,7 @@ class GeneratorAPI { neon_js_1.sc.ContractParam.integer(instanceId), neon_js_1.sc.ContractParam.array(...contractsFormatted) ]; - return await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); } static async setInstanceFee(node, networkMagic, contractHash, instanceId, fee, signer) { const method = "set_instance_fee"; @@ -130,11 +130,11 @@ class GeneratorAPI { neon_js_1.sc.ContractParam.integer(instanceId), neon_js_1.sc.ContractParam.integer(fee) ]; - return await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); } static async totalGenerators(node, networkMagic, contractHash, signer) { const method = "total_generators"; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, [], signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); if (signer) { return res; } @@ -142,7 +142,7 @@ class GeneratorAPI { } static async totalGeneratorInstances(node, networkMagic, contractHash, signer) { const method = "total_generator_instances"; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, [], signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); if (signer) { return res; } diff --git a/sdk/dist/api/generator.js.map b/sdk/dist/api/generator.js.map index f280792..0b42252 100644 --- a/sdk/dist/api/generator.js.map +++ b/sdk/dist/api/generator.js.map @@ -1 +1 @@ -{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/api/generator.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AAEvC,4CAWsB;AACtB,wCAAqD;AAErD,MAAa,YAAY;IAEvB,MAAM,CAAC,KAAK,CAAC,eAAe,CAC1B,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,KAAa,EACb,gBAAwB,EACxB,MAAsB;QAEtB,MAAM,MAAM,GAAG,kBAAkB,CAAC;QAElC,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;YAC9B,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,gBAAgB,CAAC;SAC3C,CAAA;QAED,OAAO,MAAM,wBAAc,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IACtF,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,cAAc,CACzB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,WAAmB,EACnB,MAAsB;QAEtB,MAAM,MAAM,GAAG,iBAAiB,CAAC;QAEjC,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC;SACtC,CAAA;QAED,OAAO,MAAM,wBAAc,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,M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,MAAuB;QAEvB,MAAM,MAAM,GAAG,2BAA2B,CAAC;QAE3C,MAAM,GAAG,GAAG,MAAM,wBAAc,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;QACtF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC;IAC1C,CAAC;CACF;AAjTD,oCAiTC"} \ No newline at end of file +{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/api/generator.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AAEvC,4CAWsB;AACtB,wCAAqD;AAErD,MAAa,YAAY;IAEvB,MAAM,CAAC,KAAK,CAAC,eAAe,CAC1B,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,KAAa,EACb,gBAAwB,EACxB,MAAsB;QAEtB,MAAM,MAAM,GAAG,kBAAkB,CAAC;QAElC,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;YAC9B,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,gBAAgB,CAAC;SAC3C,CAAA;QAED,OAAO,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IACtF,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,cAAc,CACzB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,WAAmB,EACnB,MAAsB;QAEtB,MAAM,MAAM,GAAG,iBAAiB,CAAC;QAEjC,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC;SACtC,CAAA;QAED,OAAO,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM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AAM,CAAC,KAAK,CAAC,uBAAuB,CAClC,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,MAAuB;QAEvB,MAAM,MAAM,GAAG,2BAA2B,CAAC;QAE3C,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;QACtF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC;IAC1C,CAAC;CACF;AAjTD,oCAiTC"} \ No newline at end of file diff --git a/sdk/dist/api/interface.js b/sdk/dist/api/interface.js index 2cc58cd..5975385 100644 --- a/sdk/dist/api/interface.js +++ b/sdk/dist/api/interface.js @@ -18,9 +18,13 @@ var __importStar = (this && this.__importStar) || function (mod) { __setModuleDefault(result, mod); return result; }; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.NeoInterface = void 0; const neon_js_1 = __importStar(require("@cityofzion/neon-js")); +const axios_1 = __importDefault(require("axios")); class NeoInterface { /** * A method for executing test invocations on the Neo blockchain @@ -36,6 +40,29 @@ class NeoInterface { if (res.exception) { throw new Error("Invocation Error: " + res.exception); } + if (res.stack[0].type === 'InteropInterface') { + // @ts-ignore + // @ts-ignore + const ijson = { + // @ts-ignore + "jsonrpc": "2.0", + "id": 1, + "method": "traverseiterator", + "params": [ + // @ts-ignore + res.session, + // @ts-ignore + res.stack[0].id, + 100 + ] + }; + const { data } = await (0, axios_1.default)({ + method: 'post', + url: rpcAddress, + data: ijson, + }); + return data.result; + } return res.stack; } /** diff --git a/sdk/dist/api/interface.js.map b/sdk/dist/api/interface.js.map index 94606cf..536eb96 100644 --- a/sdk/dist/api/interface.js.map +++ b/sdk/dist/api/interface.js.map @@ -1 +1 @@ -{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/api/interface.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,+DAAiD;AAYjD,MAAa,YAAY;IACvB;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,UAAU,CACrB,UAAkB,EAClB,YAAoB,EACpB,UAAkB,EAClB,SAAiB,EACjB,IAAW;QAGX,MAAM,GAAG,GAAG,MAAM,IAAI,aAAG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,cAAc,CAC5D,UAAU,EACV,SAAS,EACT,IAAI,CACL,CAAA;QACD,IAAI,GAAG,CAAC,SAAS,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;SACtD;QACD,OAAO,GAAG,CAAC,KAAK,CAAC;IACnB,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,aAAa,CACxB,UAAkB,EAClB,YAAoB,EACpB,UAAkB,EAClB,SAAiB,EACjB,IAAW,EACX,OAAuB;QAGvB,MAAM,QAAQ,GAAG,IAAI,iBAAI,CAAC,YAAY,CAAC,aAAa,CAClD,iBAAI,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EACpC;YACE,YAAY;YACZ,UAAU;YACV,OAAO;SACR,CACF,CAAC;QAEF,IAAI,MAAM,CAAC;QACX,IAAI;YACF,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SACjD;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SAChB;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAlED,oCAkEC"} \ No newline at end of file +{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/api/interface.ts"],"names":[],"mappings":";;;;;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AAC,aAAa,CAClD,iBAAI,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EACpC;YACE,YAAY;YACZ,UAAU;YACV,OAAO;SACR,CACF,CAAC;QAEF,IAAI,MAAM,CAAC;QACX,IAAI;YACF,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SACjD;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SAChB;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAzFD,oCAyFC"} \ No newline at end of file diff --git a/sdk/dist/api/puppet.js b/sdk/dist/api/puppet.js index afb71e8..896e8e0 100644 --- a/sdk/dist/api/puppet.js +++ b/sdk/dist/api/puppet.js @@ -35,7 +35,7 @@ class PuppetAPI { static async balanceOf(node, networkMagic, contractHash, address, signer) { const method = "balanceOf"; const params = [neon_js_1.sc.ContractParam.hash160(address)]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, params, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); if (signer) { return res; } @@ -51,7 +51,7 @@ class PuppetAPI { neon_js_1.sc.ContractParam.integer(sysFee), neon_js_1.sc.ContractParam.integer(maxSupply) ]; - return await helpers_1.variableInvoke(node, networkMagic, contractHash, method, params, signer); + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); } /** * Returns the decimals of the token @@ -62,7 +62,7 @@ class PuppetAPI { */ static async decimals(node, networkMagic, contractHash, signer) { const method = "decimals"; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, [], signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); if (signer) { return res; } @@ -77,14 +77,14 @@ class PuppetAPI { */ static async deploy(node, networkMagic, contractHash, signer) { const method = "deploy"; - return await helpers_1.variableInvoke(node, networkMagic, contractHash, method, [], signer); + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); } static async getAttributeMod(node, networkMagic, contractHash, attributeValue, signer) { const method = "roll_initial_stat"; const params = [ neon_js_1.sc.ContractParam.integer(attributeValue) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, params, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); if (signer) { return res; } @@ -93,25 +93,25 @@ class PuppetAPI { static async getPuppetJSON(node, networkMagic, contractHash, tokenId, signer) { const method = "get_puppet_json"; const param = [neon_js_1.sc.ContractParam.string(tokenId)]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } - return helpers_1.formatter(res[0]); + return (0, helpers_1.formatter)(res[0]); } static async getPuppetJSONFlat(node, networkMagic, contractHash, tokenId, signer) { const method = "get_puppet_json_flat"; const params = [neon_js_1.sc.ContractParam.string(tokenId)]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, params, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); if (signer) { return res; } - return helpers_1.formatter(res[0]); + return (0, helpers_1.formatter)(res[0]); } static async getPuppetRaw(node, networkMagic, contractHash, tokenId, signer) { const method = "get_puppet_raw"; const params = [neon_js_1.sc.ContractParam.string(tokenId)]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, params, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); if (signer) { return res; } @@ -128,7 +128,7 @@ class PuppetAPI { static async ownerOf(node, networkMagic, contractHash, tokenId, signer) { const method = "ownerOf"; const params = [neon_js_1.sc.ContractParam.string(tokenId)]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, params, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); if (signer) { return res; } @@ -141,7 +141,7 @@ class PuppetAPI { neon_js_1.sc.ContractParam.integer(epochId), neon_js_1.sc.ContractParam.hash160(owner) ]; - return await helpers_1.variableInvoke(node, networkMagic, contractHash, method, params, signer); + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); } /** * Gets the properties of a token @@ -154,11 +154,11 @@ class PuppetAPI { static async properties(node, networkMagic, contractHash, tokenId, signer) { const method = "properties"; const params = [neon_js_1.sc.ContractParam.string(tokenId)]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, params, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); if (signer) { return res; } - return helpers_1.formatter(res[0]); + return (0, helpers_1.formatter)(res[0]); } static async setMintFee(node, networkMagic, contractHash, epochId, fee, signer) { const method = "set_mint_fee"; @@ -166,7 +166,7 @@ class PuppetAPI { neon_js_1.sc.ContractParam.integer(epochId), neon_js_1.sc.ContractParam.integer(fee) ]; - return await helpers_1.variableInvoke(node, networkMagic, contractHash, method, params, signer); + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); } /** * Returns the token symbol @@ -177,7 +177,7 @@ class PuppetAPI { */ static async symbol(node, networkMagic, contractHash, signer) { const method = "symbol"; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, [], signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); if (signer) { return res; } @@ -192,7 +192,7 @@ class PuppetAPI { */ static async tokens(node, networkMagic, contractHash, signer) { const method = "tokens"; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, [], signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); if (signer) { return res; } @@ -203,7 +203,7 @@ class PuppetAPI { if (iterator.iterator && iterator.iterator.length > 0 && iterator.iterator[0].value) { return iterator.iterator.map((token) => { const attrs = token.value; - return helpers_1.formatter(attrs[0]); + return (0, helpers_1.formatter)(attrs[0]); }); } if (iterator.iterator && iterator.iterator.length === 0) { @@ -222,18 +222,21 @@ class PuppetAPI { static async tokensOf(node, networkMagic, contractHash, address, signer) { const method = "tokensOf"; const params = [neon_js_1.sc.ContractParam.hash160(address)]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, params, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); if (signer) { return res; } - const iterator = res[0]; - if (iterator.iterator && iterator.iterator.length >= 0) { - return iterator.iterator.map((token) => { - const attrs = token.value; - return helpers_1.formatter(attrs[1]); - }); - } - throw new Error("unable to resolve respond format"); + // @ts-ignore + const tokens = []; + res.forEach((token) => { + if (token.value.length === 2) { + tokens.push((0, helpers_1.formatter)(token.value[1])); + } + else { + tokens.push((0, helpers_1.formatter)(token)); + } + }); + return tokens; } /** * Gets the total number of accounts stored in the contract @@ -244,7 +247,7 @@ class PuppetAPI { */ static async totalAccounts(node, networkMagic, contractHash, signer) { const method = "total_accounts"; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, [], signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); if (signer) { return res; } @@ -252,7 +255,7 @@ class PuppetAPI { } static async totalEpochs(node, networkMagic, contractHash, signer) { const method = "total_epochs"; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, [], signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); if (signer) { return res; } @@ -267,7 +270,7 @@ class PuppetAPI { */ static async totalSupply(node, networkMagic, contractHash, signer) { const method = "totalSupply"; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, [], signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); if (signer) { return res; } @@ -290,7 +293,7 @@ class PuppetAPI { neon_js_1.sc.ContractParam.string(tokenId), data, ]; - return await helpers_1.variableInvoke(node, networkMagic, contractHash, method, params, signer); + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); } static async update(node, networkMagic, contractHash, script, manifest, data, signer) { const method = "update"; @@ -299,21 +302,21 @@ class PuppetAPI { neon_js_1.sc.ContractParam.string(manifest), neon_js_1.sc.ContractParam.any(data) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, params, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); if (signer) { return res; } - return helpers_1.formatter(res); + return (0, helpers_1.formatter)(res); } //setUserPermissions static async getEpochJSON(node, networkMagic, contractHash, epochId, signer) { const method = "get_epoch_json"; const param = [neon_js_1.sc.ContractParam.integer(epochId)]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } - return helpers_1.formatter(res); + return (0, helpers_1.formatter)(res); } } exports.PuppetAPI = PuppetAPI; diff --git a/sdk/dist/api/puppet.js.map b/sdk/dist/api/puppet.js.map index b6fb6e0..d9ccc50 100644 --- a/sdk/dist/api/puppet.js.map +++ b/sdk/dist/api/puppet.js.map @@ -1 +1 @@ -{"version":3,"file":"puppet.js","sourceRoot":"","sources":["../../src/api/puppet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,+DAAkD;AAClD,qDAA+C;AAG/C,wCAAqD;AAErD,MAAa,SAAS;IAEpB;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,SAAS,CACpB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,OAAe,EACf,MAAuB;QAEvB,MAAM,MAAM,GAAG,WAAW,CAAC;QAE3B,MAAM,MAAM,GAAG,CAAC,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACnD,MAAM,GAAG,GAAG,MAAM,wBAAc,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QAC1F,IAAI,MAAM,EAAE;YACV,O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AG,CAAC,CAAC;IACxB,CAAC;IAGD,oBAAoB;IAEpB,MAAM,CAAC,KAAK,CAAC,YAAY,CACvB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,OAAe,EACf,MAAuB;QAEvB,MAAM,MAAM,GAAG,gBAAgB,CAAC;QAChC,MAAM,KAAK,GAAG,CAAC,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAElD,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QAED,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAc,CAAA;IACpC,CAAC;CAEF;AAtdD,8BAsdC"} \ No newline at end of file diff --git a/sdk/dist/api/template.js b/sdk/dist/api/template.js index de34572..092f335 100644 --- a/sdk/dist/api/template.js +++ b/sdk/dist/api/template.js @@ -16,11 +16,11 @@ class TemplateAPI { neon_js_1.sc.ContractParam.boolean(paramD), neon_js_1.sc.ContractParam.array(...paramEFormatted) ]; - const res = await helpers_1.variableInvoke(node, networkMagic, contractHash, method, param, signer); + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); if (signer) { return res; } - return helpers_1.formatter(res[0]); + return (0, helpers_1.formatter)(res[0]); } } exports.TemplateAPI = TemplateAPI; diff --git a/sdk/dist/api/template.js.map b/sdk/dist/api/template.js.map index 4350ae8..cf7f971 100644 --- a/sdk/dist/api/template.js.map +++ b/sdk/dist/api/template.js.map @@ -1 +1 @@ -{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/api/template.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AAEvC,wCAAqD;AAErD,MAAa,WAAW;IAEtB,MAAM,CAAC,KAAK,CAAC,cAAc,CACzB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,MAAc,EACd,MAAc,EACd,MAAc,EACd,MAAe,EACf,MAAgB,EAChB,MAAuB;QAEvB,MAAM,MAAM,GAAG,2BAA2B,CAAC;QAE3C,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAE,CAAC,KAAK,EAAE,EAAE;YAC5C,OAAO,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACvC,CAAC,CAAC,CAAA;QAEF,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;YAC/B,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;YAChC,YAAE,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC;YAClC,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;YAChC,YAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,eAAe,CAAC;SAC3C,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,wBAAc,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,mBAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;CAEF;AAlCD,kCAkCC"} \ No newline at end of file +{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/api/template.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AAEvC,wCAAqD;AAErD,MAAa,WAAW;IAEtB,MAAM,CAAC,KAAK,CAAC,cAAc,CACzB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,MAAc,EACd,MAAc,EACd,MAAc,EACd,MAAe,EACf,MAAgB,EAChB,MAAuB;QAEvB,MAAM,MAAM,GAAG,2BAA2B,CAAC;QAE3C,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAE,CAAC,KAAK,EAAE,EAAE;YAC5C,OAAO,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACvC,CAAC,CAAC,CAAA;QAEF,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;YAC/B,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;YAChC,YAAE,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC;YAClC,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;YAChC,YAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,eAAe,CAAC;SAC3C,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;CAEF;AAlCD,kCAkCC"} \ No newline at end of file diff --git a/sdk/package-lock.json b/sdk/package-lock.json index 5438d72..d1af0e4 100644 --- a/sdk/package-lock.json +++ b/sdk/package-lock.json @@ -1,6 +1,6 @@ { "name": "@cityofzion/props", - "version": "0.1.2", + "version": "0.1.9", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -113,12 +113,26 @@ "util": "^0.12.0" } }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "available-typed-arrays": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", "dev": true }, + "axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "requires": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -280,6 +294,14 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -331,6 +353,11 @@ "object-keys": "^1.0.12" } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, "diff": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", @@ -451,12 +478,27 @@ "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, "foreach": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", "dev": true }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "fs": { "version": "0.0.1-security", "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", @@ -884,6 +926,19 @@ "integrity": "sha512-0gVrAjo5m0VZSJb4rpL59K1unJAMb/hm8HRXqasD8VeC8m91ytDPMritgFSlKonfdt+rRYYpP/JfLxgIX8yoSw==", "dev": true }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", diff --git a/sdk/package.json b/sdk/package.json index 6e6ef45..8c39aeb 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@cityofzion/props", - "version": "0.1.6", + "version": "0.1.9", "description": "an sdk for interfacing with props to use in decentralized applications", "main": "dist/index", "types": "dist/index", @@ -28,6 +28,7 @@ "@cityofzion/neon-js": "^5.0.0-next.16", "@types/lodash": "^4.14.176", "@types/node": "^16.11.11", + "axios": "^0.27.2", "lodash": "^4.17.21" }, "devDependencies": { diff --git a/sdk/src/Chest.ts b/sdk/src/Chest.ts index e441d98..221e1c4 100644 --- a/sdk/src/Chest.ts +++ b/sdk/src/Chest.ts @@ -98,9 +98,8 @@ export class Chest { while (timeout >= age) { try { let res = await txDidComplete(this.node.url, txid, true) - let formattedRes = formatter(res[0]) - formattedRes.scriptHash = u.reverseHex(u.str2hexstring(formattedRes.scripHash)) - return formattedRes + res[0].scriptHash = u.reverseHex(u.str2hexstring(res[0].scriptHash)) + return res } catch (e) { await sleep(1000) age += 1000 diff --git a/sdk/src/api/interface.ts b/sdk/src/api/interface.ts index 362a9db..9caa3d2 100644 --- a/sdk/src/api/interface.ts +++ b/sdk/src/api/interface.ts @@ -1,6 +1,7 @@ import Neon, {rpc, u} from "@cityofzion/neon-js"; import StackItemJson, { wallet, tx } from "@cityofzion/neon-core"; import {BigInteger} from "@cityofzion/neon-core/lib/u"; +import axios from 'axios' export interface InteropInterface { @@ -36,6 +37,29 @@ export class NeoInterface { if (res.exception) { throw new Error("Invocation Error: " + res.exception) } + if (res.stack[0].type === 'InteropInterface'){ + // @ts-ignore + // @ts-ignore + const ijson = { + // @ts-ignore + "jsonrpc": "2.0", + "id": 1, + "method": "traverseiterator", + "params": [ + // @ts-ignore + res.session, + // @ts-ignore + res.stack[0].id, + 100 + ] + } + const {data} = await axios({ + method: 'post', + url: rpcAddress, + data: ijson, + }) + return data.result + } return res.stack; } diff --git a/sdk/src/api/puppet.ts b/sdk/src/api/puppet.ts index 138a822..76da3f8 100644 --- a/sdk/src/api/puppet.ts +++ b/sdk/src/api/puppet.ts @@ -330,18 +330,17 @@ export class PuppetAPI { if (signer) { return res } - const iterator: InteropInterface = res[0] as InteropInterface - if (iterator.iterator && iterator.iterator.length >= 0) { - return iterator.iterator.map( (token: StackItemJson) => { - const attrs: StackItemJson[] = token.value as StackItemJson[] - return formatter(attrs[1]) - }) - } - - - throw new Error("unable to resolve respond format") - + // @ts-ignore + const tokens: string[] = [] + res.forEach((token: any) => { + if (token.value.length === 2) { + tokens.push(formatter(token.value[1])) + } else { + tokens.push(formatter(token)) + } + }) + return tokens } /** From db1118fa30defc6e57299f2d9b8cd22ec406b37c Mon Sep 17 00:00:00 2001 From: Tyler Adams Date: Mon, 19 Dec 2022 08:17:27 -0700 Subject: [PATCH 5/9] checkpoint --- contracts/gift/__init__.py | 0 contracts/gift/gift.py | 971 ++++++++++++++++++++++++++++ sdk/dist/Chest.d.ts | 43 -- sdk/dist/Chest.js | 114 ---- sdk/dist/Chest.js.map | 1 - sdk/dist/Collection.d.ts | 167 ----- sdk/dist/Collection.js | 244 ------- sdk/dist/Collection.js.map | 1 - sdk/dist/Dice.d.ts | 98 --- sdk/dist/Dice.js | 145 ----- sdk/dist/Dice.js.map | 1 - sdk/dist/Generator.d.ts | 23 - sdk/dist/Generator.js | 113 ---- sdk/dist/Generator.js.map | 1 - sdk/dist/Puppet.d.ts | 31 - sdk/dist/Puppet.js | 132 ---- sdk/dist/Puppet.js.map | 1 - sdk/dist/Template.d.ts | 37 -- sdk/dist/Template.js | 81 --- sdk/dist/Template.js.map | 1 - sdk/dist/api/chest.d.ts | 9 - sdk/dist/api/chest.js | 87 --- sdk/dist/api/chest.js.map | 1 - sdk/dist/api/collection.d.ts | 17 - sdk/dist/api/collection.js | 202 ------ sdk/dist/api/collection.js.map | 1 - sdk/dist/api/dice.d.ts | 7 - sdk/dist/api/dice.js | 58 -- sdk/dist/api/dice.js.map | 1 - sdk/dist/api/generator.d.ts | 17 - sdk/dist/api/generator.js | 153 ----- sdk/dist/api/generator.js.map | 1 - sdk/dist/api/index.d.ts | 7 - sdk/dist/api/index.js | 20 - sdk/dist/api/index.js.map | 1 - sdk/dist/api/interface.d.ts | 29 - sdk/dist/api/interface.js | 95 --- sdk/dist/api/interface.js.map | 1 - sdk/dist/api/puppet.d.ts | 109 ---- sdk/dist/api/puppet.js | 323 --------- sdk/dist/api/puppet.js.map | 1 - sdk/dist/api/template.d.ts | 4 - sdk/dist/api/template.js | 27 - sdk/dist/api/template.js.map | 1 - sdk/dist/helpers/helpers.d.ts | 8 - sdk/dist/helpers/helpers.js | 143 ---- sdk/dist/helpers/helpers.js.map | 1 - sdk/dist/helpers/index.d.ts | 1 - sdk/dist/helpers/index.js | 14 - sdk/dist/helpers/index.js.map | 1 - sdk/dist/index.d.ts | 9 - sdk/dist/index.js | 35 - sdk/dist/index.js.map | 1 - sdk/dist/interface/index.d.ts | 1 - sdk/dist/interface/index.js | 14 - sdk/dist/interface/index.js.map | 1 - sdk/dist/interface/interface.d.ts | 106 --- sdk/dist/interface/interface.js | 23 - sdk/dist/interface/interface.js.map | 1 - sdk/src/Gift.ts | 163 +++++ sdk/src/api/gift.ts | 478 ++++++++++++++ 61 files changed, 1612 insertions(+), 2765 deletions(-) create mode 100644 contracts/gift/__init__.py create mode 100644 contracts/gift/gift.py delete mode 100644 sdk/dist/Chest.d.ts delete mode 100644 sdk/dist/Chest.js delete mode 100644 sdk/dist/Chest.js.map delete mode 100644 sdk/dist/Collection.d.ts delete mode 100644 sdk/dist/Collection.js delete mode 100644 sdk/dist/Collection.js.map delete mode 100644 sdk/dist/Dice.d.ts delete mode 100644 sdk/dist/Dice.js delete mode 100644 sdk/dist/Dice.js.map delete mode 100644 sdk/dist/Generator.d.ts delete mode 100644 sdk/dist/Generator.js delete mode 100644 sdk/dist/Generator.js.map delete mode 100644 sdk/dist/Puppet.d.ts delete mode 100644 sdk/dist/Puppet.js delete mode 100644 sdk/dist/Puppet.js.map delete mode 100644 sdk/dist/Template.d.ts delete mode 100644 sdk/dist/Template.js delete mode 100644 sdk/dist/Template.js.map delete mode 100644 sdk/dist/api/chest.d.ts delete mode 100644 sdk/dist/api/chest.js delete mode 100644 sdk/dist/api/chest.js.map delete mode 100644 sdk/dist/api/collection.d.ts delete mode 100644 sdk/dist/api/collection.js delete mode 100644 sdk/dist/api/collection.js.map delete mode 100644 sdk/dist/api/dice.d.ts delete mode 100644 sdk/dist/api/dice.js delete mode 100644 sdk/dist/api/dice.js.map delete mode 100644 sdk/dist/api/generator.d.ts delete mode 100644 sdk/dist/api/generator.js delete mode 100644 sdk/dist/api/generator.js.map delete mode 100644 sdk/dist/api/index.d.ts delete mode 100644 sdk/dist/api/index.js delete mode 100644 sdk/dist/api/index.js.map delete mode 100644 sdk/dist/api/interface.d.ts delete mode 100644 sdk/dist/api/interface.js delete mode 100644 sdk/dist/api/interface.js.map delete mode 100644 sdk/dist/api/puppet.d.ts delete mode 100644 sdk/dist/api/puppet.js delete mode 100644 sdk/dist/api/puppet.js.map delete mode 100644 sdk/dist/api/template.d.ts delete mode 100644 sdk/dist/api/template.js delete mode 100644 sdk/dist/api/template.js.map delete mode 100644 sdk/dist/helpers/helpers.d.ts delete mode 100644 sdk/dist/helpers/helpers.js delete mode 100644 sdk/dist/helpers/helpers.js.map delete mode 100644 sdk/dist/helpers/index.d.ts delete mode 100644 sdk/dist/helpers/index.js delete mode 100644 sdk/dist/helpers/index.js.map delete mode 100644 sdk/dist/index.d.ts delete mode 100644 sdk/dist/index.js delete mode 100644 sdk/dist/index.js.map delete mode 100644 sdk/dist/interface/index.d.ts delete mode 100644 sdk/dist/interface/index.js delete mode 100644 sdk/dist/interface/index.js.map delete mode 100644 sdk/dist/interface/interface.d.ts delete mode 100644 sdk/dist/interface/interface.js delete mode 100644 sdk/dist/interface/interface.js.map create mode 100644 sdk/src/Gift.ts create mode 100644 sdk/src/api/gift.ts diff --git a/contracts/gift/__init__.py b/contracts/gift/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/contracts/gift/gift.py b/contracts/gift/gift.py new file mode 100644 index 0000000..1e3bcd6 --- /dev/null +++ b/contracts/gift/gift.py @@ -0,0 +1,971 @@ +from typing import Any, Dict, List, Union, cast, Optional +from boa3.builtin import contract, CreateNewEvent, NeoMetadata, metadata, public +from boa3.builtin.contract import abort +from boa3.builtin.interop.blockchain import get_contract, Transaction +from boa3.builtin.interop.contract import call_contract, update_contract, GAS +from boa3.builtin.interop.runtime import get_random, get_network, burn_gas, gas_left, check_witness, script_container, calling_script_hash +from boa3.builtin.interop.stdlib import serialize, deserialize, itoa +from boa3.builtin.interop.storage import delete, get, put, find, get_context +from boa3.builtin.interop.storage.findoptions import FindOptions +from boa3.builtin.interop.iterator import Iterator +from boa3.builtin.type import UInt160, ByteString + +# ------------------------------------------- +# METADATA +# ------------------------------------------- + + +@metadata +def manifest_metadata() -> NeoMetadata: + """ + Defines this smart contract's metadata information + """ + meta = NeoMetadata() + meta.author = 'COZ, Inc.' + meta.description = 'An NFT for giving thanks' + meta.email = 'contact@coz.io' + meta.supported_standards = ['NEP-11'] + return meta + + +# ------------------------------------------- +# TOKEN SETTINGS +# ------------------------------------------- + +# Symbol of the Token +TOKEN_SYMBOL = 'GIFT' + +# Number of decimal places +TOKEN_DECIMALS = 0 + +# ------------------------------------------- +# Keys +# ------------------------------------------- + +# Stores the total token count +TOKEN_COUNT: bytes = b'!TOKEN_COUNT' + +# Epoch count +EPOCH_COUNT: bytes = b'EPOCH_COUNT' + +# Stores the total account count +ACCOUNT_COUNT: bytes = b'!ACCOUNT_COUNT' + +# ------------------------------------------- +# Events +# ------------------------------------------- + +on_transfer = CreateNewEvent( + # trigger when tokens are transferred, including zero value transfers. + [ + ('from_addr', Union[UInt160, None]), + ('to_addr', Union[UInt160, None]), + ('amount', int), + ('token_id', ByteString) + ], + 'Transfer' +) + +# ------------------------------------------- +# NEP-11 Methods +# ------------------------------------------- + + +@public(safe=True) +def symbol() -> str: + """ + Gets the symbols of the token. + + This string must be valid ASCII, must not contain whitespace or control puppets, should be limited to uppercase + Latin alphabet (i.e. the 26 letters used in English) and should be short (3-8 puppets is recommended). + This method must always return the same value every time it is invoked. + + :return: a short string representing symbol of the token managed in this contract. + """ + return TOKEN_SYMBOL + + +@public(safe=True) +def decimals() -> int: + """ + Gets the amount of decimals used by the token. + + E.g. 8, means to divide the token amount by 100,000,000 (10 ^ 8) to get its user representation. + This method must always return the same value every time it is invoked. + + :return: the number of decimals used by the token. + """ + return TOKEN_DECIMALS + + +@public(safe=True) +def totalSupply() -> int: + """ + Gets the total token supply deployed in the system. + + This number must not be in its user representation. E.g. if the total supply is 10,000,000 tokens, this method + must return 10,000,000 * 10 ^ decimals. + + :return: the total token supply deployed in the system. + """ + total: bytes = get(TOKEN_COUNT) + if len(total) == 0: + return 0 + return total.to_int() + + +@public(safe=True) +def balanceOf(owner: UInt160) -> int: + """ + Get the current balance of an address + + The parameter owner must be a 20-byte address represented by a UInt160. + + :param owner: the owner address to retrieve the balance for + :type owner: UInt160 + :return: the total amount of tokens owned by the specified address. + :raise AssertionError: raised if `owner` length is not 20. + """ + assert len(owner) == 20, 'Incorrect `owner` length' + user: User = get_user(owner) + return user.get_balance_of() + + +@public(safe=True) +def tokensOf(owner: UInt160) -> Iterator: + """ + Get all of the token ids owned by the specified address + + The parameter owner must be a 20-byte address represented by a UInt160. + + :param owner: the owner address to retrieve the tokens for + :type owner: UInt160 + :return: an iterator that contains all of the token ids owned by the specified address. + :raise AssertionError: raised if `owner` length is not 20. + """ + assert len(owner) == 20, 'Incorrect `owner` length' + user: User = get_user(owner) + return user.get_owned_tokens() + + +@public +def transfer(to: UInt160, token_id: ByteString, data: Any) -> bool: + """ + Transfers the token with id token_id to address to + + The parameter to SHOULD be a 20-byte address. If not, this method SHOULD throw an exception. The parameter + token_id SHOULD be a valid NFT. If not, this method SHOULD throw an exception. If the method succeeds, + it MUST fire the Transfer event, and MUST return true, even if the token is sent to the owner. If the receiver is + a deployed contract, the function MUST call onNEP11Payment method on receiver contract with the data parameter + from transfer AFTER firing the Transfer event. + + The function SHOULD check whether the owner address equals the caller contract hash. If so, the transfer SHOULD be + processed; If not, the function SHOULD use the SYSCALL Neo.Runtime.CheckWitness to verify the transfer. + + If the transfer is not processed, the function SHOULD return false. + + :param to: the address to transfer to + :type to: UInt160 + :param token_id: the token to transfer + :type token_id: ByteString + :param data: whatever data is pertinent to the onPayment method + :type data: Any + :return: whether the transfer was successful + :raise AssertionError: raised if `to` length is not 20 or if `token_id` is not a valid + NFT + """ + assert len(to) == 20, 'Incorrect `to` length' + + token: Token = get_token(cast(bytes, token_id)) + token_owner: UInt160 = token.get_owner() + formatted_token_id: bytes = token.get_token_id() + if not check_witness(token_owner): + return False + + owner_user: User = get_user(token_owner) + to_user: User = get_user(to) + + if token_owner != to: + + owner_user.remove_owned_token(formatted_token_id) + to_user.add_owned_token(formatted_token_id) + + save_user(token_owner, owner_user) + save_user(to, to_user) + + token.set_owner(to) + save_token(token) + + post_transfer(token_owner, to, token_id, data) + return True + + +def post_transfer(token_owner: Union[UInt160, None], to: Union[UInt160, None], token_id: ByteString, data: Any): + """ + Checks if the one receiving NEP11 tokens is a smart contract and if it's one the onPayment method will be called + - internal + + :param token_owner: the address of the sender + :type token_owner: UInt160 + :param to: the address of the receiver + :type to: UInt160 + :param token_id: the token hash as bytes + :type token_id: bytes + :param data: any pertinent data that might validate the transaction + :type data: Any + """ + on_transfer(token_owner, to, 1, token_id) + if not isinstance(to, None): # TODO: change to 'is not None' when `is` semantic is implemented + recipient_contract = get_contract(to) + if not isinstance(recipient_contract, None): # TODO: change to 'is not None' when `is` semantic is implemented + call_contract(to, 'onNEP11Payment', [token_owner, 1, token_id, data]) + pass + + +@public(safe=True) +def ownerOf(token_id: ByteString) -> UInt160: + """ + Get the owner of the specified token. + + The parameter token_id SHOULD be a valid NFT. If not, this method SHOULD throw an exception. + + :param token_id: the token for which to check the ownership + :type token_id: ByteString + :return: the owner of the specified token. + :raise AssertionError: raised if `token_id` is not a valid NFT. + """ + token: Token = get_token(token_id) + owner = token.get_owner() + return owner + + +@public(safe=True) +def tokens() -> Iterator: + """ + Get all tokens minted by the contract + + :return: an iterator that contains all of the tokens minted by the contract. + """ + flags = FindOptions.REMOVE_PREFIX + context = get_context() + return find(TOKEN_PREFIX, context, flags) + + +@public(safe=True) +def properties(tokenId: ByteString) -> Dict[Any, Any]: + """ + Get the properties of a token. + + The parameter token_id SHOULD be a valid NFT. If no metadata is found (invalid token_id), an exception is thrown. + + :param token_id: the token for which to check the properties + :type token_id: ByteString + :return: a serialized NVM object containing the properties for the given NFT. + :raise AssertionError: raised if `token_id` is not a valid NFT, or if no metadata available. + """ + token_json = get_token_json_flat(tokenId) + assert len(token_json) != 0, 'Token does not exist' + + return token_json + + +@public +def _deploy(data: Any, update: bool): + """ + Executes the deploy event by creating the initial contract state and admin account + :param owner: The initial admin of of the smart contract + :return: a boolean indicating success + """ + + if not update: + put(TOKEN_COUNT, 0) + put(ACCOUNT_COUNT, 1) + + super_user_permissions: Dict[str, bool] = { + 'offline_mint': True, + 'contract_upgrade': True, + 'set_mint_fee': True, + 'create_epoch': True, + 'set_permissions': True + } + + tx = cast(Transaction, script_container) + owner: UInt160 = tx.sender + + user: User = User() + user.set_permissions(super_user_permissions) + save_user(owner, user) + + +@public +def onNEP11Payment(from_address: UInt160, amount: int, token_id: bytes, data: Any): + """ + :param from_address: the address of the one who is trying to send cryptocurrency to this smart contract + :type from_address: UInt160 + :param amount: the amount of cryptocurrency that is being sent to the this smart contract + :type amount: int + :param token_id: the token hash as bytes + :type token_id: bytes + :param data: any pertinent data that might validate the transaction + :type data: Any + """ + abort() + + +@public +def onNEP17Payment(from_address: UInt160, amount: int, data: Any): + """ + :param from_address: the address of the one who is trying to send cryptocurrency to this smart contract + :type from_address: UInt160 + :param amount: the amount of cryptocurrency that is being sent to the this smart contract + :type amount: int + :param data: any pertinent data that might validate the transaction + :type data: Any + """ + abort() + + +# ------------------------------------------- +# Methods +# ------------------------------------------- + + +@public +def total_accounts() -> int: + """ + Gets the number of accounts. + + :return: the number of accounts in the system. + """ + total: bytes = get(ACCOUNT_COUNT) + if len(total) == 0: + return 0 + return total.to_int() + + +@public +def offline_mint(epoch_id: bytes, account: UInt160) -> bytes: + """ + mints a token from an epoch + :param account: the account to mint to + :return: the token_id of the minted token + :raise AssertionError: raised if the signer does not have `offline_mint` permission. + """ + tx = cast(Transaction, script_container) + user: User = get_user(tx.sender) + assert user.get_offline_mint(), 'User Permission Denied' + return internal_mint(epoch_id, account) + + +@public +def update(script: bytes, manifest: bytes, data: Any): + """ + Upgrade the contract. + + :param script: the contract script + :type script: bytes + :param manifest: the contract manifest + :type manifest: bytes + :raise AssertionError: raised if the signer does not have the 'update' permission + """ + tx = cast(Transaction, script_container) + user: User = get_user(tx.sender) + assert user.get_contract_upgrade(), 'User Permission Denied' + + update_contract(script, manifest, data) + + +@public +def set_mint_fee(epoch_id: bytes, amount: int) -> bool: + """ + Updates the mint fee for a puppet + :param epoch_id: the id of the epoch to set the mint fee for + :param amount: the GAS cost to charge for the minting of a puppet + :raise AssertionError: raised if the signer does not have the 'offline_mint' permission + :return: A boolean indicating success + """ + tx = cast(Transaction, script_container) + user: User = get_user(tx.sender) + assert user.get_set_mint_fee(), "User Permission Denied" + + epoch: Epoch = get_epoch(epoch_id) + epoch.set_fee(amount) + save_epoch(epoch) + + return True + + +def internal_mint(epoch_id: bytes, owner: UInt160) -> bytes: + """ + Mint new token - internal + + :param epoch_id: the epoch id to mint from + :param owner: the address of the account that is minting token + :type owner: UInt160 + :return: token_id of the token minted + """ + + # remaining GAS before branching code + start_gas: int = gas_left + + mint_epoch: Epoch = get_epoch(epoch_id) + assert mint_epoch.can_mint(), 'No available tokens to mint in the selected epoch' + + mint_epoch.increment_supply() + save_epoch(mint_epoch) + + token_id_int: int = (totalSupply() + 1) + token_id_string: bytes = itoa(token_id_int) + new_token: Token = Token() + new_token.generate(owner, token_id_string, epoch_id) + + save_token(new_token) + put(TOKEN_COUNT, token_id_int) + + user: User = get_user(owner) + user.add_owned_token(token_id_string) + save_user(owner, user) + + post_transfer(None, owner, token_id_string, None) + + end_gas: int = gas_left + compute_cost: int = start_gas - end_gas + epoch_system_fee: int = mint_epoch.get_sys_fee() + burn_amount: int = epoch_system_fee - compute_cost + + burn_gas(burn_amount) + + return token_id_string + + +# ############################# +# ########### User ############ +# ############################# + + +ACCOUNT_PREFIX = b'a' +TOKEN_INDEX_PREFIX = b'i' + + +class User: + + def __init__(self): + self._balance: int = 0 + self._permissions: Dict[str, bool] = { + 'offline_mint': False, + 'contract_upgrade': False, + 'set_mint_fee': False, + 'create_epoch': False, + 'set_permissions': False + } + + self._account_id: bytes = (total_accounts() + 1).to_bytes() + + def export(self) -> Dict[str, Any]: + exported: Dict[str, Any] = { + 'balance': self._balance, + 'account_id': self._account_id, + 'permissions': self._permissions + } + return exported + + def set_permissions(self, permissions: Dict[str, bool]) -> bool: + perm_clone = self._permissions + for key in permissions.keys(): + perm_clone[key] = permissions[key] + self._permissions = perm_clone + return True + + def get_account_id(self) -> bytes: + return self._account_id + + def get_balance_of(self) -> int: + return self._balance + + def get_owned_tokens(self) -> Iterator: + return find(mk_token_index_key(self._account_id)) + + def add_owned_token(self, token_id: bytes) -> bool: + key: bytes = mk_token_index_key(self._account_id) + token_id + self._balance = self._balance + 1 + put(key, token_id) + return True + + def remove_owned_token(self, token_id: bytes) -> bool: + key: bytes = mk_token_index_key(self._account_id) + token_id + self._balance = self._balance - 1 + delete(key) + return True + + def get_offline_mint(self) -> bool: + return self._permissions['offline_mint'] + + def get_set_permissions(self) -> bool: + return self._permissions['set_permissions'] + + def get_contract_upgrade(self) -> bool: + return self._permissions['contract_upgrade'] + + def get_set_mint_fee(self) -> bool: + return self._permissions['set_mint_fee'] + + def get_create_epoch(self) -> bool: + return self._permissions['create_epoch'] + + +@public +def get_user_json(address: UInt160) -> Dict[str, Any]: + """ + Gets the JSON representation of a user account + :param address: The address being requested + :return: A Dict representing the user + """ + user: User = get_user(address) + return user.export() + +@public +def get_user(address: UInt160) -> User: + """ + Gets a User instance + :param address: The address being requested + :return: The User instance for the requested address + """ + user_bytes: bytes = get_user_raw(address) + if len(user_bytes) != 0: + return cast(User, deserialize(user_bytes)) + + return User() + + +def get_user_raw(address: UInt160) -> bytes: + return get(mk_user_key(address)) + + +def save_user(address: UInt160, user: User) -> bool: + """ + Saves a user instance + :param address: The address to save the user against + :param user: the User instance being saved + :return: A bool indicating completion + """ + account_id: bytes = user.get_account_id() + account_count: int = total_accounts() + if account_id.to_int() > account_count: + put(ACCOUNT_COUNT, account_id) + + put(mk_user_key(address), serialize(user)) + return True + + +def mk_user_key(address: UInt160) -> bytes: + return ACCOUNT_PREFIX + address + + +def mk_token_index_key(account_id: bytes) -> bytes: + return TOKEN_INDEX_PREFIX + account_id + b'_' + + +@public +def set_user_permissions(user: UInt160, permissions: Dict[str, bool]) -> bool: + """ + Sets a user's permissions + :param user: The address of the user to edit + :param permissions: A dictionary representing the permissions to update + :return: a boolean indicating success + """ + tx = cast(Transaction, script_container) + invoking_user: User = get_user(tx.sender) + assert invoking_user.get_set_permissions(), 'User Permission Denied' + + impacted_user: User = get_user(user) + impacted_user.set_permissions(permissions) + save_user(user, impacted_user) + return True + + +# ############################# +# ########## Epoch ############ +# ############################# +# ############################# + + +EPOCH_PREFIX = b'e' + + +class Epoch: + def __init__(self, label: bytes, generator_instance_id: bytes, initial_roll_collection_id: bytes, mint_fee: int, sys_fee: int, max_supply: int, author: UInt160): + self._author: UInt160 = author + self._label: bytes = label + self._epoch_id: bytes = (total_epochs() + 1).to_bytes() + self._generator_instance_id: bytes = generator_instance_id + self._initial_roll_collection_id: bytes = initial_roll_collection_id + self._mint_fee: int = mint_fee + self._sys_fee: int = sys_fee + self._max_supply: int = max_supply + self._total_supply: int = 0 + + def can_mint(self) -> bool: + return self._max_supply > self.get_total_supply() + + def get_id(self) -> bytes: + return self._epoch_id + + def get_author(self) -> UInt160: + return self._author + + def get_generator_instance_id(self) -> bytes: + return self._generator_instance_id + + def get_initial_roll_collection_id(self) -> bytes: + return self._initial_roll_collection_id + + def get_label(self) -> bytes: + return self._label + + def get_mint_fee(self) -> int: + return self._mint_fee + + def get_sys_fee(self) -> int: + return self._sys_fee + + def get_max_supply(self) -> int: + return self._max_supply + + def get_total_supply(self) -> int: + return self._total_supply + + def export(self) -> Dict[str, Any]: + exported: Dict[str, Any] = { + 'author': self._author, + 'label': self._label, + 'epochId': self._epoch_id, + 'generatorInstanceId': self._generator_instance_id, + 'initialRollCollectionId': self._initial_roll_collection_id, + 'mintFee': self._mint_fee, + 'sysFee': self._sys_fee, + 'maxSupply': self._max_supply, + 'totalSupply': self.get_total_supply() + } + return exported + + def increment_supply(self) -> int: + self._total_supply = self._total_supply + 1 + return self._total_supply + + def set_fee(self, new_fee: int) -> bool: + self._mint_fee = new_fee + return True + + +@public +def create_epoch(label: bytes, generator_instance_id: bytes, initial_roll_collection_id: bytes, mint_fee: int, sys_fee: int, max_supply: int) -> int: + tx = cast(Transaction, script_container) + author: UInt160 = tx.sender + + user: User = get_user(author) + assert user.get_create_epoch(), 'User Permission Denied' + + new_epoch: Epoch = Epoch(label, generator_instance_id, initial_roll_collection_id, mint_fee, sys_fee, max_supply, author) + epoch_id: bytes = new_epoch.get_id() + epoch_id_int: int = epoch_id.to_int() + + save_epoch(new_epoch) + put(EPOCH_COUNT, epoch_id) + return epoch_id_int + + +@public +def get_epoch_json(epoch_id: bytes) -> Dict[str, Any]: + epoch: Epoch = get_epoch(epoch_id) + return epoch.export() + + +@public +def get_epoch(epoch_id: bytes) -> Epoch: + epoch_bytes: bytes = get_epoch_raw(epoch_id) + return cast(Epoch, deserialize(epoch_bytes)) + + +def get_epoch_raw(epoch_id: bytes) -> bytes: + return get(mk_epoch_key(epoch_id)) + + +@public +def total_epochs() -> int: + """ + Gets the total epoch count. No + + Epoch id is an incrementor so users can iterator from 1 - total_epochs() to dump every epoch on the contract. + + :return: the total token epochs deployed in the system. + """ + total: bytes = get(EPOCH_COUNT) + if len(total) == 0: + return 0 + return total.to_int() + + +def save_epoch(epoch: Epoch) -> bool: + epoch_id: bytes = epoch.get_id() + put(mk_epoch_key(epoch_id), serialize(epoch)) + return True + + +def mk_epoch_key(epoch_id: bytes) -> bytes: + return EPOCH_PREFIX + epoch_id + + +# ############################# +# ########## Puppet ########### +# ############################# +# ############################# + + +TOKEN_PREFIX = b't' + +class Token: + + def __init__(self): + self._token_id: bytes = b'' + self._epoch_token_id: int = 0 + self._epoch_id: bytes = b'' + self._traits: Dict[str, Any] = {} + self._owner: UInt160 = UInt160() + self._seed: bytes = b'' + + def export(self) -> Dict[str, Any]: + exported: Dict[str, Any] = { + 'owner': self._owner, + 'tokenId': self._token_id, + 'traits': self._traits, + 'epochId': self._epoch_id, + 'epochTokenId': self._epoch_token_id + } + return exported + + def generate(self, owner: UInt160, token_id: bytes, epoch_id: bytes) -> bool: + """ + Generates a puppet's core features + @return: boolean indicating success + """ + # generate base attributes + target_epoch: Epoch = get_epoch(epoch_id) + + # mint traits + instance_id_bytes: bytes = target_epoch.get_generator_instance_id() + traits: Dict[str, Any] = Generator.mint_from_instance(epoch_id, instance_id_bytes) + + self._traits = traits + self._epoch_id = epoch_id + + # Generate a puppet token_id and set the owner + self._owner = owner + self._token_id = token_id + self._epoch_token_id = target_epoch.get_total_supply() + + # Generate a seed for external use and future scalability + entropy: bytes = get_random().to_bytes() + pruned_entropy: bytes = entropy[0:16] + self._seed = pruned_entropy + + return True + + + def get_owner(self) -> UInt160: + """ + Getter for the puppet owner + @return: bytes representing the owner of the puppet + """ + return UInt160(self._owner) + + + def get_state(self) -> Dict[str, Any]: + """ + Gets the state of the puppet. This differs from an export in that it includes all secondary features like + armor class, name, and tokenURI. + @return: + """ + token_id_bytes: bytes = self._token_id + epoch_token_id_int: int = self._epoch_token_id + epoch_id_bytes: bytes = self._epoch_id + + epoch_id_int: int = epoch_id_bytes.to_int() + epoch: Epoch = get_epoch(epoch_id_bytes) + epoch_label: bytes = epoch.get_label() + epoch_max_supply: int = epoch.get_max_supply() + + network_magic: int = get_network + network_magic_string: str = itoa(network_magic) + + state: str = 'closed' + #TODO - if get eligibility is false, set state = `opened` + + exported: Dict[str, Any] = { + 'description': state + ' gift', + 'epochId': epoch_id_int, + 'image': 'https://props.coz.io/img/gift/neo/' + state + '.png', + 'name': 'gift', + 'owner': self._owner, + 'seed': self._seed, + 'tokenId': token_id_bytes, + 'tokenURI': 'https://props.coz.io/tok/gift/neo/' + network_magic_string + '/' + token_id_bytes.to_str(), + 'traits': self._traits, + } + return exported + + def get_state_flat(self) -> Dict[str, Any]: + """ + Gets the state of the puppet and returns the data in a flat format. + :return: the puppet in a flat format + """ + token_id_bytes: bytes = self._token_id + epoch_token_id_int: int = self._epoch_token_id + epoch_id_bytes: bytes = self._epoch_id + + epoch_id_int: int = epoch_id_bytes.to_int() + epoch: Epoch = get_epoch(epoch_id_bytes) + epoch_label: bytes = epoch.get_label() + epoch_max_supply: int = epoch.get_max_supply() + + network_magic: int = get_network + network_magic_string: str = itoa(network_magic) + + token_attrs: List[Any] = [ + { + 'trait_type': 'epochId', + 'value': epoch_id_int + }, + ] + + traits: Dict[str, Any] = self._traits + for trait in traits.keys(): + token_attrs.append( + { + 'trait_type': 'traits.' + trait, + 'value': traits[trait] + } + ) + + state: str = 'closed' + # TODO - if get eligibility is false, set state = `opened` + + exported: Dict[str, Any] = { + 'name': 'gift', + 'image': 'https://props.coz.io/img/puppets/neo/' + state + '.png', + 'tokenURI': 'https://props.coz.io/tok/puppets/neo/' + network_magic_string + '/' + token_id_bytes.to_str(), + 'owner': self._owner, + 'seed': self._seed, + 'tokenId': token_id_bytes.to_str(), + 'description': state + ' gift', + 'attributes': token_attrs + } + return exported + + def get_token_id(self) -> bytes: + """ + Getter for the puppet unique identifier + @return: integer representing the unique identifier + """ + return self._token_id + + def load(self, abstract: Dict[str, Any]) -> bool: + """ + Loads a puppet from a puppet abstract + @param abstract: a puppet abstract json + @return: a boolean indicating the success + """ + attributes: Dict[str, int] = abstract['attributes'] + self._traits: [str] = abstract['traits'] + self._token_id: [int] = abstract['tokenId'] + self._owner: bytes = abstract['owner'] + return True + + def set_owner(self, owner: UInt160) -> bool: + """ + Setter for the puppet owner + @param owner: bytes representing the owner of the puppet + @return: Boolean indicating success + """ + self._owner = owner + return True + + +@public +def get_token(token_id: ByteString) -> Token: + """ + A factory method to get a puppet from storage + :param token_id: the unique identifier of the puppet + :return: The requested puppet + """ + token_bytes: bytes = get_token_raw(cast(bytes, token_id)) + return cast(Token, deserialize(token_bytes)) + + +@public +def get_token_json(token_id: bytes) -> Dict[str, Any]: + """ + Gets a dict representation of the puppet's base stats + :param token_id: the unique puppet identifier + :return: A dict representing the puppet + """ + token: Token = get_token(cast(bytes, token_id)) + return token.get_state() + + +@public +def get_token_json_flat(token_id: ByteString) -> Dict[str, Any]: + token: Token = get_token(cast(bytes, token_id)) + return token.get_state_flat() + + +def get_token_raw(token_id: bytes) -> bytes: + """ + Gets the serialized puppet definition + :param token_id: the unique puppet identifier + :return: a serialize puppet + """ + return get(mk_token_key(token_id)) + + +def save_token(token: Token) -> bool: + """ + A factory method to persist a puppet to storage + :param puppet: A puppet to save + :return: A boolean representing the results of the save + """ + token_id: bytes = token.get_token_id() + put(mk_token_key(token_id), serialize(token)) + return True + + +def mk_token_key(token_id: bytes) -> bytes: + return TOKEN_PREFIX + token_id + + +# ############INTERFACES########### +# ############INTERFACES########### +# ############INTERFACES########### + + +@contract('0xacf2aa5d0899e860eebd8b8a5454aa3017543848') +class Collection: + + @staticmethod + def sample_from_collection(collection_id: int, samples: int) -> List[bytes]: + pass + + +@contract('0x16d6a0be0506b26e0826dd352724cda0defa7131') +class Dice: + + @staticmethod + def rand_between(start: int, end: int) -> int: + pass + + +@contract('0xa3e59ddc61b2d8ac42c519cee5ddaac83c7df276') +class Generator: + + @staticmethod + def mint_from_instance(from_code: bytes, to_instance_id: bytes) -> Dict[str, Any]: + pass diff --git a/sdk/dist/Chest.d.ts b/sdk/dist/Chest.d.ts deleted file mode 100644 index 5dfa491..0000000 --- a/sdk/dist/Chest.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { rpc, wallet } from '@cityofzion/neon-core'; -import { PropConstructorOptions } from "./interface"; -/** - TEMPLATE CONTRACT CLASS - Use this class template to build out the typescript interface for your smart contract. If you rename this or the - `api` equivalent, make sure to update the respective `index.ts` and rebuild. - */ -export declare class Chest { - private options; - private networkMagic; - constructor(options?: PropConstructorOptions); - /** - * DO NOT EDIT ME - * Gets the magic number for the network and configures the class instance. - */ - init(): Promise; - /** - * DO NOT EDIT ME - * The the node that the instance is connected to. - */ - get node(): rpc.RPCClient; - /** - * DO NOT EDIT ME - * The contract script hash that is being interfaced with. - */ - get scriptHash(): string; - /** - * - * EDIT ME!!! - * - * This template method is designed to be a passthough so you should really only be changing the name and parameter types. - * All the magic happens in the TemplateAPI.templateMethod. Check there to align your sdk with your smart contract. - * Create one of these pass throughs for each method you expose in your smart contract. The goal of this entire class is to - * simplify the network configuration steps which can be complicated. - */ - createChest(name: string, type: number, eligibleEpochs: [number], puppetTraits: any, signer: wallet.Account): Promise; - isPuppetEligible(chestId: string, puppetId: string, signer?: wallet.Account): Promise; - lootChestWithPuppet(chestId: string, puppetId: string, signer: wallet.Account): Promise; - lootChestWithPuppetVerified(chestId: string, puppetId: string, signer: wallet.Account): Promise; - lootChestAsOwner(chestId: string, signer: wallet.Account): Promise; - getChestJSON(chestId: string, signer?: wallet.Account): Promise; - totalChests(name: string, type: number, signer?: wallet.Account): Promise; -} diff --git a/sdk/dist/Chest.js b/sdk/dist/Chest.js deleted file mode 100644 index d935902..0000000 --- a/sdk/dist/Chest.js +++ /dev/null @@ -1,114 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Chest = void 0; -const lodash_1 = require("lodash"); -const neon_core_1 = require("@cityofzion/neon-core"); -const api_1 = require("./api"); -const interface_1 = require("./interface"); -const helpers_1 = require("./helpers"); -const DEFAULT_OPTIONS = { - network: interface_1.NetworkOption.LocalNet -}; -/** - TEMPLATE CONTRACT CLASS - Use this class template to build out the typescript interface for your smart contract. If you rename this or the - `api` equivalent, make sure to update the respective `index.ts` and rebuild. - */ -class Chest { - // Once you get a scriptHash from deploying your smart contract via `npm run deploy`, update the `this.options.scriptHash` value. - // The default is analogous to localnet (neo-express) so you will most likely want to be updating that value. Remember to - // compile the sdk before use or your change wont take effect. Do that by running `tsc` in the sdk directory. - constructor(options = {}) { - this.options = DEFAULT_OPTIONS; - this.networkMagic = -1; - switch (options.network) { - case interface_1.NetworkOption.TestNet: - this.options.node = 'https://testnet1.neo.coz.io:443'; - this.options.scriptHash = ''; - break; - case interface_1.NetworkOption.MainNet: - this.options.node = 'https://mainnet1.neo.coz.io:443'; - this.options.scriptHash = '0xb94e721f5425ba1d8830ad752e50e0474f989da5'; - break; - default: - this.options.node = 'http://localhost:50012'; - this.options.scriptHash = '0x3fb4df29c0c200eff40f465cd028647b8a82f002'; - break; - } - this.options = (0, lodash_1.merge)({}, this.options, options); - } - /** - * DO NOT EDIT ME - * Gets the magic number for the network and configures the class instance. - */ - async init() { - const getVersionRes = await this.node.getVersion(); - this.networkMagic = getVersionRes.protocol.network; - } - /** - * DO NOT EDIT ME - * The the node that the instance is connected to. - */ - get node() { - if (this.options.node) { - return new neon_core_1.rpc.RPCClient(this.options.node); - } - throw new Error('no node selected!'); - } - /** - * DO NOT EDIT ME - * The contract script hash that is being interfaced with. - */ - get scriptHash() { - if (this.options.scriptHash) { - return this.options.scriptHash; - } - throw new Error('node scripthash defined'); - } - /** - * - * EDIT ME!!! - * - * This template method is designed to be a passthough so you should really only be changing the name and parameter types. - * All the magic happens in the TemplateAPI.templateMethod. Check there to align your sdk with your smart contract. - * Create one of these pass throughs for each method you expose in your smart contract. The goal of this entire class is to - * simplify the network configuration steps which can be complicated. - */ - async createChest(name, type, eligibleEpochs, puppetTraits, signer) { - return api_1.ChestAPI.createChest(this.node.url, this.networkMagic, this.scriptHash, name, type, eligibleEpochs, puppetTraits, signer); - } - async isPuppetEligible(chestId, puppetId, signer) { - return api_1.ChestAPI.isPuppetEligible(this.node.url, this.networkMagic, this.scriptHash, chestId, puppetId, signer); - } - async lootChestWithPuppet(chestId, puppetId, signer) { - return api_1.ChestAPI.lootChestWithPuppet(this.node.url, this.networkMagic, this.scriptHash, chestId, puppetId, signer); - } - async lootChestWithPuppetVerified(chestId, puppetId, signer) { - const timeout = 60000; - let age = 0; - const txid = await api_1.ChestAPI.lootChestWithPuppet(this.node.url, this.networkMagic, this.scriptHash, chestId, puppetId, signer); - while (timeout >= age) { - try { - let res = await (0, helpers_1.txDidComplete)(this.node.url, txid, true); - res[0].scriptHash = neon_core_1.u.reverseHex(neon_core_1.u.str2hexstring(res[0].scriptHash)); - return res; - } - catch (e) { - await (0, helpers_1.sleep)(1000); - age += 1000; - } - } - throw new Error("timeout exceeded"); - } - async lootChestAsOwner(chestId, signer) { - return api_1.ChestAPI.lootChestAsOwner(this.node.url, this.networkMagic, this.scriptHash, chestId, signer); - } - async getChestJSON(chestId, signer) { - return api_1.ChestAPI.getChestJSON(this.node.url, this.networkMagic, this.scriptHash, chestId, signer); - } - async totalChests(name, type, signer) { - return api_1.ChestAPI.totalChests(this.node.url, this.networkMagic, this.scriptHash, signer); - } -} -exports.Chest = Chest; -//# sourceMappingURL=Chest.js.map \ No newline at end of file diff --git a/sdk/dist/Chest.js.map b/sdk/dist/Chest.js.map deleted file mode 100644 index a2e311c..0000000 --- a/sdk/dist/Chest.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Chest.js","sourceRoot":"","sources":["../src/Chest.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,qDAAoD;AACpD,+BAA2C;AAC3C,2CAAkE;AAClE,uCAA0D;AAE1D,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED;;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of file diff --git a/sdk/dist/Collection.d.ts b/sdk/dist/Collection.d.ts deleted file mode 100644 index 0f204ac..0000000 --- a/sdk/dist/Collection.d.ts +++ /dev/null @@ -1,167 +0,0 @@ -import { rpc, wallet } from '@cityofzion/neon-core'; -import { CollectionType, PropConstructorOptions } from "./interface"; -/** - * The Collection prop is designed to store static-immutable data for reference in other projects. Storing static data - * in contracts is very expensive and inefficient, especially for new projects. This contract resolves that issue by creating - * library for static data. This class exposes the interface along with a number of helpful features to make the smart - * contract easy to use for typescript developers. - * - * All of the prop helper classes will auto-configure your network settings. The default configuration will interface with - * the contract compiled with this project and deployed locally at http://localhost:50012. For more information on deploying - * contract packages, refer to the quickstart. - * - * All methods support a signer. If the method can be run as a test-invoke, optionally populating the signer parameter - * will publish the invocation and return the txid instead of the method response. - * - * To use this class: - * ```typescript - * import {Collection} from "../../dist" //import {Collection} from "@cityofzion/props - * - * const collection: Collection = new Collection() - * await collection.init() // interfaces with the node to resolve network magic - * - * const total = await collection.totalCollections() - * console.log(total) // outputs the total collection count in the contract - * ``` - */ -export declare class Collection { - private options; - private networkMagic; - constructor(options?: PropConstructorOptions); - /** - * Gets the magic number for the network and configures the class instance. - */ - init(): Promise; - /** - * The the node that the instance is connected to. - */ - get node(): rpc.RPCClient; - /** - * The contract script hash that is being interfaced with. - */ - get scriptHash(): string; - /** - * Publishes an array of immutable data to the smart contract along with some useful metadata. - * - * @param description A useful description of the collection. - * @param collectionType The type of the data being store. This is an unregulated field. Standard NVM datatypes should - * adhere to existing naming conventions. - * @param extra An unregulated field for unplanned feature development. - * @param values An array of values that represent the body of the collection. - * @param signer The signer of the transaction. - * - * @returns A transaction ID. Refer to {@link helpers.txDidComplete} for parsing. - */ - createCollection(description: string, collectionType: string, extra: string, values: string[], signer: wallet.Account): Promise; - /** - * Loads a {@link CollectionType} formatted JSON file and pushes it to the smart contract. - * - * @param path The path to the file. - * @param signer The signer of the transaction. - * - * @returns A transaction ID. Refer to {@link helper.txDidComplete} for parsing. - */ - createFromFile(path: string, signer: wallet.Account): Promise; - /** - * Gets a JSON formatting collection from the smart contract. - * - * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The requested collection **OR** a txid if the signer parameter is populated. - */ - getCollectionJSON(collectionId: number, signer?: wallet.Account): Promise; - /** - * Gets the bytestring representation of the collection. This is primarilly used for inter-contract interfacing, - * but we include it here for completeness. - * - * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The bytestring representation of the collection. **OR** a txid if the signer parameter is populated. - */ - getCollection(collectionId: number, signer?: wallet.Account): Promise; - /** - * Returns the value of a collection from a requested index. - * - * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. - * @param index The index of the array element being requested. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The value of the collection element **OR** a txid if the signer parameter is populated. - */ - getCollectionElement(collectionId: number, index: number, signer?: wallet.Account): Promise; - /** - * Gets the array length of a requested collection. - * - * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The length of the collection **OR** a txid if the signer parameter is populated. - */ - getCollectionLength(collectionId: number, signer?: wallet.Account): Promise; - /** - * Gets the values of a collection, omitting the metadata. - * - * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The values in the collection **OR** a txid if the signer parameter is populated. - */ - getCollectionValues(collectionId: number, signer?: wallet.Account): Promise; - /** - * Maps byte entropy onto a collection's values and returns the index of the result. The mapping is made as follows: - * - * [0 -> MAX(entropyBytes.length)][entropy] -> [0 -> collection.length][index] - * - * This method is primarily useful for computationally efficient contract interfacing. For random sampling, or - * sampling from a distribution, use {@link getCollectionLength} in combination with {@link getCollectionElement} or - * {@link sampleFromCollection}. - * - * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. - * @param entropy Bytes to use for the mapping. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The element from the mapping **OR** a txid if the signer parameter is populated. - */ - mapBytesOntoCollection(collectionId: number, entropy: string, signer?: wallet.Account): Promise; - /** - * Samples a uniform random value from the collection using a Contract.Call to the {@link Dice} contract. - * - * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. - * @param samples The number of samples to return - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns A uniform random sample from the collection. **OR** a txid if the signer parameter is populated. - * **Note:** This method will not randomly generate unless the transaction is published so use the signer field for - * testing. - */ - sampleFromCollection(collectionId: number, samples: number, signer?: wallet.Account): Promise; - /** - * Samples uniformly from a collection provided at the time of invocation. Users have the option to 'pick', which - * prevents a value from being selected multiple times. The results are published as outputs on the transaction. - * @param values an array of values to sample from - * @param samples the number of samples to fairly select from the values - * @param pick Are selected values removed from the list of options for future samples? - * @param signer The signer of the transaction. - */ - sampleFromRuntimeCollection(values: string[], samples: number, pick: boolean, signer: wallet.Account): Promise; - /** - * Gets the total collections. Collection IDs are autogenerated on range [1 -> totalCollections] inclusive if you are - * planning to iterate of their collection IDs. - * - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The total number of collections stored in the contract. **OR** a txid if the signer parameter is populated. - */ - totalCollections(signer?: wallet.Account): Promise; - update(script: string, manifest: string, signer: wallet.Account): Promise; -} diff --git a/sdk/dist/Collection.js b/sdk/dist/Collection.js deleted file mode 100644 index 40895f6..0000000 --- a/sdk/dist/Collection.js +++ /dev/null @@ -1,244 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Collection = void 0; -const lodash_1 = require("lodash"); -const neon_core_1 = require("@cityofzion/neon-core"); -const neon_js_1 = require("@cityofzion/neon-js"); -const interface_1 = require("./interface"); -const api_1 = require("./api"); -const fs_1 = __importDefault(require("fs")); -const DEFAULT_OPTIONS = { - network: interface_1.NetworkOption.LocalNet -}; -/** - * The Collection prop is designed to store static-immutable data for reference in other projects. Storing static data - * in contracts is very expensive and inefficient, especially for new projects. This contract resolves that issue by creating - * library for static data. This class exposes the interface along with a number of helpful features to make the smart - * contract easy to use for typescript developers. - * - * All of the prop helper classes will auto-configure your network settings. The default configuration will interface with - * the contract compiled with this project and deployed locally at http://localhost:50012. For more information on deploying - * contract packages, refer to the quickstart. - * - * All methods support a signer. If the method can be run as a test-invoke, optionally populating the signer parameter - * will publish the invocation and return the txid instead of the method response. - * - * To use this class: - * ```typescript - * import {Collection} from "../../dist" //import {Collection} from "@cityofzion/props - * - * const collection: Collection = new Collection() - * await collection.init() // interfaces with the node to resolve network magic - * - * const total = await collection.totalCollections() - * console.log(total) // outputs the total collection count in the contract - * ``` - */ -class Collection { - constructor(options = {}) { - this.options = DEFAULT_OPTIONS; - this.networkMagic = -1; - switch (options.network) { - case interface_1.NetworkOption.TestNet: - this.options.node = 'https://testnet1.neo.coz.io:443'; - this.options.scriptHash = '0x429ba9252c761b6119ab9442d9fbe2e60f3c6f3e'; - break; - case interface_1.NetworkOption.MainNet: - this.options.node = 'https://mainnet1.neo.coz.io:443'; - this.options.scriptHash = '0xf05651bc505fd5c7d36593f6e8409932342f9085'; - break; - default: - this.options.node = 'http://localhost:50012'; - this.options.scriptHash = '0xacf2aa5d0899e860eebd8b8a5454aa3017543848'; - break; - } - this.options = (0, lodash_1.merge)({}, this.options, options); - } - /** - * Gets the magic number for the network and configures the class instance. - */ - async init() { - const getVersionRes = await this.node.getVersion(); - this.networkMagic = getVersionRes.protocol.network; - } - /** - * The the node that the instance is connected to. - */ - get node() { - if (this.options.node) { - return new neon_core_1.rpc.RPCClient(this.options.node); - } - throw new Error('no node selected!'); - } - /** - * The contract script hash that is being interfaced with. - */ - get scriptHash() { - if (this.options.scriptHash) { - return this.options.scriptHash; - } - throw new Error('scripthash defined'); - } - /** - * Publishes an array of immutable data to the smart contract along with some useful metadata. - * - * @param description A useful description of the collection. - * @param collectionType The type of the data being store. This is an unregulated field. Standard NVM datatypes should - * adhere to existing naming conventions. - * @param extra An unregulated field for unplanned feature development. - * @param values An array of values that represent the body of the collection. - * @param signer The signer of the transaction. - * - * @returns A transaction ID. Refer to {@link helpers.txDidComplete} for parsing. - */ - async createCollection(description, collectionType, extra, values, signer) { - return api_1.CollectionAPI.createCollection(this.node.url, this.networkMagic, this.scriptHash, description, collectionType, extra, values, signer); - } - /** - * Loads a {@link CollectionType} formatted JSON file and pushes it to the smart contract. - * - * @param path The path to the file. - * @param signer The signer of the transaction. - * - * @returns A transaction ID. Refer to {@link helper.txDidComplete} for parsing. - */ - async createFromFile(path, signer) { - const localCollection = JSON.parse(fs_1.default.readFileSync(path).toString()); - const formattedValues = localCollection.values.map((value) => { - switch (localCollection.type) { - case 'string': - return neon_js_1.sc.ContractParam.string(value); - case 'int': - return neon_js_1.sc.ContractParam.integer(value); - } - }); - return api_1.CollectionAPI.createCollectionRaw(this.node.url, this.networkMagic, this.scriptHash, localCollection.description, localCollection.type, localCollection.extra, formattedValues, signer); - } - /** - * Gets a JSON formatting collection from the smart contract. - * - * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The requested collection **OR** a txid if the signer parameter is populated. - */ - async getCollectionJSON(collectionId, signer) { - return api_1.CollectionAPI.getCollectionJSON(this.node.url, this.networkMagic, this.scriptHash, collectionId, signer); - } - /** - * Gets the bytestring representation of the collection. This is primarilly used for inter-contract interfacing, - * but we include it here for completeness. - * - * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The bytestring representation of the collection. **OR** a txid if the signer parameter is populated. - */ - async getCollection(collectionId, signer) { - return api_1.CollectionAPI.getCollection(this.node.url, this.networkMagic, this.scriptHash, collectionId, signer); - } - /** - * Returns the value of a collection from a requested index. - * - * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. - * @param index The index of the array element being requested. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The value of the collection element **OR** a txid if the signer parameter is populated. - */ - async getCollectionElement(collectionId, index, signer) { - return api_1.CollectionAPI.getCollectionElement(this.node.url, this.networkMagic, this.scriptHash, collectionId, index, signer); - } - /** - * Gets the array length of a requested collection. - * - * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The length of the collection **OR** a txid if the signer parameter is populated. - */ - async getCollectionLength(collectionId, signer) { - return api_1.CollectionAPI.getCollectionLength(this.node.url, this.networkMagic, this.scriptHash, collectionId, signer); - } - /** - * Gets the values of a collection, omitting the metadata. - * - * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The values in the collection **OR** a txid if the signer parameter is populated. - */ - async getCollectionValues(collectionId, signer) { - return api_1.CollectionAPI.getCollectionValues(this.node.url, this.networkMagic, this.scriptHash, collectionId, signer); - } - /** - * Maps byte entropy onto a collection's values and returns the index of the result. The mapping is made as follows: - * - * [0 -> MAX(entropyBytes.length)][entropy] -> [0 -> collection.length][index] - * - * This method is primarily useful for computationally efficient contract interfacing. For random sampling, or - * sampling from a distribution, use {@link getCollectionLength} in combination with {@link getCollectionElement} or - * {@link sampleFromCollection}. - * - * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. - * @param entropy Bytes to use for the mapping. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The element from the mapping **OR** a txid if the signer parameter is populated. - */ - async mapBytesOntoCollection(collectionId, entropy, signer) { - return api_1.CollectionAPI.mapBytesOntoCollection(this.node.url, this.networkMagic, this.scriptHash, collectionId, entropy, signer); - } - /** - * Samples a uniform random value from the collection using a Contract.Call to the {@link Dice} contract. - * - * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. - * @param samples The number of samples to return - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns A uniform random sample from the collection. **OR** a txid if the signer parameter is populated. - * **Note:** This method will not randomly generate unless the transaction is published so use the signer field for - * testing. - */ - async sampleFromCollection(collectionId, samples, signer) { - return api_1.CollectionAPI.sampleFromCollection(this.node.url, this.networkMagic, this.scriptHash, collectionId, samples, signer); - } - /** - * Samples uniformly from a collection provided at the time of invocation. Users have the option to 'pick', which - * prevents a value from being selected multiple times. The results are published as outputs on the transaction. - * @param values an array of values to sample from - * @param samples the number of samples to fairly select from the values - * @param pick Are selected values removed from the list of options for future samples? - * @param signer The signer of the transaction. - */ - async sampleFromRuntimeCollection(values, samples, pick, signer) { - return api_1.CollectionAPI.sampleFromRuntimeCollection(this.node.url, this.networkMagic, this.scriptHash, values, samples, pick, signer); - } - /** - * Gets the total collections. Collection IDs are autogenerated on range [1 -> totalCollections] inclusive if you are - * planning to iterate of their collection IDs. - * - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The total number of collections stored in the contract. **OR** a txid if the signer parameter is populated. - */ - async totalCollections(signer) { - return api_1.CollectionAPI.totalCollections(this.node.url, this.networkMagic, this.scriptHash, signer); - } - async update(script, manifest, signer) { - return api_1.CollectionAPI.update(this.node.url, this.networkMagic, this.scriptHash, script, manifest, '', signer); - } -} -exports.Collection = Collection; -//# sourceMappingURL=Collection.js.map \ No newline at end of file diff --git a/sdk/dist/Collection.js.map b/sdk/dist/Collection.js.map deleted file mode 100644 index 6022819..0000000 --- a/sdk/dist/Collection.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Collection.js","sourceRoot":"","sources":["../src/Collection.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA4B;AAC5B,qDAAiD;AACjD,iDAAuC;AACvC,2CAAkF;AAClF,+BAAoC;AACpC,4CAAmB;AAGnB,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAa,UAAU;IAIrB,YAAY,UAAkC,EAAE;QAHxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAG/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP;gBACE,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,wBAAwB,CAAA;gBAC5C,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;SACR;QACD,IAAI,CAAC,OAAO,GAAG,IAAA,cAAK,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;Q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CAAC,gBAAgB,CAAC,MAAuB;QAC5C,OAAO,mBAAa,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IAClG,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,QAAgB,EAAE,MAAsB;QACnE,OAAO,mBAAa,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;IAC9G,CAAC;CAEF;AA3ND,gCA2NC"} \ No newline at end of file diff --git a/sdk/dist/Dice.d.ts b/sdk/dist/Dice.d.ts deleted file mode 100644 index 46fbd8f..0000000 --- a/sdk/dist/Dice.d.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { rpc, wallet } from '@cityofzion/neon-core'; -import { PropConstructorOptions } from "./interface"; -/** - * The dice prop normalizes a lot of behaviors associated with random number generation to improve usability within - * projects. - * - * All of the prop helper classes will auto-configure your network settings. The default configuration will interface with - * the contract compiled with this project and deployed locally at http://localhost:50012. For more information on deploying - * contract packages, refer to the quickstart. - * - * All methods support a signer. If the method can be run as a test-invoke, optionally populating the signer parameter - * will publish the invocation and return the txid instead of the method response. - * - * To use this class: - * ```typescript - * import {Dice} from "../../dist" //import {Dice} from "@cityofzion/props - * - * const dice: Dice = new Dice() - * await dice.init() // interfaces with the node to resolve network magic - * - * const randomNumber = await dice.randBetween(0, 100) - * console.log(randomNumber) // outputs the random number. You should include a signer to the method above - * for a truly random number. - * ``` - */ -export declare class Dice { - private options; - private networkMagic; - constructor(options?: PropConstructorOptions); - /** - * Gets the magic number for the network and configures the class instance. - */ - init(): Promise; - /** - * The the node that the instance is connected to. - */ - get node(): rpc.RPCClient; - /** - * The contract script hash that is being interfaced with. - */ - get scriptHash(): string; - /** - * Gets a random number of range [start -> end] inclusive. This method supports negative integer ranges. - * - * **Note:** - * This method must include a signer to produce truly random numbers. - * - * @param start the minimum value for the selection range. - * @param end the maximum value for the selection range. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The pseudo-random number. **OR** a txid if the signer parameter is populated. - */ - randBetween(start: number, end: number, signer?: wallet.Account): Promise; - /** - * Maps bytes onto a range of numbers: - * - * [0 -> Max(entropy.length)][entropy] --> [start, end] - * - * @param start the minimum value for the selection range. - * @param end the maximum value for the selection range. - * @param entropy the bytes used in the sampling. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The resulting number from the mapping. **OR** a txid if the signer parameter is populated. - */ - mapBytesOntoRange(start: number, end: number, entropy: string, signer?: wallet.Account): Promise; - /** - * Rolls for a `dX` formatted random number. - * - * **Note:** - * This method must include a signer to produce truly random numbers. - * - * @param die The die to roll. The input format can support arbitarilly large dice which are effectively spherical.. - * or more traditional ones. e.g. 'd6' - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The result of the die roll **OR** a txid if the signer parameter is populated. - */ - rollDie(die: string, signer?: wallet.Account): Promise; - /** - * Calculates dice rolls using provided entropy. This method will return and array of length `entropy.length / precision`. - * - * @param die The die to roll. The input format can support arbitarilly large dice which are effectively spherical.. - * or more traditional ones. e.g. 'd6' - * @param precision The number of bytes to use for each sample. Sampling at a precision below the fidelity of your range - * will succeed, but your results will be overly-discrete. - * @param entropy The bytes of data used to seed the sampling. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns An array of dice rolls. **OR** a txid if the signer parameter is populated. - */ - rollDiceWithEntropy(die: string, precision: number, entropy: string, signer?: wallet.Account): Promise; -} diff --git a/sdk/dist/Dice.js b/sdk/dist/Dice.js deleted file mode 100644 index 73d0204..0000000 --- a/sdk/dist/Dice.js +++ /dev/null @@ -1,145 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Dice = void 0; -const lodash_1 = require("lodash"); -const neon_core_1 = require("@cityofzion/neon-core"); -const api_1 = require("./api"); -const interface_1 = require("./interface"); -const DEFAULT_OPTIONS = { - network: interface_1.NetworkOption.LocalNet -}; -/** - * The dice prop normalizes a lot of behaviors associated with random number generation to improve usability within - * projects. - * - * All of the prop helper classes will auto-configure your network settings. The default configuration will interface with - * the contract compiled with this project and deployed locally at http://localhost:50012. For more information on deploying - * contract packages, refer to the quickstart. - * - * All methods support a signer. If the method can be run as a test-invoke, optionally populating the signer parameter - * will publish the invocation and return the txid instead of the method response. - * - * To use this class: - * ```typescript - * import {Dice} from "../../dist" //import {Dice} from "@cityofzion/props - * - * const dice: Dice = new Dice() - * await dice.init() // interfaces with the node to resolve network magic - * - * const randomNumber = await dice.randBetween(0, 100) - * console.log(randomNumber) // outputs the random number. You should include a signer to the method above - * for a truly random number. - * ``` - */ -class Dice { - constructor(options = {}) { - this.options = DEFAULT_OPTIONS; - this.networkMagic = -1; - switch (options.network) { - case interface_1.NetworkOption.TestNet: - this.options.node = 'https://testnet1.neo.coz.io:443'; - this.options.scriptHash = '0x4380f2c1de98bb267d3ea821897ec571a04fe3e0'; - break; - case interface_1.NetworkOption.MainNet: - this.options.node = 'https://mainnet1.neo.coz.io:443'; - this.options.scriptHash = '0x4380f2c1de98bb267d3ea821897ec571a04fe3e0'; - break; - case interface_1.NetworkOption.LocalNet: - this.options.node = 'http://localhost:50012'; - this.options.scriptHash = '0x16d6a0be0506b26e0826dd352724cda0defa7131'; - break; - } - this.options = (0, lodash_1.merge)({}, this.options, options); - } - /** - * Gets the magic number for the network and configures the class instance. - */ - async init() { - const getVersionRes = await this.node.getVersion(); - this.networkMagic = getVersionRes.protocol.network; - } - /** - * The the node that the instance is connected to. - */ - get node() { - if (this.options.node) { - return new neon_core_1.rpc.RPCClient(this.options.node); - } - throw new Error('no node selected!'); - } - /** - * The contract script hash that is being interfaced with. - */ - get scriptHash() { - if (this.options.scriptHash) { - return this.options.scriptHash; - } - throw new Error('node scripthash defined'); - } - /** - * Gets a random number of range [start -> end] inclusive. This method supports negative integer ranges. - * - * **Note:** - * This method must include a signer to produce truly random numbers. - * - * @param start the minimum value for the selection range. - * @param end the maximum value for the selection range. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The pseudo-random number. **OR** a txid if the signer parameter is populated. - */ - async randBetween(start, end, signer) { - return api_1.DiceAPI.randBetween(this.node.url, this.networkMagic, this.scriptHash, start, end, signer); - } - /** - * Maps bytes onto a range of numbers: - * - * [0 -> Max(entropy.length)][entropy] --> [start, end] - * - * @param start the minimum value for the selection range. - * @param end the maximum value for the selection range. - * @param entropy the bytes used in the sampling. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The resulting number from the mapping. **OR** a txid if the signer parameter is populated. - */ - async mapBytesOntoRange(start, end, entropy, signer) { - return api_1.DiceAPI.mapBytesOntoRange(this.node.url, this.networkMagic, this.scriptHash, start, end, entropy, signer); - } - /** - * Rolls for a `dX` formatted random number. - * - * **Note:** - * This method must include a signer to produce truly random numbers. - * - * @param die The die to roll. The input format can support arbitarilly large dice which are effectively spherical.. - * or more traditional ones. e.g. 'd6' - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns The result of the die roll **OR** a txid if the signer parameter is populated. - */ - async rollDie(die, signer) { - return api_1.DiceAPI.rollDie(this.node.url, this.networkMagic, this.scriptHash, die, signer); - } - /** - * Calculates dice rolls using provided entropy. This method will return and array of length `entropy.length / precision`. - * - * @param die The die to roll. The input format can support arbitarilly large dice which are effectively spherical.. - * or more traditional ones. e.g. 'd6' - * @param precision The number of bytes to use for each sample. Sampling at a precision below the fidelity of your range - * will succeed, but your results will be overly-discrete. - * @param entropy The bytes of data used to seed the sampling. - * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of - * running the invocation as a test invoke. - * - * @returns An array of dice rolls. **OR** a txid if the signer parameter is populated. - */ - async rollDiceWithEntropy(die, precision, entropy, signer) { - return api_1.DiceAPI.rollDiceWithEntropy(this.node.url, this.networkMagic, this.scriptHash, die, precision, entropy, signer); - } -} -exports.Dice = Dice; -//# sourceMappingURL=Dice.js.map \ No newline at end of file diff --git a/sdk/dist/Dice.js.map b/sdk/dist/Dice.js.map deleted file mode 100644 index fb0c68a..0000000 --- a/sdk/dist/Dice.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Dice.js","sourceRoot":"","sources":["../src/Dice.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,qDAAiD;AACjD,+BAA6B;AAC7B,2CAAkE;AAElE,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,MAAa,IAAI;IAIf,YAAY,UAAkC,EAAE;QAHxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAG/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP,KAAK,yBAAa,CAAC,QAAQ;gBACzB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,wBAAwB,CAAA;gBAC5C,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;SACR;QAC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EAAE,MAAM,CAAC,CAAA;IAClH,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,MAAuB;QAChD,OAAO,aAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,MAAM,CAAC,CAAA;IACxF,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,mBAAmB,CAAC,GAAW,EAAE,SAAiB,EAAE,OAAe,EAAE,MAAuB;QAChG,OAAO,aAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IACxH,CAAC;CAEF;AAtHD,oBAsHC"} \ No newline at end of file diff --git a/sdk/dist/Generator.d.ts b/sdk/dist/Generator.d.ts deleted file mode 100644 index 785815c..0000000 --- a/sdk/dist/Generator.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { rpc, wallet } from '@cityofzion/neon-core'; -import { GeneratorType, InstanceAccessMode, InstanceAuthorizedContracts, PropConstructorOptions, TraitType } from "./interface"; -export declare class Generator { - private options; - private networkMagic; - constructor(options?: PropConstructorOptions); - init(): Promise; - get node(): rpc.RPCClient; - get scriptHash(): string; - createGenerator(generator: GeneratorType, signer: wallet.Account, timeConstantMS: number): Promise; - createGeneratorFromFile(path: string, signer: wallet.Account, timeConstantMS: number): Promise; - createTrait(generatorId: number, trait: TraitType, signer: wallet.Account): Promise; - getGeneratorJSON(generatorId: number, signer?: wallet.Account): Promise; - getGeneratorInstanceJSON(instanceId: number, signer?: wallet.Account): Promise; - createInstance(generatorId: number, signer: wallet.Account): Promise; - mintFromInstance(instanceId: number, signer: wallet.Account): Promise; - setInstanceAccessMode(instanceId: number, accessMode: InstanceAccessMode, signer: wallet.Account): Promise; - setInstanceAuthorizedUsers(instanceId: number, authorizedUsers: string[], signer: wallet.Account): Promise; - setInstanceAuthorizedContracts(instanceId: number, authorizedContracts: InstanceAuthorizedContracts[], signer: wallet.Account): Promise; - setInstanceFee(instanceId: number, fee: number, signer: wallet.Account): Promise; - totalGenerators(signer?: wallet.Account): Promise; - totalGeneratorInstances(signer?: wallet.Account): Promise; -} diff --git a/sdk/dist/Generator.js b/sdk/dist/Generator.js deleted file mode 100644 index 1570907..0000000 --- a/sdk/dist/Generator.js +++ /dev/null @@ -1,113 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Generator = void 0; -const lodash_1 = require("lodash"); -const neon_core_1 = require("@cityofzion/neon-core"); -const api_1 = require("./api"); -const interface_1 = require("./interface"); -const helpers_1 = require("./helpers"); -const fs_1 = __importDefault(require("fs")); -const DEFAULT_OPTIONS = { - network: interface_1.NetworkOption.LocalNet -}; -class Generator { - constructor(options = {}) { - this.options = DEFAULT_OPTIONS; - this.networkMagic = -1; - switch (options.network) { - case interface_1.NetworkOption.TestNet: - this.options.node = 'https://testnet1.neo.coz.io:443'; - this.options.scriptHash = '0xdda8055789f0eb3c1d092c714a68ba3e631586c7'; - break; - case interface_1.NetworkOption.MainNet: - this.options.node = 'https://mainnet1.neo.coz.io:443'; - this.options.scriptHash = '0x0e312c70ce6ed18d5702c6c5794c493d9ef46dc9'; - break; - default: - this.options.node = 'http://localhost:50012'; - this.options.scriptHash = '0xa3e59ddc61b2d8ac42c519cee5ddaac83c7df276'; - break; - } - this.options = (0, lodash_1.merge)({}, this.options, options); - } - async init() { - const getVersionRes = await this.node.getVersion(); - this.networkMagic = getVersionRes.protocol.network; - } - get node() { - if (this.options.node) { - return new neon_core_1.rpc.RPCClient(this.options.node); - } - throw new Error('no node selected!'); - } - get scriptHash() { - if (this.options.scriptHash) { - return this.options.scriptHash; - } - throw new Error('node scripthash defined'); - } - async createGenerator(generator, signer, timeConstantMS) { - const txids = []; - let txid = await api_1.GeneratorAPI.createGenerator(this.node.url, this.networkMagic, this.scriptHash, generator.label, generator.baseGeneratorFee, signer); - txids.push(txid); - await (0, helpers_1.sleep)(timeConstantMS); - const res = await (0, helpers_1.txDidComplete)(this.node.url, txid, false); - for await (let trait of generator.traits) { - trait = trait; - txid = await api_1.GeneratorAPI.createTrait(this.node.url, this.networkMagic, this.scriptHash, res[0], trait.label, trait.slots, trait.traitLevels, signer); - txids.push(txid); - await (0, helpers_1.sleep)(timeConstantMS); - } - return txids; - } - async createGeneratorFromFile(path, signer, timeConstantMS) { - const localGenerator = JSON.parse(fs_1.default.readFileSync(path).toString()); - return this.createGenerator(localGenerator, signer, timeConstantMS); - } - async createTrait(generatorId, trait, signer) { - return api_1.GeneratorAPI.createTrait(this.node.url, this.networkMagic, this.scriptHash, generatorId, trait.label, trait.slots, trait.traitLevels, signer); - } - async getGeneratorJSON(generatorId, signer) { - const generator = await api_1.GeneratorAPI.getGeneratorJSON(this.node.url, this.networkMagic, this.scriptHash, generatorId, signer); - const gType = generator; - const traits = []; - for (let i = 0; i < gType.traits.length; i++) { - let trait = await api_1.GeneratorAPI.getTraitJSON(this.node.url, this.networkMagic, this.scriptHash, gType.traits[i]); - traits.push(trait); - } - gType.traits = traits; - return gType; - } - async getGeneratorInstanceJSON(instanceId, signer) { - return api_1.GeneratorAPI.getGeneratorInstanceJSON(this.node.url, this.networkMagic, this.scriptHash, instanceId, signer); - } - async createInstance(generatorId, signer) { - return api_1.GeneratorAPI.createInstance(this.node.url, this.networkMagic, this.scriptHash, generatorId, signer); - } - async mintFromInstance(instanceId, signer) { - return api_1.GeneratorAPI.mintFromInstance(this.node.url, this.networkMagic, this.scriptHash, instanceId, signer); - } - async setInstanceAccessMode(instanceId, accessMode, signer) { - return api_1.GeneratorAPI.setInstanceAccessMode(this.node.url, this.networkMagic, this.scriptHash, instanceId, accessMode, signer); - } - async setInstanceAuthorizedUsers(instanceId, authorizedUsers, signer) { - return api_1.GeneratorAPI.setInstanceAuthorizedUsers(this.node.url, this.networkMagic, this.scriptHash, instanceId, authorizedUsers, signer); - } - async setInstanceAuthorizedContracts(instanceId, authorizedContracts, signer) { - return api_1.GeneratorAPI.setInstanceAuthorizedContracts(this.node.url, this.networkMagic, this.scriptHash, instanceId, authorizedContracts, signer); - } - async setInstanceFee(instanceId, fee, signer) { - return api_1.GeneratorAPI.setInstanceFee(this.node.url, this.networkMagic, this.scriptHash, instanceId, fee, signer); - } - async totalGenerators(signer) { - return api_1.GeneratorAPI.totalGenerators(this.node.url, this.networkMagic, this.scriptHash, signer); - } - async totalGeneratorInstances(signer) { - return api_1.GeneratorAPI.totalGeneratorInstances(this.node.url, this.networkMagic, this.scriptHash, signer); - } -} -exports.Generator = Generator; -//# sourceMappingURL=Generator.js.map \ No newline at end of file diff --git a/sdk/dist/Generator.js.map b/sdk/dist/Generator.js.map deleted file mode 100644 index e90c1b2..0000000 --- a/sdk/dist/Generator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Generator.js","sourceRoot":"","sources":["../src/Generator.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA8B;AAC9B,qDAAiD;AACjD,+BAAkC;AAClC,2CAMqB;AACrB,uCAA+C;AAC/C,4CAAoB;AAEpB,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED,MAAa,SAAS;IAIpB,YAAY,UAAkC,EAAE;QAHxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAG/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;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ED,KAAK,CAAC,eAAe,CAAC,MAAuB;QAC3C,OAAO,kBAAY,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IAChG,CAAC;IAED,KAAK,CAAC,uBAAuB,CAAC,MAAuB;QACnD,OAAO,kBAAY,CAAC,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACxG,CAAC;CACF;AAjHD,8BAiHC"} \ No newline at end of file diff --git a/sdk/dist/Puppet.d.ts b/sdk/dist/Puppet.d.ts deleted file mode 100644 index ec6b4a1..0000000 --- a/sdk/dist/Puppet.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { rpc, wallet } from '@cityofzion/neon-core'; -import { EpochType, PropConstructorOptions, PuppetType } from "./interface"; -export declare class Puppet { - private options; - private networkMagic; - constructor(options?: PropConstructorOptions); - init(): Promise; - get node(): rpc.RPCClient; - get scriptHash(): string; - balanceOf(address: string, signer?: wallet.Account): Promise; - createEpoch(label: string, generatorInstanceId: number, initialRollCollectionId: number, mintFee: number, sysFee: number, maxSupply: number, signer: wallet.Account): Promise; - decimals(signer?: wallet.Account): Promise; - deploy(signer: wallet.Account): Promise; - getAttributeMod(attributeValue: number, signer?: wallet.Account): Promise; - getEpochJSON(epochId: number, signer?: wallet.Account): Promise; - getPuppetJSON(tokenId: string, signer?: wallet.Account): Promise; - getPuppetRaw(tokenId: string, signer?: wallet.Account): Promise; - ownerOf(tokenId: string, signer?: wallet.Account): Promise; - offlineMint(epochId: number, owner: string, signer: wallet.Account): Promise; - properties(tokenId: string, signer?: wallet.Account): Promise; - purchase(epochId: number, signer: wallet.Account): Promise; - setMintFee(epochId: number, fee: number, signer: wallet.Account): Promise; - symbol(signer?: wallet.Account): Promise; - tokens(signer?: wallet.Account): Promise; - tokensOf(address: string, signer?: wallet.Account): Promise; - totalAccounts(signer?: wallet.Account): Promise; - totalEpochs(signer?: wallet.Account): Promise; - totalSupply(signer?: wallet.Account): Promise; - transfer(to: string, tokenId: string, signer: wallet.Account, data: any): Promise; - update(script: string, manifest: string, signer: wallet.Account): Promise; -} diff --git a/sdk/dist/Puppet.js b/sdk/dist/Puppet.js deleted file mode 100644 index c212cbc..0000000 --- a/sdk/dist/Puppet.js +++ /dev/null @@ -1,132 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Puppet = void 0; -const lodash_1 = require("lodash"); -const neon_core_1 = require("@cityofzion/neon-core"); -const api_1 = require("./api"); -const neon_js_1 = require("@cityofzion/neon-js"); -const interface_1 = require("./interface"); -const DEFAULT_OPTIONS = { - network: interface_1.NetworkOption.LocalNet -}; -class Puppet { - constructor(options = {}) { - this.options = DEFAULT_OPTIONS; - this.networkMagic = -1; - switch (options.network) { - case interface_1.NetworkOption.TestNet: - this.options.node = 'https://testnet1.neo.coz.io:443'; - this.options.scriptHash = '0x97857c01d64f846b5fe2eca2d09d2d73928b3f43'; - break; - case interface_1.NetworkOption.MainNet: - this.options.node = 'https://mainnet1.neo.coz.io:443'; - this.options.scriptHash = '0x76a8f8a7a901b29a33013b469949f4b08db15756'; - break; - default: - this.options.node = 'http://localhost:50012'; - this.options.scriptHash = '0xfefe63f07478394fbe514fda386ad8c7e2a485a0'; - break; - } - this.options = (0, lodash_1.merge)({}, this.options, options); - } - async init() { - const getVersionRes = await this.node.getVersion(); - this.networkMagic = getVersionRes.protocol.network; - } - get node() { - if (this.options.node) { - return new neon_core_1.rpc.RPCClient(this.options.node); - } - throw new Error('no node selected!'); - } - get scriptHash() { - if (this.options.scriptHash) { - return this.options.scriptHash; - } - throw new Error('node scripthash defined'); - } - async balanceOf(address, signer) { - return api_1.PuppetAPI.balanceOf(this.node.url, this.networkMagic, this.scriptHash, address, signer); - } - async createEpoch(label, generatorInstanceId, initialRollCollectionId, mintFee, sysFee, maxSupply, signer) { - return api_1.PuppetAPI.createEpoch(this.node.url, this.networkMagic, this.scriptHash, label, generatorInstanceId, initialRollCollectionId, mintFee, sysFee, maxSupply, signer); - } - async decimals(signer) { - return api_1.PuppetAPI.decimals(this.node.url, this.networkMagic, this.scriptHash, signer); - } - async deploy(signer) { - return api_1.PuppetAPI.deploy(this.node.url, this.networkMagic, this.scriptHash, signer); - } - async getAttributeMod(attributeValue, signer) { - return api_1.PuppetAPI.getAttributeMod(this.node.url, this.networkMagic, this.scriptHash, attributeValue, signer); - } - async getEpochJSON(epochId, signer) { - return api_1.PuppetAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId, signer); - } - async getPuppetJSON(tokenId, signer) { - return api_1.PuppetAPI.getPuppetJSON(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer); - } - async getPuppetRaw(tokenId, signer) { - return api_1.PuppetAPI.getPuppetRaw(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer); - } - async ownerOf(tokenId, signer) { - return api_1.PuppetAPI.ownerOf(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer); - } - async offlineMint(epochId, owner, signer) { - return api_1.PuppetAPI.offlineMint(this.node.url, this.networkMagic, this.scriptHash, epochId, owner, signer); - } - async properties(tokenId, signer) { - return api_1.PuppetAPI.properties(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer); - } - async purchase(epochId, signer) { - const method = "transfer"; - const GASScriptHash = "0xd2a4cff31913016155e38e474a2c06d08be276cf"; - const epoch = await api_1.PuppetAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId); - const EpochTyped = epoch; - if (EpochTyped.totalSupply === EpochTyped.maxSupply) { - throw new Error(`Epoch is out of Puppets: ${EpochTyped.totalSupply} / ${EpochTyped.maxSupply}`); - } - const purchasePrice = EpochTyped.mintFee; - const params = [ - neon_js_1.sc.ContractParam.hash160(signer.address), - neon_js_1.sc.ContractParam.hash160(this.scriptHash), - neon_js_1.sc.ContractParam.integer(purchasePrice), - neon_js_1.sc.ContractParam.integer(epochId) - ]; - try { - return await api_1.NeoInterface.publishInvoke(this.node.url, this.networkMagic, GASScriptHash, method, params, signer); - } - catch (e) { - throw new Error("Something went wrong: " + e.message); - } - } - async setMintFee(epochId, fee, signer) { - return api_1.PuppetAPI.setMintFee(this.node.url, this.networkMagic, this.scriptHash, epochId, fee, signer); - } - async symbol(signer) { - return api_1.PuppetAPI.symbol(this.node.url, this.networkMagic, this.scriptHash, signer); - } - async tokens(signer) { - return api_1.PuppetAPI.tokens(this.node.url, this.networkMagic, this.scriptHash, signer); - } - async tokensOf(address, signer) { - return api_1.PuppetAPI.tokensOf(this.node.url, this.networkMagic, this.scriptHash, address, signer); - } - async totalAccounts(signer) { - return api_1.PuppetAPI.totalAccounts(this.node.url, this.networkMagic, this.scriptHash, signer); - } - async totalEpochs(signer) { - return api_1.PuppetAPI.totalEpochs(this.node.url, this.networkMagic, this.scriptHash, signer); - } - async totalSupply(signer) { - return api_1.PuppetAPI.totalSupply(this.node.url, this.networkMagic, this.scriptHash, signer); - } - async transfer(to, tokenId, signer, data) { - return api_1.PuppetAPI.transfer(this.node.url, this.networkMagic, this.scriptHash, to, tokenId, signer, data); - } - async update(script, manifest, signer) { - return api_1.PuppetAPI.update(this.node.url, this.networkMagic, this.scriptHash, script, manifest, '', signer); - } -} -exports.Puppet = Puppet; -//# sourceMappingURL=Puppet.js.map \ No newline at end of file diff --git a/sdk/dist/Puppet.js.map b/sdk/dist/Puppet.js.map deleted file mode 100644 index 1f3ba4d..0000000 --- a/sdk/dist/Puppet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Puppet.js","sourceRoot":"","sources":["../src/Puppet.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,qDAAiD;AACjD,+BAA6C;AAC7C,iDAAuC;AACvC,2CAAyF;AAEzF,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA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EAAE,MAAM,CAAC,CAAA;IACzF,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,OAAe,EAAE,MAAsB,EAAE,IAAS;QAC3E,OAAO,eAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;IACxG,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,QAAgB,EAAE,MAAsB;QACnE,OAAO,eAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;IAC1G,CAAC;CAEF;AAxJD,wBAwJC"} \ No newline at end of file diff --git a/sdk/dist/Template.d.ts b/sdk/dist/Template.d.ts deleted file mode 100644 index 1fd6693..0000000 --- a/sdk/dist/Template.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { rpc, wallet } from '@cityofzion/neon-core'; -import { PropConstructorOptions } from "./interface"; -/** - TEMPLATE CONTRACT CLASS - Use this class template to build out the typescript interface for your smart contract. If you rename this or the - `api` equivalent, make sure to update the respective `index.ts` and rebuild. - */ -export declare class Template { - private options; - private networkMagic; - constructor(options?: PropConstructorOptions); - /** - * DO NOT EDIT ME - * Gets the magic number for the network and configures the class instance. - */ - init(): Promise; - /** - * DO NOT EDIT ME - * The the node that the instance is connected to. - */ - get node(): rpc.RPCClient; - /** - * DO NOT EDIT ME - * The contract script hash that is being interfaced with. - */ - get scriptHash(): string; - /** - * - * EDIT ME!!! - * - * This template method is designed to be a passthough so you should really only be changing the name and parameter types. - * All the magic happens in the TemplateAPI.templateMethod. Check there to align your sdk with your smart contract. - * Create one of these pass throughs for each method you expose in your smart contract. The goal of this entire class is to - * simplify the network configuration steps which can be complicated. - */ - templateMethod(paramA: string, paramB: number, paramC: string, paramD: boolean, paramE: string[], signer?: wallet.Account): Promise; -} diff --git a/sdk/dist/Template.js b/sdk/dist/Template.js deleted file mode 100644 index c49fc70..0000000 --- a/sdk/dist/Template.js +++ /dev/null @@ -1,81 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Template = void 0; -const lodash_1 = require("lodash"); -const neon_core_1 = require("@cityofzion/neon-core"); -const api_1 = require("./api"); -const interface_1 = require("./interface"); -const DEFAULT_OPTIONS = { - network: interface_1.NetworkOption.LocalNet -}; -/** - TEMPLATE CONTRACT CLASS - Use this class template to build out the typescript interface for your smart contract. If you rename this or the - `api` equivalent, make sure to update the respective `index.ts` and rebuild. - */ -class Template { - // Once you get a scriptHash from deploying your smart contract via `npm run deploy`, update the `this.options.scriptHash` value. - // The default is analogous to localnet (neo-express) so you will most likely want to be updating that value. Remember to - // compile the sdk before use or your change wont take effect. Do that by running `tsc` in the sdk directory. - constructor(options = {}) { - this.options = DEFAULT_OPTIONS; - this.networkMagic = -1; - switch (options.network) { - case interface_1.NetworkOption.TestNet: - this.options.node = 'https://testnet1.neo.coz.io:443'; - this.options.scriptHash = '0x4380f2c1de98bb267d3ea821897ec571a04fe3e0'; - break; - case interface_1.NetworkOption.MainNet: - this.options.node = 'https://mainnet1.neo.coz.io:443'; - this.options.scriptHash = '0x4380f2c1de98bb267d3ea821897ec571a04fe3e0'; - break; - default: - this.options.node = 'http://localhost:50012'; - this.options.scriptHash = '0x16d6a0be0506b26e0826dd352724cda0defa7131'; - break; - } - this.options = (0, lodash_1.merge)({}, this.options, options); - } - /** - * DO NOT EDIT ME - * Gets the magic number for the network and configures the class instance. - */ - async init() { - const getVersionRes = await this.node.getVersion(); - this.networkMagic = getVersionRes.protocol.network; - } - /** - * DO NOT EDIT ME - * The the node that the instance is connected to. - */ - get node() { - if (this.options.node) { - return new neon_core_1.rpc.RPCClient(this.options.node); - } - throw new Error('no node selected!'); - } - /** - * DO NOT EDIT ME - * The contract script hash that is being interfaced with. - */ - get scriptHash() { - if (this.options.scriptHash) { - return this.options.scriptHash; - } - throw new Error('node scripthash defined'); - } - /** - * - * EDIT ME!!! - * - * This template method is designed to be a passthough so you should really only be changing the name and parameter types. - * All the magic happens in the TemplateAPI.templateMethod. Check there to align your sdk with your smart contract. - * Create one of these pass throughs for each method you expose in your smart contract. The goal of this entire class is to - * simplify the network configuration steps which can be complicated. - */ - async templateMethod(paramA, paramB, paramC, paramD, paramE, signer) { - return api_1.TemplateAPI.templateMethod(this.node.url, this.networkMagic, this.scriptHash, paramA, paramB, paramC, paramD, paramE, signer); - } -} -exports.Template = Template; -//# sourceMappingURL=Template.js.map \ No newline at end of file diff --git a/sdk/dist/Template.js.map b/sdk/dist/Template.js.map deleted file mode 100644 index 405a20d..0000000 --- a/sdk/dist/Template.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Template.js","sourceRoot":"","sources":["../src/Template.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,qDAAiD;AACjD,+BAAiC;AACjC,2CAAkE;AAElE,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED;;;;GAIG;AAEH,MAAa,QAAQ;IAInB,iIAAiI;IACjI,0HAA0H;IAC1H,8GAA8G;IAC9G,YAAY,UAAkC,EAAE;QANxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAM/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD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AM,CAAC,CAAA;IACtI,CAAC;CAIF;AAvED,4BAuEC"} \ No newline at end of file diff --git a/sdk/dist/api/chest.d.ts b/sdk/dist/api/chest.d.ts deleted file mode 100644 index 96ac239..0000000 --- a/sdk/dist/api/chest.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { wallet } from "@cityofzion/neon-core"; -export declare class ChestAPI { - static createChest(node: string, networkMagic: number, contractHash: string, name: string, type: number, eligibleEpochs: [number], puppetTraits: any, signer: wallet.Account): Promise; - static isPuppetEligible(node: string, networkMagic: number, contractHash: string, chestId: string, puppetId: string, signer?: wallet.Account): Promise; - static lootChestWithPuppet(node: string, networkMagic: number, contractHash: string, chestId: string, puppetId: string, signer: wallet.Account): Promise; - static lootChestAsOwner(node: string, networkMagic: number, contractHash: string, chestId: string, signer: wallet.Account): Promise; - static getChestJSON(node: string, networkMagic: number, contractHash: string, chestId: string, signer?: wallet.Account): Promise; - static totalChests(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; -} diff --git a/sdk/dist/api/chest.js b/sdk/dist/api/chest.js deleted file mode 100644 index 9aa7581..0000000 --- a/sdk/dist/api/chest.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ChestAPI = void 0; -const neon_js_1 = require("@cityofzion/neon-js"); -const neon_core_1 = require("@cityofzion/neon-core"); -const helpers_1 = require("../helpers"); -class ChestAPI { - static async createChest(node, networkMagic, contractHash, name, type, eligibleEpochs, puppetTraits, signer) { - const method = "create_chest"; - const epochs = eligibleEpochs.map((value) => { - return neon_js_1.sc.ContractParam.integer(value); - }); - const traits = Object.keys(puppetTraits).map((key) => { - return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.string(key), neon_js_1.sc.ContractParam.string(puppetTraits[key])); - }); - const param = [ - neon_js_1.sc.ContractParam.string(name), - neon_js_1.sc.ContractParam.integer(type), - neon_js_1.sc.ContractParam.array(...epochs), - neon_js_1.sc.ContractParam.array(...traits) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return (0, helpers_1.formatter)(res[0]); - } - static async isPuppetEligible(node, networkMagic, contractHash, chestId, puppetId, signer) { - const method = "is_puppet_eligible"; - const param = [ - neon_js_1.sc.ContractParam.string(chestId), - neon_js_1.sc.ContractParam.string(puppetId), - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return (0, helpers_1.formatter)(res[0]); - } - static async lootChestWithPuppet(node, networkMagic, contractHash, chestId, puppetId, signer) { - const method = "loot_chest_with_puppet"; - const param = [ - neon_js_1.sc.ContractParam.string(chestId), - neon_js_1.sc.ContractParam.string(puppetId), - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return (0, helpers_1.formatter)(res[0]); - } - static async lootChestAsOwner(node, networkMagic, contractHash, chestId, signer) { - const method = "loot_chest_as_owner"; - const param = [ - neon_js_1.sc.ContractParam.string(chestId), - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return (0, helpers_1.formatter)(res[0]); - } - static async getChestJSON(node, networkMagic, contractHash, chestId, signer) { - const method = "get_chest_json"; - const param = [ - neon_js_1.sc.ContractParam.string(chestId), - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - let formattedRes = (0, helpers_1.formatter)(res[0]); - const author = neon_core_1.u.reverseHex(neon_core_1.u.str2hexstring(formattedRes.author)); - formattedRes.author = new neon_core_1.wallet.Account(author); - return formattedRes; - } - static async totalChests(node, networkMagic, contractHash, signer) { - const method = "total_chests"; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); - if (signer) { - return res; - } - return (0, helpers_1.formatter)(res[0]); - } -} -exports.ChestAPI = ChestAPI; -//# sourceMappingURL=chest.js.map \ No newline at end of file diff --git a/sdk/dist/api/chest.js.map b/sdk/dist/api/chest.js.map deleted file mode 100644 index 5386b94..0000000 --- a/sdk/dist/api/chest.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"chest.js","sourceRoot":"","sources":["../../src/api/chest.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AACvC,qDAAgD;AAChD,wCAAqD;AAErD,MAAa,QAAQ;IAEnB,MAAM,CAAC,KAAK,CAAC,WAAW,CACtB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,IAAY,EACZ,IAAY,EACZ,cAAwB,EACxB,YAAiB,EACjB,MAAsB;QAEtB,MAAM,MAAM,GAAG,cAAc,CAAC;QAE9B,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,CAAE,CAAC,KAAK,EAAE,EAAE;YAC3C,OAAO,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACxC,CAAC,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAE,CAAC,GAAG,EAAE,EAAE;YACpD,OAAO,YAAE,CAAC,aAAa,CAAC,KAAK,CAC3B,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,EAC5B,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAC3C,CAAA;QACH,CAAC,CAAC,CAAA;QACF,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC;YAC7B,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC;YAC9B,YAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;YACjC,YAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;SAClC,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,E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,MAAM,CAAC,CAAA;QAChD,OAAO,YAAY,CAAA;IACrB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,WAAW,CACtB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,MAAuB;QAEvB,MAAM,MAAM,GAAG,cAAc,CAAC;QAE9B,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;QACtF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;CAEF;AA5ID,4BA4IC"} \ No newline at end of file diff --git a/sdk/dist/api/collection.d.ts b/sdk/dist/api/collection.d.ts deleted file mode 100644 index 9665b64..0000000 --- a/sdk/dist/api/collection.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { wallet } from "@cityofzion/neon-core"; -import { CollectionType } from "../interface"; -import { ContractParamLike } from "@cityofzion/neon-core/lib/sc"; -export declare class CollectionAPI { - static createCollection(node: string, networkMagic: number, contractHash: string, description: string, collection_type: string, extra: any, values: string[], signer: wallet.Account): Promise; - static createCollectionRaw(node: string, networkMagic: number, contractHash: string, description: string, collection_type: string, extra: any, values: ContractParamLike[], signer: wallet.Account): Promise; - static getCollectionJSON(node: string, networkMagic: number, contractHash: string, collectionId: number, signer?: wallet.Account): Promise; - static getCollection(node: string, networkMagic: number, contractHash: string, collectionId: number, signer?: wallet.Account): Promise; - static getCollectionElement(node: string, networkMagic: number, contractHash: string, collectionId: number, index: number, signer?: wallet.Account): Promise; - static getCollectionLength(node: string, networkMagic: number, contractHash: string, collectionId: number, signer?: wallet.Account): Promise; - static getCollectionValues(node: string, networkMagic: number, contractHash: string, collectionId: number, signer?: wallet.Account): Promise; - static mapBytesOntoCollection(node: string, networkMagic: number, contractHash: string, collectionId: number, entropy: string, signer?: wallet.Account): Promise; - static sampleFromCollection(node: string, networkMagic: number, contractHash: string, collectionId: number, samples: number, signer?: wallet.Account): Promise; - static sampleFromRuntimeCollection(node: string, networkMagic: number, contractHash: string, values: string[], samples: number, pick: boolean, signer: wallet.Account): Promise; - static totalCollections(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; - static update(node: string, networkMagic: number, contractHash: string, script: string, manifest: string, data: any, signer: wallet.Account): Promise; -} diff --git a/sdk/dist/api/collection.js b/sdk/dist/api/collection.js deleted file mode 100644 index a38ab91..0000000 --- a/sdk/dist/api/collection.js +++ /dev/null @@ -1,202 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CollectionAPI = void 0; -const neon_js_1 = require("@cityofzion/neon-js"); -const neon_core_1 = require("@cityofzion/neon-core"); -const helpers_1 = require("../helpers"); -class CollectionAPI { - static async createCollection(node, networkMagic, contractHash, description, collection_type, extra, values, signer) { - const method = "create_collection"; - const raw_traits = values.map((value) => { - return neon_js_1.sc.ContractParam.string(value); - }); - const param = [ - neon_js_1.sc.ContractParam.string(description), - neon_js_1.sc.ContractParam.string(collection_type), - neon_js_1.sc.ContractParam.string(extra), - neon_js_1.sc.ContractParam.array(...raw_traits) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return neon_js_1.u.base642hex(res[0].value); - } - static async createCollectionRaw(node, networkMagic, contractHash, description, collection_type, extra, values, signer) { - const method = "create_collection"; - const param = [ - neon_js_1.sc.ContractParam.string(description), - neon_js_1.sc.ContractParam.string(collection_type), - neon_js_1.sc.ContractParam.string(extra), - neon_js_1.sc.ContractParam.array(...values) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return neon_js_1.u.base642hex(res[0].value); - } - static async getCollectionJSON(node, networkMagic, contractHash, collectionId, signer) { - const method = "get_collection_json"; - const param = [ - neon_js_1.sc.ContractParam.integer(collectionId) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - const result = {}; - if (res[0] && res[0].value) { - res[0].value.forEach((entry) => { - let key = neon_js_1.u.hexstring2str(neon_js_1.u.base642hex(entry.key.value)); - let bytes; - switch (key) { - case "id": - bytes = neon_js_1.u.base642hex(entry.value.value); - result.id = parseInt(bytes, 16); - break; - case "author": - bytes = neon_js_1.u.base642hex(entry.value.value); - result.author = new neon_core_1.wallet.Account(bytes); - break; - case "type": - result.type = neon_js_1.u.hexstring2str(neon_js_1.u.base642hex(entry.value.value)); - break; - case "description": - result.description = neon_js_1.u.hexstring2str(neon_js_1.u.base642hex(entry.value.value)); - break; - case "values": - result.valuesRaw = entry.value.value; - break; - } - }); - } - switch (result.type) { - case "string": - result.values = result.valuesRaw.map((value) => { - return (0, helpers_1.formatter)(value); - }); - break; - case "int": - result.values = result.valuesRaw.map((value) => { - let bytes = (0, helpers_1.formatter)(value); - return parseInt(bytes, 16); - }); - break; - } - return result; - } - static async getCollection(node, networkMagic, contractHash, collectionId, signer) { - const method = "get_collection"; - const param = [ - neon_js_1.sc.ContractParam.integer(collectionId) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return neon_js_1.u.base642hex(res[0].value); - } - static async getCollectionElement(node, networkMagic, contractHash, collectionId, index, signer) { - const method = "get_collection_element"; - const param = [ - neon_js_1.sc.ContractParam.integer(collectionId), - neon_js_1.sc.ContractParam.integer(index) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return neon_js_1.u.base642hex(res[0].value); - } - static async getCollectionLength(node, networkMagic, contractHash, collectionId, signer) { - const method = "get_collection_length"; - const param = [ - neon_js_1.sc.ContractParam.integer(collectionId) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return parseInt(res[0].value); - } - static async getCollectionValues(node, networkMagic, contractHash, collectionId, signer) { - const method = "get_collection_values"; - const param = [ - neon_js_1.sc.ContractParam.integer(collectionId) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return res[0].value.map((value) => { - return neon_js_1.u.base642hex(value.value); - }); - } - static async mapBytesOntoCollection(node, networkMagic, contractHash, collectionId, entropy, signer) { - const method = "map_bytes_onto_collection"; - const param = [ - neon_js_1.sc.ContractParam.integer(collectionId), - neon_js_1.sc.ContractParam.string(entropy) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return neon_js_1.u.base642hex(res[0].value); - } - static async sampleFromCollection(node, networkMagic, contractHash, collectionId, samples, signer) { - const method = "sample_from_collection"; - const param = [ - neon_js_1.sc.ContractParam.integer(collectionId), - neon_js_1.sc.ContractParam.integer(samples) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return neon_js_1.u.base642hex(res[0].value); - } - static async sampleFromRuntimeCollection(node, networkMagic, contractHash, values, samples, pick, signer) { - const method = "sample_from_runtime_collection"; - const raw_values = values.map((value) => { - return neon_js_1.sc.ContractParam.string(value); - }); - const param = [ - neon_js_1.sc.ContractParam.array(...raw_values), - neon_js_1.sc.ContractParam.integer(samples), - neon_js_1.sc.ContractParam.boolean(pick) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return neon_js_1.u.base642hex(res[0].value); - } - static async totalCollections(node, networkMagic, contractHash, signer) { - const method = "total_collections"; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); - if (signer) { - return res; - } - if (res === undefined || res.length === 0) { - throw new Error("unrecognized response"); - } - return parseInt(res[0].value); - } - static async update(node, networkMagic, contractHash, script, manifest, data, signer) { - const method = "update"; - const params = [ - neon_js_1.sc.ContractParam.byteArray(script), - neon_js_1.sc.ContractParam.string(manifest), - neon_js_1.sc.ContractParam.any(data) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); - if (signer) { - return res; - } - return (0, helpers_1.formatter)(res); - } -} -exports.CollectionAPI = CollectionAPI; -//# sourceMappingURL=collection.js.map \ No newline at end of file diff --git a/sdk/dist/api/collection.js.map b/sdk/dist/api/collection.js.map deleted file mode 100644 index b9caff8..0000000 --- a/sdk/dist/api/collection.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"collection.js","sourceRoot":"","sources":["../../src/api/collection.ts"],"names":[],"mappings":";;;AAAA,iDAA0C;AAE1C,qDAA6C;AAG7C,wCAAqD;AAErD,MAAa,aAAa;IAExB,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,WAAmB,EACnB,eAAuB,EACvB,KAAU,EACV,MAAgB,EAChB,MAAsB;QAEtB,MAAM,MAAM,GAAG,mBAAmB,CAAC;QAEnC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAE,CAAC,KAAK,EAAE,EAAE;YACvC,OAAO,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACvC,CAAC,CAAC,CAAA;QAEF,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC;YACpC,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,eAAe,CAAC;YACxC,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;YAC9B,YAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC;SACtC,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,C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,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;YACzC,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;SAC1C;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,MAAc,EACd,QAAgB,EAChB,IAAS,EACT,MAAsB;QAEtB,MAAM,MAAM,GAAG,QAAQ,CAAC;QACxB,MAAM,MAAM,GAAG;YACb,YAAE,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC;YAClC,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC;YACjC,YAAE,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC;SAC3B,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QAC1F,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC;IACxB,CAAC;CAEF;AA/SD,sCA+SC"} \ No newline at end of file diff --git a/sdk/dist/api/dice.d.ts b/sdk/dist/api/dice.d.ts deleted file mode 100644 index 46e8fb2..0000000 --- a/sdk/dist/api/dice.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { wallet } from "@cityofzion/neon-core"; -export declare class DiceAPI { - static rollDie(node: string, networkMagic: number, contractHash: string, die: string, signer?: wallet.Account): Promise; - static rollDiceWithEntropy(node: string, networkMagic: number, contractHash: string, die: string, precision: number, entropy: string, signer?: wallet.Account): Promise; - static randBetween(node: string, networkMagic: number, contractHash: string, start: number, end: number, signer?: wallet.Account): Promise; - static mapBytesOntoRange(node: string, networkMagic: number, contractHash: string, start: number, end: number, entropy: string, signer?: wallet.Account): Promise; -} diff --git a/sdk/dist/api/dice.js b/sdk/dist/api/dice.js deleted file mode 100644 index 2390c80..0000000 --- a/sdk/dist/api/dice.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DiceAPI = void 0; -const neon_js_1 = require("@cityofzion/neon-js"); -const helpers_1 = require("../helpers"); -class DiceAPI { - static async rollDie(node, networkMagic, contractHash, die, signer) { - const method = "roll_die"; - const param = [ - neon_js_1.sc.ContractParam.string(die) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return parseInt(res[0].value); - } - static async rollDiceWithEntropy(node, networkMagic, contractHash, die, precision, entropy, signer) { - const method = "roll_dice_with_entropy"; - const param = [ - neon_js_1.sc.ContractParam.string(die), - neon_js_1.sc.ContractParam.integer(precision), - neon_js_1.sc.ContractParam.string(entropy) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return [parseInt(res[0].value)]; - } - static async randBetween(node, networkMagic, contractHash, start, end, signer) { - const method = "rand_between"; - const param = [ - neon_js_1.sc.ContractParam.integer(start), - neon_js_1.sc.ContractParam.integer(end) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return parseInt(res[0].value); - } - static async mapBytesOntoRange(node, networkMagic, contractHash, start, end, entropy, signer) { - const method = "map_bytes_onto_range"; - const param = [ - neon_js_1.sc.ContractParam.integer(start), - neon_js_1.sc.ContractParam.integer(end), - neon_js_1.sc.ContractParam.string(entropy) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return parseInt(res[0].value); - } -} -exports.DiceAPI = DiceAPI; -//# sourceMappingURL=dice.js.map \ No newline at end of file diff --git a/sdk/dist/api/dice.js.map b/sdk/dist/api/dice.js.map deleted file mode 100644 index 7fcbc3b..0000000 --- a/sdk/dist/api/dice.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"dice.js","sourceRoot":"","sources":["../../src/api/dice.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AAGvC,wCAA0C;AAE1C,MAAa,OAAO;IAElB,MAAM,CAAC,KAAK,CAAC,OAAO,CAClB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,GAAW,EACX,MAAuB;QAEvB,MAAM,MAAM,GAAG,UAAU,CAAC;QAC1B,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC;SAC7B,CAAA;QACD,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAC9B,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,GAAW,EACX,SAAiB,EACjB,OAAe,EACf,MAAuB;QAEvB,MAAM,MAAM,GAAG,wBAAwB,CAAC;QACxC,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC;YAC5B,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC;YACnC,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC;SACjC,CAAA;QACD,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,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AAO,GAAG,CAAA;SACX;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC;IAC1C,CAAC;CACF;AAnFD,0BAmFC"} \ No newline at end of file diff --git a/sdk/dist/api/generator.d.ts b/sdk/dist/api/generator.d.ts deleted file mode 100644 index 9f06537..0000000 --- a/sdk/dist/api/generator.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { wallet } from "@cityofzion/neon-core"; -import { GeneratorType, InstanceAccessMode, InstanceAuthorizedContracts, TraitLevel, TraitType } from "../interface"; -export declare class GeneratorAPI { - static createGenerator(node: string, networkMagic: number, contractHash: string, label: string, baseGeneratorFee: number, signer: wallet.Account): Promise; - static createInstance(node: string, networkMagic: number, contractHash: string, generatorId: number, signer: wallet.Account): Promise; - static createTrait(node: string, networkMagic: number, contractHash: string, generatorId: number, label: string, slots: number, levels: TraitLevel[], signer: wallet.Account): Promise; - static getGeneratorJSON(node: string, networkMagic: number, contractHash: string, generatorId: number, signer?: wallet.Account): Promise; - static getTraitJSON(node: string, networkMagic: number, contractHash: string, traitId: string, signer?: wallet.Account): Promise; - static getGeneratorInstanceJSON(node: string, networkMagic: number, contractHash: string, instanceId: number, signer?: wallet.Account): Promise; - static mintFromInstance(node: string, networkMagic: number, contractHash: string, instanceId: number, signer: wallet.Account): Promise; - static setInstanceAccessMode(node: string, networkMagic: number, contractHash: string, instanceId: number, accessMode: InstanceAccessMode, signer: wallet.Account): Promise; - static setInstanceAuthorizedUsers(node: string, networkMagic: number, contractHash: string, instanceId: number, authorizedUsers: string[], signer: wallet.Account): Promise; - static setInstanceAuthorizedContracts(node: string, networkMagic: number, contractHash: string, instanceId: number, authorizedContracts: InstanceAuthorizedContracts[], signer: wallet.Account): Promise; - static setInstanceFee(node: string, networkMagic: number, contractHash: string, instanceId: number, fee: number, signer: wallet.Account): Promise; - static totalGenerators(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; - static totalGeneratorInstances(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; -} diff --git a/sdk/dist/api/generator.js b/sdk/dist/api/generator.js deleted file mode 100644 index 1cafc0f..0000000 --- a/sdk/dist/api/generator.js +++ /dev/null @@ -1,153 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.GeneratorAPI = void 0; -const neon_js_1 = require("@cityofzion/neon-js"); -const interface_1 = require("../interface"); -const helpers_1 = require("../helpers"); -class GeneratorAPI { - static async createGenerator(node, networkMagic, contractHash, label, baseGeneratorFee, signer) { - const method = "create_generator"; - const param = [ - neon_js_1.sc.ContractParam.string(label), - neon_js_1.sc.ContractParam.integer(baseGeneratorFee) - ]; - return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - } - static async createInstance(node, networkMagic, contractHash, generatorId, signer) { - const method = "create_instance"; - const param = [ - neon_js_1.sc.ContractParam.integer(generatorId) - ]; - return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - } - static async createTrait(node, networkMagic, contractHash, generatorId, label, slots, levels, signer) { - const method = "create_trait"; - const traitLevelsFormatted = levels.map((traitLevel) => { - const traitPointers = traitLevel.traits.map((traitEvent) => { - switch (traitEvent.type) { - case interface_1.EventTypeEnum.CollectionPointer: - const collectionPointer = traitEvent.args; - return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.integer(traitEvent.type), neon_js_1.sc.ContractParam.integer(traitEvent.maxMint), neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.integer(collectionPointer.collectionId), neon_js_1.sc.ContractParam.integer(collectionPointer.index))); - case interface_1.EventTypeEnum.InstanceCall: - const instanceCall = traitEvent.args; - return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.integer(traitEvent.type), neon_js_1.sc.ContractParam.integer(traitEvent.maxMint), neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.hash160(instanceCall.scriptHash), neon_js_1.sc.ContractParam.string(instanceCall.method), neon_js_1.sc.ContractParam.array(...instanceCall.param))); - case interface_1.EventTypeEnum.Value: - const valueCall = traitEvent.args; - return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.integer(traitEvent.type), neon_js_1.sc.ContractParam.integer(traitEvent.maxMint), neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.byteArray(valueCall.value))); - case interface_1.EventTypeEnum.CollectionSampleFrom: - const collectionPtr = traitEvent.args; - return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.integer(traitEvent.type), neon_js_1.sc.ContractParam.integer(traitEvent.maxMint), neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.integer(collectionPtr.collectionId))); - default: - throw new Error("unrecognized trait event type"); - } - }); - return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.integer(traitLevel.dropScore), neon_js_1.sc.ContractParam.integer(traitLevel.mintMode), neon_js_1.sc.ContractParam.array(...traitPointers)); - }); - const param = [ - neon_js_1.sc.ContractParam.integer(generatorId), - neon_js_1.sc.ContractParam.string(label), - neon_js_1.sc.ContractParam.integer(slots), - neon_js_1.sc.ContractParam.array(...traitLevelsFormatted) - ]; - return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - } - //getGenerator - static async getGeneratorJSON(node, networkMagic, contractHash, generatorId, signer) { - const method = "get_generator_json"; - const param = [ - neon_js_1.sc.ContractParam.integer(generatorId) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return (0, helpers_1.formatter)(res[0]); - } - static async getTraitJSON(node, networkMagic, contractHash, traitId, signer) { - const method = "get_trait_json"; - const param = [ - neon_js_1.sc.ContractParam.string(traitId) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return (0, helpers_1.formatter)(res[0]); - } - //getGeneratorInstance - static async getGeneratorInstanceJSON(node, networkMagic, contractHash, instanceId, signer) { - const method = "get_generator_instance_json"; - const param = [ - neon_js_1.sc.ContractParam.integer(instanceId) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return (0, helpers_1.formatter)(res[0]); - } - static async mintFromInstance(node, networkMagic, contractHash, instanceId, signer) { - const method = "mint_from_instance"; - const param = [ - neon_js_1.sc.ContractParam.string(''), - neon_js_1.sc.ContractParam.integer(instanceId) - ]; - return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - } - static async setInstanceAccessMode(node, networkMagic, contractHash, instanceId, accessMode, signer) { - const method = "set_instance_access_mode"; - const param = [ - neon_js_1.sc.ContractParam.integer(instanceId), - neon_js_1.sc.ContractParam.integer(accessMode) - ]; - return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - } - static async setInstanceAuthorizedUsers(node, networkMagic, contractHash, instanceId, authorizedUsers, signer) { - const method = "set_instance_authorized_users"; - const usersFormatted = authorizedUsers.map((user) => { - return neon_js_1.sc.ContractParam.hash160(user); - }); - const param = [ - neon_js_1.sc.ContractParam.integer(instanceId), - neon_js_1.sc.ContractParam.array(...usersFormatted) - ]; - return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - } - static async setInstanceAuthorizedContracts(node, networkMagic, contractHash, instanceId, authorizedContracts, signer) { - const method = "set_instance_authorized_contracts"; - const contractsFormatted = authorizedContracts.map((contract) => { - return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.hash160(contract.scriptHash), neon_js_1.sc.ContractParam.integer(contract.code)); - }); - const param = [ - neon_js_1.sc.ContractParam.integer(instanceId), - neon_js_1.sc.ContractParam.array(...contractsFormatted) - ]; - return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - } - static async setInstanceFee(node, networkMagic, contractHash, instanceId, fee, signer) { - const method = "set_instance_fee"; - const param = [ - neon_js_1.sc.ContractParam.integer(instanceId), - neon_js_1.sc.ContractParam.integer(fee) - ]; - return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - } - static async totalGenerators(node, networkMagic, contractHash, signer) { - const method = "total_generators"; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); - if (signer) { - return res; - } - return parseInt(res[0].value); - } - static async totalGeneratorInstances(node, networkMagic, contractHash, signer) { - const method = "total_generator_instances"; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); - if (signer) { - return res; - } - return parseInt(res[0].value); - } -} -exports.GeneratorAPI = GeneratorAPI; -//# sourceMappingURL=generator.js.map \ No newline at end of file diff --git a/sdk/dist/api/generator.js.map b/sdk/dist/api/generator.js.map deleted file mode 100644 index 0b42252..0000000 --- a/sdk/dist/api/generator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/api/generator.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AAEvC,4CAWsB;AACtB,wCAAqD;AAErD,MAAa,YAAY;IAEvB,MAAM,CAAC,KAAK,CAAC,eAAe,CAC1B,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,KAAa,EACb,gBAAwB,EACxB,MAAsB;QAEtB,MAAM,MAAM,GAAG,kBAAkB,CAAC;QAElC,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;YAC9B,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,gBAAgB,CAAC;SAC3C,CAAA;QAED,OAAO,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IACtF,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,cAAc,CACzB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,WAAmB,EACnB,MAAsB;QAEtB,MAAM,MAAM,GAAG,iBAAiB,CAAC;QAEjC,MAAM,KAAK,GAAG;YACZ,YAA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M,CAAC,CAAA;QACtF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAClC,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,MAAuB;QAEvB,MAAM,MAAM,GAAG,2BAA2B,CAAC;QAE3C,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;QACtF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC;IAC1C,CAAC;CACF;AAjTD,oCAiTC"} \ No newline at end of file diff --git a/sdk/dist/api/index.d.ts b/sdk/dist/api/index.d.ts deleted file mode 100644 index 955f33d..0000000 --- a/sdk/dist/api/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from "./dice"; -export * from "./chest"; -export * from "./puppet"; -export * from "./interface"; -export * from "./collection"; -export * from "./generator"; -export * from "./template"; diff --git a/sdk/dist/api/index.js b/sdk/dist/api/index.js deleted file mode 100644 index 5a378bd..0000000 --- a/sdk/dist/api/index.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./dice"), exports); -__exportStar(require("./chest"), exports); -__exportStar(require("./puppet"), exports); -__exportStar(require("./interface"), exports); -__exportStar(require("./collection"), exports); -__exportStar(require("./generator"), exports); -__exportStar(require("./template"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/sdk/dist/api/index.js.map b/sdk/dist/api/index.js.map deleted file mode 100644 index 356f7e6..0000000 --- a/sdk/dist/api/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAsB;AACtB,0CAAuB;AACvB,2CAAyB;AACzB,8CAA2B;AAC3B,+CAA4B;AAC5B,8CAA2B;AAC3B,6CAA0B"} \ No newline at end of file diff --git a/sdk/dist/api/interface.d.ts b/sdk/dist/api/interface.d.ts deleted file mode 100644 index 69a894f..0000000 --- a/sdk/dist/api/interface.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import StackItemJson, { wallet } from "@cityofzion/neon-core"; -export interface InteropInterface { - type: string; - iterator?: StackItemJson.sc.StackItemJson[]; - truncated: boolean; - value?: StackItemJson.sc.StackItemJson[]; -} -export declare class NeoInterface { - /** - * A method for executing test invocations on the Neo blockchain - * @param rpcAddress the rpc endpoint for a neo full node - * @param networkMagic the network magic for the target network. Query - * @param scriptHash - * @param operation - * @param args - * @constructor - */ - static testInvoke(rpcAddress: string, networkMagic: number, scriptHash: string, operation: string, args: any[]): Promise; - /** - * A method for publishing contract invocations on the Neo Blockchain. - * @param rpcAddress - * @param networkMagic - * @param scriptHash - * @param operation - * @param args - * @param account - */ - static publishInvoke(rpcAddress: string, networkMagic: number, scriptHash: string, operation: string, args: any[], account: wallet.Account): Promise; -} diff --git a/sdk/dist/api/interface.js b/sdk/dist/api/interface.js deleted file mode 100644 index 5975385..0000000 --- a/sdk/dist/api/interface.js +++ /dev/null @@ -1,95 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NeoInterface = void 0; -const neon_js_1 = __importStar(require("@cityofzion/neon-js")); -const axios_1 = __importDefault(require("axios")); -class NeoInterface { - /** - * A method for executing test invocations on the Neo blockchain - * @param rpcAddress the rpc endpoint for a neo full node - * @param networkMagic the network magic for the target network. Query - * @param scriptHash - * @param operation - * @param args - * @constructor - */ - static async testInvoke(rpcAddress, networkMagic, scriptHash, operation, args) { - const res = await new neon_js_1.rpc.RPCClient(rpcAddress).invokeFunction(scriptHash, operation, args); - if (res.exception) { - throw new Error("Invocation Error: " + res.exception); - } - if (res.stack[0].type === 'InteropInterface') { - // @ts-ignore - // @ts-ignore - const ijson = { - // @ts-ignore - "jsonrpc": "2.0", - "id": 1, - "method": "traverseiterator", - "params": [ - // @ts-ignore - res.session, - // @ts-ignore - res.stack[0].id, - 100 - ] - }; - const { data } = await (0, axios_1.default)({ - method: 'post', - url: rpcAddress, - data: ijson, - }); - return data.result; - } - return res.stack; - } - /** - * A method for publishing contract invocations on the Neo Blockchain. - * @param rpcAddress - * @param networkMagic - * @param scriptHash - * @param operation - * @param args - * @param account - */ - static async publishInvoke(rpcAddress, networkMagic, scriptHash, operation, args, account) { - const contract = new neon_js_1.default.experimental.SmartContract(neon_js_1.default.u.HexString.fromHex(scriptHash), { - networkMagic, - rpcAddress, - account - }); - let result; - try { - result = await contract.invoke(operation, args); - } - catch (e) { - console.log("errored here"); - console.log(e); - } - return result; - } -} -exports.NeoInterface = NeoInterface; -//# sourceMappingURL=interface.js.map \ No newline at end of file diff --git a/sdk/dist/api/interface.js.map b/sdk/dist/api/interface.js.map deleted file mode 100644 index 536eb96..0000000 --- a/sdk/dist/api/interface.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/api/interface.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAAiD;AAGjD,kDAAyB;AAUzB,MAAa,YAAY;IACvB;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,UAAU,CACrB,UAAkB,EAClB,YAAoB,EACpB,UAAkB,EAClB,SAAiB,EACjB,IAAW;QAGX,MAAM,GAAG,GAAG,MAAM,IAAI,aAAG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,cAAc,CAC5D,UAAU,EACV,SAAS,EACT,IAAI,CACL,CAAA;QACD,IAAI,GAAG,CAAC,SAAS,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;SACtD;QACD,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,kBAAkB,EAAC;YAC3C,aAAa;YACb,aAAa;YACb,MAAM,KAAK,GAAG;gBACZ,aAAa;gBACb,SAAS,EAAE,KAAK;gBAChB,IAAI,EAAE,CAAC;gBACP,QAAQ,EAAE,kBAAkB;gBAC5B,QAAQ,EAAE;oBACR,aAAa;oBACb,GAAG,CAAC,OAAO;oBACX,aAAa;oBACb,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;oBACf,GAAG;iBACJ;aACF,CAAA;YACD,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAA,eAAK,EAAC;gBACzB,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,UAAU;gBACf,IAAI,EAAE,KAAK;aACZ,CAAC,CAAA;YACF,OAAO,IAAI,CAAC,MAAM,CAAA;SACnB;QACD,OAAO,GAAG,CAAC,KAAK,CAAC;IACnB,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,aAAa,CACxB,UAAkB,EAClB,YAAoB,EACpB,UAAkB,EAClB,SAAiB,EACjB,IAAW,EACX,OAAuB;QAGvB,MAAM,QAAQ,GAAG,IAAI,iBAAI,CAAC,YAAY,CAAC,aAAa,CAClD,iBAAI,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EACpC;YACE,YAAY;YACZ,UAAU;YACV,OAAO;SACR,CACF,CAAC;QAEF,IAAI,MAAM,CAAC;QACX,IAAI;YACF,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SACjD;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SAChB;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAzFD,oCAyFC"} \ No newline at end of file diff --git a/sdk/dist/api/puppet.d.ts b/sdk/dist/api/puppet.d.ts deleted file mode 100644 index 49b07c6..0000000 --- a/sdk/dist/api/puppet.d.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { wallet } from "@cityofzion/neon-core"; -import { EpochType, PuppetType } from "../interface"; -export declare class PuppetAPI { - /** - * Returns the balance of an account - * @param node - * @param networkMagic - * @param contractHash - * @param address - * @param signer - */ - static balanceOf(node: string, networkMagic: number, contractHash: string, address: string, signer?: wallet.Account): Promise; - static createEpoch(node: string, networkMagic: number, contractHash: string, label: string, generatorInstanceId: number, initialRollCollectionId: number, mintFee: number, sysFee: number, maxSupply: number, signer: wallet.Account): Promise; - /** - * Returns the decimals of the token - * @param node - * @param networkMagic - * @param contractHash - * @param signer - */ - static decimals(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; - /** - * Initializes the smart contract on first deployment (REQUIRED) - * @param node - * @param networkMagic - * @param contractHash - * @param signer The signing account, which will become the first admin if upgrade == false - */ - static deploy(node: string, networkMagic: number, contractHash: string, signer: wallet.Account): Promise; - static getAttributeMod(node: string, networkMagic: number, contractHash: string, attributeValue: number, signer?: wallet.Account): Promise; - static getPuppetJSON(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; - static getPuppetJSONFlat(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; - static getPuppetRaw(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; - /** - * Gets the owner account of a tokenId - * @param node - * @param networkMagic - * @param contractHash - * @param tokenId The tokenId to return the owner of - * @param signer - */ - static ownerOf(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; - static offlineMint(node: string, networkMagic: number, contractHash: string, epochId: number, owner: string, signer: wallet.Account): Promise; - /** - * Gets the properties of a token - * @param node - * @param networkMagic - * @param contractHash - * @param tokenId The tokenId of the token being requested - * @param signer An optional signer. Populating this value will publish a transaction and return a txid - */ - static properties(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; - static setMintFee(node: string, networkMagic: number, contractHash: string, epochId: number, fee: number, signer: wallet.Account): Promise; - /** - * Returns the token symbol - * @param node - * @param networkMagic - * @param contractHash - * @param signer - */ - static symbol(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; - /** - * Gets and array of strings(tokenIds) representing all the tokens associated with the contract - * @param node - * @param networkMagic - * @param contractHash - * @param signer - */ - static tokens(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; - /** - * Gets an array of strings(tokenId) owned by an address - * @param node - * @param networkMagic - * @param contractHash - * @param address The string formatted address of an account - * @param signer - */ - static tokensOf(node: string, networkMagic: number, contractHash: string, address: string, signer?: wallet.Account): Promise; - /** - * Gets the total number of accounts stored in the contract - * @param node - * @param networkMagic - * @param contractHash - * @param signer - */ - static totalAccounts(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; - static totalEpochs(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; - /** - * Returns the total supply of the token - * @param node - * @param networkMagic - * @param contractHash - * @param signer - */ - static totalSupply(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; - /** - * Transfers a token to another account - * @param node - * @param networkMagic - * @param contractHash - * @param toAddress - * @param tokenId - * @param signer - * @param data - */ - static transfer(node: string, networkMagic: number, contractHash: string, toAddress: string, tokenId: string, signer: wallet.Account, data?: any): Promise; - static update(node: string, networkMagic: number, contractHash: string, script: string, manifest: string, data: any, signer: wallet.Account): Promise; - static getEpochJSON(node: string, networkMagic: number, contractHash: string, epochId: number, signer?: wallet.Account): Promise; -} diff --git a/sdk/dist/api/puppet.js b/sdk/dist/api/puppet.js deleted file mode 100644 index 896e8e0..0000000 --- a/sdk/dist/api/puppet.js +++ /dev/null @@ -1,323 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PuppetAPI = void 0; -const neon_js_1 = __importStar(require("@cityofzion/neon-js")); -const neon_core_1 = require("@cityofzion/neon-core"); -const helpers_1 = require("../helpers"); -class PuppetAPI { - /** - * Returns the balance of an account - * @param node - * @param networkMagic - * @param contractHash - * @param address - * @param signer - */ - static async balanceOf(node, networkMagic, contractHash, address, signer) { - const method = "balanceOf"; - const params = [neon_js_1.sc.ContractParam.hash160(address)]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); - if (signer) { - return res; - } - return parseInt(res[0].value); - } - static async createEpoch(node, networkMagic, contractHash, label, generatorInstanceId, initialRollCollectionId, mintFee, sysFee, maxSupply, signer) { - const method = "create_epoch"; - const params = [ - neon_js_1.sc.ContractParam.string(label), - neon_js_1.sc.ContractParam.integer(generatorInstanceId), - neon_js_1.sc.ContractParam.integer(initialRollCollectionId), - neon_js_1.sc.ContractParam.integer(mintFee), - neon_js_1.sc.ContractParam.integer(sysFee), - neon_js_1.sc.ContractParam.integer(maxSupply) - ]; - return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); - } - /** - * Returns the decimals of the token - * @param node - * @param networkMagic - * @param contractHash - * @param signer - */ - static async decimals(node, networkMagic, contractHash, signer) { - const method = "decimals"; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); - if (signer) { - return res; - } - return parseInt(res[0].value); - } - /** - * Initializes the smart contract on first deployment (REQUIRED) - * @param node - * @param networkMagic - * @param contractHash - * @param signer The signing account, which will become the first admin if upgrade == false - */ - static async deploy(node, networkMagic, contractHash, signer) { - const method = "deploy"; - return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); - } - static async getAttributeMod(node, networkMagic, contractHash, attributeValue, signer) { - const method = "roll_initial_stat"; - const params = [ - neon_js_1.sc.ContractParam.integer(attributeValue) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); - if (signer) { - return res; - } - return parseInt(res[0].value); - } - static async getPuppetJSON(node, networkMagic, contractHash, tokenId, signer) { - const method = "get_puppet_json"; - const param = [neon_js_1.sc.ContractParam.string(tokenId)]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return (0, helpers_1.formatter)(res[0]); - } - static async getPuppetJSONFlat(node, networkMagic, contractHash, tokenId, signer) { - const method = "get_puppet_json_flat"; - const params = [neon_js_1.sc.ContractParam.string(tokenId)]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); - if (signer) { - return res; - } - return (0, helpers_1.formatter)(res[0]); - } - static async getPuppetRaw(node, networkMagic, contractHash, tokenId, signer) { - const method = "get_puppet_raw"; - const params = [neon_js_1.sc.ContractParam.string(tokenId)]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); - if (signer) { - return res; - } - return res[0].value; - } - /** - * Gets the owner account of a tokenId - * @param node - * @param networkMagic - * @param contractHash - * @param tokenId The tokenId to return the owner of - * @param signer - */ - static async ownerOf(node, networkMagic, contractHash, tokenId, signer) { - const method = "ownerOf"; - const params = [neon_js_1.sc.ContractParam.string(tokenId)]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); - if (signer) { - return res; - } - const rawValue = neon_js_1.u.base642hex(res[0].value); - return new neon_core_1.wallet.Account(neon_js_1.u.reverseHex(rawValue)); - } - static async offlineMint(node, networkMagic, contractHash, epochId, owner, signer) { - const method = "offline_mint"; - const params = [ - neon_js_1.sc.ContractParam.integer(epochId), - neon_js_1.sc.ContractParam.hash160(owner) - ]; - return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); - } - /** - * Gets the properties of a token - * @param node - * @param networkMagic - * @param contractHash - * @param tokenId The tokenId of the token being requested - * @param signer An optional signer. Populating this value will publish a transaction and return a txid - */ - static async properties(node, networkMagic, contractHash, tokenId, signer) { - const method = "properties"; - const params = [neon_js_1.sc.ContractParam.string(tokenId)]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); - if (signer) { - return res; - } - return (0, helpers_1.formatter)(res[0]); - } - static async setMintFee(node, networkMagic, contractHash, epochId, fee, signer) { - const method = "set_mint_fee"; - const params = [ - neon_js_1.sc.ContractParam.integer(epochId), - neon_js_1.sc.ContractParam.integer(fee) - ]; - return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); - } - /** - * Returns the token symbol - * @param node - * @param networkMagic - * @param contractHash - * @param signer - */ - static async symbol(node, networkMagic, contractHash, signer) { - const method = "symbol"; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); - if (signer) { - return res; - } - return neon_js_1.default.u.HexString.fromBase64(res[0].value).toAscii(); - } - /** - * Gets and array of strings(tokenIds) representing all the tokens associated with the contract - * @param node - * @param networkMagic - * @param contractHash - * @param signer - */ - static async tokens(node, networkMagic, contractHash, signer) { - const method = "tokens"; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); - if (signer) { - return res; - } - if (res === undefined || res.length === 0) { - throw new Error("unrecognized response"); - } - const iterator = res[0]; - if (iterator.iterator && iterator.iterator.length > 0 && iterator.iterator[0].value) { - return iterator.iterator.map((token) => { - const attrs = token.value; - return (0, helpers_1.formatter)(attrs[0]); - }); - } - if (iterator.iterator && iterator.iterator.length === 0) { - return []; - } - throw new Error("unable to resolve respond format"); - } - /** - * Gets an array of strings(tokenId) owned by an address - * @param node - * @param networkMagic - * @param contractHash - * @param address The string formatted address of an account - * @param signer - */ - static async tokensOf(node, networkMagic, contractHash, address, signer) { - const method = "tokensOf"; - const params = [neon_js_1.sc.ContractParam.hash160(address)]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); - if (signer) { - return res; - } - // @ts-ignore - const tokens = []; - res.forEach((token) => { - if (token.value.length === 2) { - tokens.push((0, helpers_1.formatter)(token.value[1])); - } - else { - tokens.push((0, helpers_1.formatter)(token)); - } - }); - return tokens; - } - /** - * Gets the total number of accounts stored in the contract - * @param node - * @param networkMagic - * @param contractHash - * @param signer - */ - static async totalAccounts(node, networkMagic, contractHash, signer) { - const method = "total_accounts"; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); - if (signer) { - return res; - } - return parseInt(res[0].value); - } - static async totalEpochs(node, networkMagic, contractHash, signer) { - const method = "total_epochs"; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); - if (signer) { - return res; - } - return parseInt(res[0].value); - } - /** - * Returns the total supply of the token - * @param node - * @param networkMagic - * @param contractHash - * @param signer - */ - static async totalSupply(node, networkMagic, contractHash, signer) { - const method = "totalSupply"; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); - if (signer) { - return res; - } - return parseInt(res[0].value); - } - /** - * Transfers a token to another account - * @param node - * @param networkMagic - * @param contractHash - * @param toAddress - * @param tokenId - * @param signer - * @param data - */ - static async transfer(node, networkMagic, contractHash, toAddress, tokenId, signer, data) { - const method = "transfer"; - const params = [ - neon_js_1.sc.ContractParam.hash160(toAddress), - neon_js_1.sc.ContractParam.string(tokenId), - data, - ]; - return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); - } - static async update(node, networkMagic, contractHash, script, manifest, data, signer) { - const method = "update"; - const params = [ - neon_js_1.sc.ContractParam.byteArray(script), - neon_js_1.sc.ContractParam.string(manifest), - neon_js_1.sc.ContractParam.any(data) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); - if (signer) { - return res; - } - return (0, helpers_1.formatter)(res); - } - //setUserPermissions - static async getEpochJSON(node, networkMagic, contractHash, epochId, signer) { - const method = "get_epoch_json"; - const param = [neon_js_1.sc.ContractParam.integer(epochId)]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return (0, helpers_1.formatter)(res); - } -} -exports.PuppetAPI = PuppetAPI; -//# sourceMappingURL=puppet.js.map \ No newline at end of file diff --git a/sdk/dist/api/puppet.js.map b/sdk/dist/api/puppet.js.map deleted file mode 100644 index d9ccc50..0000000 --- a/sdk/dist/api/puppet.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"puppet.js","sourceRoot":"","sources":["../../src/api/puppet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA,+DAAkD;AAClD,qDAA+C;AAG/C,wCAAqD;AAErD,MAAa,SAAS;IAEpB;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,SAAS,CACpB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,OAAe,EACf,MAAuB;QAEvB,MAAM,MAAM,GAAG,WAAW,CAAC;QAE3B,MAAM,MAAM,GAAG,CAAC,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACnD,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QAC1F,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,WAAW,CACtB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,KAAa,EACb,mBAA2B,EAC3B,uBAA+B,EAC/B,OAAe,EACf,MAAc,EACd,SAAiB,EACjB,MAAsB;QAEtB,MAAM,MAAM,GAAG,cAAc,CAAC;QAC9B,MAAM,MAAM,GAAG;YACb,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;YAC9B,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,mBAAmB,CAAC;YAC7C,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,uBAAuB,CAAC;YACjD,YAAE,CAAC,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AM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QAED,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAc,CAAA;IACpC,CAAC;CAEF;AAtdD,8BAsdC"} \ No newline at end of file diff --git a/sdk/dist/api/template.d.ts b/sdk/dist/api/template.d.ts deleted file mode 100644 index 196004f..0000000 --- a/sdk/dist/api/template.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { wallet } from "@cityofzion/neon-core"; -export declare class TemplateAPI { - static templateMethod(node: string, networkMagic: number, contractHash: string, paramA: string, paramB: number, paramC: string, paramD: boolean, paramE: string[], signer?: wallet.Account): Promise; -} diff --git a/sdk/dist/api/template.js b/sdk/dist/api/template.js deleted file mode 100644 index 092f335..0000000 --- a/sdk/dist/api/template.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TemplateAPI = void 0; -const neon_js_1 = require("@cityofzion/neon-js"); -const helpers_1 = require("../helpers"); -class TemplateAPI { - static async templateMethod(node, networkMagic, contractHash, paramA, paramB, paramC, paramD, paramE, signer) { - const method = "{{YOUR_METHOD_NAME_HERE}}"; - const paramEFormatted = paramE.map((param) => { - return neon_js_1.sc.ContractParam.string(param); - }); - const param = [ - neon_js_1.sc.ContractParam.string(paramA), - neon_js_1.sc.ContractParam.integer(paramB), - neon_js_1.sc.ContractParam.byteArray(paramC), - neon_js_1.sc.ContractParam.boolean(paramD), - neon_js_1.sc.ContractParam.array(...paramEFormatted) - ]; - const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); - if (signer) { - return res; - } - return (0, helpers_1.formatter)(res[0]); - } -} -exports.TemplateAPI = TemplateAPI; -//# sourceMappingURL=template.js.map \ No newline at end of file diff --git a/sdk/dist/api/template.js.map b/sdk/dist/api/template.js.map deleted file mode 100644 index cf7f971..0000000 --- a/sdk/dist/api/template.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/api/template.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AAEvC,wCAAqD;AAErD,MAAa,WAAW;IAEtB,MAAM,CAAC,KAAK,CAAC,cAAc,CACzB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,MAAc,EACd,MAAc,EACd,MAAc,EACd,MAAe,EACf,MAAgB,EAChB,MAAuB;QAEvB,MAAM,MAAM,GAAG,2BAA2B,CAAC;QAE3C,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAE,CAAC,KAAK,EAAE,EAAE;YAC5C,OAAO,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACvC,CAAC,CAAC,CAAA;QAEF,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;YAC/B,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;YAChC,YAAE,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC;YAClC,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;YAChC,YAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,eAAe,CAAC;SAC3C,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;CAEF;AAlCD,kCAkCC"} \ No newline at end of file diff --git a/sdk/dist/helpers/helpers.d.ts b/sdk/dist/helpers/helpers.d.ts deleted file mode 100644 index b475c09..0000000 --- a/sdk/dist/helpers/helpers.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { wallet } from '@cityofzion/neon-core'; -export declare function formatter(field: any, num?: boolean): any; -export declare function sleep(ms: number): Promise; -export declare function variableInvoke(node: string, networkMagic: number, contractHash: string, method: string, param?: any[], signer?: wallet.Account): Promise; -export declare function deployContract(node: string, networkMagic: number, pathToNEF: string, signer: wallet.Account): Promise; -export declare function getEvents(node: string, txid: string): Promise; -export declare function txDidComplete(node: string, txid: string, showStats?: boolean): Promise; -export declare function chiSquared(samples: string[]): number; diff --git a/sdk/dist/helpers/helpers.js b/sdk/dist/helpers/helpers.js deleted file mode 100644 index 555f1cb..0000000 --- a/sdk/dist/helpers/helpers.js +++ /dev/null @@ -1,143 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.chiSquared = exports.txDidComplete = exports.getEvents = exports.deployContract = exports.variableInvoke = exports.sleep = exports.formatter = void 0; -const neon_core_1 = require("@cityofzion/neon-core"); -const api_1 = require("../api"); -const fs_1 = __importDefault(require("fs")); -const neon_js_1 = require("@cityofzion/neon-js"); -function formatter(field, num = false) { - switch (field.type) { - case "ByteString": - const rawValue = neon_core_1.u.base642hex(field.value); - if (num) { - return parseInt(neon_core_1.u.reverseHex(rawValue), 16); - } - return neon_core_1.u.hexstring2str(rawValue); - case "Integer": - return parseInt(field.value); - case "Array": - return field.value.map((f) => { - return formatter(f); - }); - case "Map": - const object = {}; - field.value.forEach((f) => { - let key = formatter(f.key); - object[key] = formatter(f.value); - }); - return object; - default: - return field.value; - } -} -exports.formatter = formatter; -function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); -} -exports.sleep = sleep; -async function variableInvoke(node, networkMagic, contractHash, method, param = [], signer) { - try { - let res; - if (signer) { - res = await api_1.NeoInterface.publishInvoke(node, networkMagic, contractHash, method, param, signer); - } - else { - res = await api_1.NeoInterface.testInvoke(node, networkMagic, contractHash, method, param); - } - if (res === undefined || res.length === 0) { - throw new Error("unrecognized response"); - } - return res; - } - catch (e) { - throw new Error("Something went wrong: " + e.message); - } -} -exports.variableInvoke = variableInvoke; -async function deployContract(node, networkMagic, pathToNEF, signer) { - const config = { - networkMagic, - rpcAddress: node, - account: signer - }; - const nef = neon_core_1.sc.NEF.fromBuffer(fs_1.default.readFileSync(pathToNEF)); - const rawManifest = fs_1.default.readFileSync(pathToNEF.replace('.nef', '.manifest.json')); - const manifest = neon_core_1.sc.ContractManifest.fromJson(JSON.parse(rawManifest.toString())); - const assembledScript = new neon_core_1.sc.ScriptBuilder() - .emit(neon_core_1.sc.OpCode.ABORT) - .emitPush(neon_core_1.u.HexString.fromHex(signer.scriptHash)) - .emitPush(nef.checksum) - .emitPush(manifest.name) - .build(); - const scriptHash = neon_core_1.u.reverseHex(neon_core_1.u.hash160(assembledScript)); - console.log(`deploying ${manifest.name} to 0x${scriptHash} ...`); - return neon_js_1.experimental.deployContract(nef, manifest, config); -} -exports.deployContract = deployContract; -async function getEvents(node, txid) { - const client = new neon_core_1.rpc.RPCClient(node); - const tx = await client.getApplicationLog(txid); - return parseNotifications(tx); -} -exports.getEvents = getEvents; -async function txDidComplete(node, txid, showStats = false) { - const client = new neon_core_1.rpc.RPCClient(node); - const tx = await client.getApplicationLog(txid); - if (showStats) { - console.log('gas consumed: ', parseInt(tx.executions[0].gasconsumed) / 10 ** 8); - parseNotifications(tx, true); - } - if (tx.executions[0].vmstate !== "HALT") { - throw new Error(tx.executions[0].exception); - } - if (tx.executions[0]) { - const result = tx.executions[0].stack.map((item) => { - return formatter(item); - }); - return result; - } - return true; -} -exports.txDidComplete = txDidComplete; -function parseNotifications(tx, verbose = false) { - return tx.executions[0].notifications.map((n) => { - const notification = formatter(n.state); - const res = { - 'eventName': n.eventname, - 'value': notification - }; - if (verbose) { - console.log(`event: ${n.eventname}`); - console.log(` payload: ${JSON.stringify(notification)}`); - } - return res; - }); -} -function chiSquared(samples) { - const bins = {}; - for (let sample of samples) { - // @ts-ignore - if (bins[sample]) { - // @ts-ignore - bins[sample] += 1; - } - else { - // @ts-ignore - bins[sample] = 1; - } - } - // chi-squared test for uniformity - let chiSquared = 0; - const expected = samples.length / Object.keys(bins).length; - const keys = Object.keys(bins); - for (let i = 0; i < keys.length; i++) { - // @ts-ignore - chiSquared += ((bins[keys[i]] - expected) ** 2) / expected; - } - return chiSquared; -} -exports.chiSquared = chiSquared; -//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/sdk/dist/helpers/helpers.js.map b/sdk/dist/helpers/helpers.js.map deleted file mode 100644 index 8da294f..0000000 --- a/sdk/dist/helpers/helpers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,qDAAwD;AACxD,gCAAoC;AACpC,4CAAoB;AACpB,iDAAiD;AAEjD,SAAgB,SAAS,CAAC,KAAU,EAAE,MAAe,KAAK;IACxD,QAAQ,KAAK,CAAC,IAAI,EAAE;QAClB,KAAK,YAAY;YACf,MAAM,QAAQ,GAAG,aAAC,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YAC1C,IAAI,GAAG,EAAE;gBACP,OAAO,QAAQ,CAAC,aAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAC,EAAE,CAAC,CAAA;aAC3C;YACD,OAAO,aAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;QAClC,KAAK,SAAS;YACZ,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAC9B,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAE,CAAC,CAAM,EAAE,EAAE;gBACjC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAA;YACrB,CAAC,CAAC,CAAA;QACJ,KAAK,KAAK;YACR,MAAM,MAAM,GAER,EAAE,CAAA;YACN,KAAK,CAAC,KAAK,CAAC,OAAO,CAAE,CAAC,CAAM,EAAE,EAAE;gBAC9B,IAAI,GAA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C,SAAS;YACxB,OAAO,EAAE,YAAY;SACtB,CAAA;QACD,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,SAAS,EAAE,CAAC,CAAA;YACpC,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;SAC1D;QACD,OAAO,GAAG,CAAA;IACZ,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,SAAgB,UAAU,CAAC,OAAiB;IAC1C,MAAM,IAAI,GAAG,EAAE,CAAA;IAEf,KAAK,IAAI,MAAM,IAAI,OAAO,EAAE;QAC1B,aAAa;QACb,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE;YAChB,aAAa;YACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;SAClB;aAAM;YACL,aAAa;YACb,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;SACjB;KACF;IAED,kCAAkC;IAClC,IAAI,UAAU,GAAG,CAAC,CAAA;IAClB,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,GAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAA;IACxD,MAAM,IAAI,GAAU,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAE,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,aAAa;QACb,UAAU,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAA;KAC3D;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AAvBD,gCAuBC"} \ No newline at end of file diff --git a/sdk/dist/helpers/index.d.ts b/sdk/dist/helpers/index.d.ts deleted file mode 100644 index 288e637..0000000 --- a/sdk/dist/helpers/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./helpers"; diff --git a/sdk/dist/helpers/index.js b/sdk/dist/helpers/index.js deleted file mode 100644 index 4b85eac..0000000 --- a/sdk/dist/helpers/index.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./helpers"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/sdk/dist/helpers/index.js.map b/sdk/dist/helpers/index.js.map deleted file mode 100644 index 2e7d522..0000000 --- a/sdk/dist/helpers/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAyB"} \ No newline at end of file diff --git a/sdk/dist/index.d.ts b/sdk/dist/index.d.ts deleted file mode 100644 index acedb9d..0000000 --- a/sdk/dist/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export * as api from "./api"; -export * as helpers from "./helpers"; -export * as types from "./interface"; -export * from "./Chest"; -export * from "./Collection"; -export * from "./Dice"; -export * from "./Puppet"; -export * from "./Generator"; -export * from "./Template"; diff --git a/sdk/dist/index.js b/sdk/dist/index.js deleted file mode 100644 index 0ef8bee..0000000 --- a/sdk/dist/index.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.types = exports.helpers = exports.api = void 0; -exports.api = __importStar(require("./api")); -exports.helpers = __importStar(require("./helpers")); -exports.types = __importStar(require("./interface")); -__exportStar(require("./Chest"), exports); -__exportStar(require("./Collection"), exports); -__exportStar(require("./Dice"), exports); -__exportStar(require("./Puppet"), exports); -__exportStar(require("./Generator"), exports); -__exportStar(require("./Template"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/sdk/dist/index.js.map b/sdk/dist/index.js.map deleted file mode 100644 index 239deb5..0000000 --- a/sdk/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA6B;AAC7B,qDAAoC;AACpC,qDAAoC;AACpC,0CAAuB;AACvB,+CAA4B;AAC5B,yCAAsB;AACtB,2CAAwB;AACxB,8CAA2B;AAC3B,6CAA0B"} \ No newline at end of file diff --git a/sdk/dist/interface/index.d.ts b/sdk/dist/interface/index.d.ts deleted file mode 100644 index 37d0601..0000000 --- a/sdk/dist/interface/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './interface'; diff --git a/sdk/dist/interface/index.js b/sdk/dist/interface/index.js deleted file mode 100644 index 5d37008..0000000 --- a/sdk/dist/interface/index.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./interface"), exports); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/sdk/dist/interface/index.js.map b/sdk/dist/interface/index.js.map deleted file mode 100644 index 1c8f831..0000000 --- a/sdk/dist/interface/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interface/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA2B"} \ No newline at end of file diff --git a/sdk/dist/interface/interface.d.ts b/sdk/dist/interface/interface.d.ts deleted file mode 100644 index bdf328e..0000000 --- a/sdk/dist/interface/interface.d.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { wallet } from "@cityofzion/neon-core"; -import { ContractParamLike } from "@cityofzion/neon-core/lib/sc"; -export declare enum EventTypeEnum { - CollectionPointer = 0, - InstanceCall = 1, - Value = 2, - CollectionSampleFrom = 3 -} -export declare enum InstanceAccessMode { - ContractWhitelist = 0, - ContractWhiteListRestricted = 1, - Global = 2 -} -export declare enum NetworkOption { - LocalNet = 0, - TestNet = 1, - MainNet = 2 -} -export interface BaseStats { - charisma: number; - constitution: number; - dexterity: number; - intelligence: number; - strength: number; - wisdom: number; -} -export interface PuppetType { - armorClass: number; - attributes: BaseStats; - description: string; - epoch: number; - hitDie: string; - image: string; - name: string; - owner: wallet.Account; - seed: string; - traits: {}; - tokenId: number; - tokenURI: string; -} -export interface CollectionType { - id: number; - author: wallet.Account; - description: string; - type: string; - values: string[] | number[]; - extra: any; - valuesRaw?: any[]; -} -export interface EpochType { - author: string; - label: string; - epochId: number; - generatorInstanceId: number; - initialRollCollectionId: number; - mintFee: number; - sysFee: number; - maxSupply: number; - totalSupply: number; -} -export interface GeneratorType { - id?: number; - author?: string; - label: string; - baseGeneratorFee: number; - traits: TraitType[] | string[]; -} -export interface InstanceAuthorizedContracts { - scriptHash: string; - code: number; -} -export interface TraitType { - label: string; - slots: number; - traitLevels: TraitLevel[]; -} -export interface TraitLevel { - dropScore: number; - mintMode: number; - traits: EventTypeWrapper[]; -} -export interface EventTypeWrapper { - type: EventTypeEnum; - maxMint: number; - args: EventCollectionPointer | EventInstanceCall | EventValue | EventCollectionSampleFrom; -} -export interface EventCollectionPointer { - collectionId: number; - index: number; -} -export interface EventCollectionSampleFrom { - collectionId: number; -} -export interface EventInstanceCall { - scriptHash: string; - method: string; - param: ContractParamLike[]; -} -export interface EventValue { - value: string; -} -export interface PropConstructorOptions { - network?: NetworkOption; - node?: string; - scriptHash?: string; -} diff --git a/sdk/dist/interface/interface.js b/sdk/dist/interface/interface.js deleted file mode 100644 index cbdb4b8..0000000 --- a/sdk/dist/interface/interface.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.NetworkOption = exports.InstanceAccessMode = exports.EventTypeEnum = void 0; -var EventTypeEnum; -(function (EventTypeEnum) { - EventTypeEnum[EventTypeEnum["CollectionPointer"] = 0] = "CollectionPointer"; - EventTypeEnum[EventTypeEnum["InstanceCall"] = 1] = "InstanceCall"; - EventTypeEnum[EventTypeEnum["Value"] = 2] = "Value"; - EventTypeEnum[EventTypeEnum["CollectionSampleFrom"] = 3] = "CollectionSampleFrom"; -})(EventTypeEnum = exports.EventTypeEnum || (exports.EventTypeEnum = {})); -var InstanceAccessMode; -(function (InstanceAccessMode) { - InstanceAccessMode[InstanceAccessMode["ContractWhitelist"] = 0] = "ContractWhitelist"; - InstanceAccessMode[InstanceAccessMode["ContractWhiteListRestricted"] = 1] = "ContractWhiteListRestricted"; - InstanceAccessMode[InstanceAccessMode["Global"] = 2] = "Global"; -})(InstanceAccessMode = exports.InstanceAccessMode || (exports.InstanceAccessMode = {})); -var NetworkOption; -(function (NetworkOption) { - NetworkOption[NetworkOption["LocalNet"] = 0] = "LocalNet"; - NetworkOption[NetworkOption["TestNet"] = 1] = "TestNet"; - NetworkOption[NetworkOption["MainNet"] = 2] = "MainNet"; -})(NetworkOption = exports.NetworkOption || (exports.NetworkOption = {})); -//# sourceMappingURL=interface.js.map \ No newline at end of file diff --git a/sdk/dist/interface/interface.js.map b/sdk/dist/interface/interface.js.map deleted file mode 100644 index 00631a3..0000000 --- a/sdk/dist/interface/interface.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/interface/interface.ts"],"names":[],"mappings":";;;AAGA,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,2EAAqB,CAAA;IACrB,iEAAgB,CAAA;IAChB,mDAAS,CAAA;IACT,iFAAwB,CAAA;AAC1B,CAAC,EALW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAKxB;AAED,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,qFAAqB,CAAA;IACrB,yGAA+B,CAAA;IAC/B,+DAAU,CAAA;AACZ,CAAC,EAJW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAI7B;AAED,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,yDAAY,CAAA;IACZ,uDAAW,CAAA;IACX,uDAAW,CAAA;AACb,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB"} \ No newline at end of file diff --git a/sdk/src/Gift.ts b/sdk/src/Gift.ts new file mode 100644 index 0000000..d6e00bb --- /dev/null +++ b/sdk/src/Gift.ts @@ -0,0 +1,163 @@ +import { merge } from 'lodash' +import {rpc, wallet} from '@cityofzion/neon-core' +import {PuppetAPI, NeoInterface} from './api' +import {sc} from "@cityofzion/neon-js"; +import {EpochType, NetworkOption, PropConstructorOptions, PuppetType} from "./interface"; + +const DEFAULT_OPTIONS: PropConstructorOptions = { + network: NetworkOption.LocalNet +} + +export class Puppet { + private options: PropConstructorOptions = DEFAULT_OPTIONS + private networkMagic: number = -1 + + constructor(options: PropConstructorOptions = {}) { + switch(options.network) { + case NetworkOption.TestNet: + this.options.node = 'https://testnet1.neo.coz.io:443' + this.options.scriptHash = '0x97857c01d64f846b5fe2eca2d09d2d73928b3f43' + break + case NetworkOption.MainNet: + this.options.node = 'https://mainnet1.neo.coz.io:443' + this.options.scriptHash = '0x76a8f8a7a901b29a33013b469949f4b08db15756' + break + default: + this.options.node = 'http://127.0.0.1:50012' + this.options.scriptHash = '0xfefe63f07478394fbe514fda386ad8c7e2a485a0' + break + } + this.options = merge({}, this.options, options) + } + + async init() { + const getVersionRes = await this.node.getVersion() + this.networkMagic = getVersionRes.protocol.network + } + + get node(): rpc.RPCClient { + if (this.options.node) { + return new rpc.RPCClient(this.options.node) + } + throw new Error('no node selected!') + } + + get scriptHash() : string { + if (this.options.scriptHash) { + return this.options.scriptHash + } + throw new Error('node scripthash defined') + } + + async balanceOf(address: string, signer?: wallet.Account): Promise { + return PuppetAPI.balanceOf(this.node.url, this.networkMagic, this.scriptHash, address, signer) + } + + async createEpoch(label: string, generatorInstanceId: number, initialRollCollectionId: number, mintFee: number, sysFee: number, maxSupply: number, signer: wallet.Account): Promise { + return PuppetAPI.createEpoch(this.node.url, this.networkMagic, this.scriptHash, label, generatorInstanceId, initialRollCollectionId, mintFee, sysFee, maxSupply, signer) + } + + async decimals(signer?: wallet.Account): Promise { + return PuppetAPI.decimals(this.node.url, this.networkMagic, this.scriptHash, signer) + } + + async deploy(signer: wallet.Account): Promise { + return PuppetAPI.deploy(this.node.url, this.networkMagic, this.scriptHash, signer) + } + + async getAttributeMod(attributeValue: number, signer?: wallet.Account): Promise { + return PuppetAPI.getAttributeMod(this.node.url, this.networkMagic, this.scriptHash, attributeValue, signer) + } + + async getEpochJSON(epochId: number, signer?: wallet.Account): Promise { + return PuppetAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId, signer) + } + + async getPuppetJSON(tokenId: string, signer?: wallet.Account): Promise { + return PuppetAPI.getPuppetJSON(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) + } + + async getPuppetRaw(tokenId: string, signer?: wallet.Account): Promise { + return PuppetAPI.getPuppetRaw(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) + } + + async ownerOf(tokenId: string, signer?: wallet.Account): Promise { + return PuppetAPI.ownerOf(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) + } + + async offlineMint(epochId: number, owner: string, signer: wallet.Account): Promise { + return PuppetAPI.offlineMint(this.node.url, this.networkMagic, this.scriptHash, epochId, owner, signer) + } + + async properties(tokenId: string, signer?: wallet.Account): Promise { + return PuppetAPI.properties(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) + } + + async purchase(epochId: number, signer: wallet.Account): Promise { + const method = "transfer"; + + const GASScriptHash = "0xd2a4cff31913016155e38e474a2c06d08be276cf" + const epoch = await PuppetAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId) + const EpochTyped = epoch as unknown as EpochType + if (EpochTyped.totalSupply === EpochTyped.maxSupply) { + throw new Error(`Epoch is out of Puppets: ${EpochTyped.totalSupply} / ${EpochTyped.maxSupply}`) + } + + const purchasePrice = EpochTyped.mintFee + const params = [ + sc.ContractParam.hash160(signer.address), + sc.ContractParam.hash160(this.scriptHash), + sc.ContractParam.integer(purchasePrice), + sc.ContractParam.integer(epochId) + ] + try { + return await NeoInterface.publishInvoke( + this.node.url, + this.networkMagic, + GASScriptHash, + method, + params, + signer + ); + } catch (e) { + throw new Error("Something went wrong: " + (e as Error).message) + } + } + + async setMintFee(epochId: number, fee: number, signer: wallet.Account): Promise { + return PuppetAPI.setMintFee(this.node.url, this.networkMagic, this.scriptHash, epochId, fee, signer) + } + + async symbol(signer?: wallet.Account): Promise { + return PuppetAPI.symbol(this.node.url, this.networkMagic, this.scriptHash, signer) + } + + async tokens(signer?: wallet.Account): Promise { + return PuppetAPI.tokens(this.node.url, this.networkMagic, this.scriptHash, signer) + } + + async tokensOf(address: string, signer?: wallet.Account): Promise { + return PuppetAPI.tokensOf(this.node.url, this.networkMagic, this.scriptHash, address, signer) + } + + async totalAccounts(signer?: wallet.Account): Promise { + return PuppetAPI.totalAccounts(this.node.url, this.networkMagic, this.scriptHash, signer) + } + + async totalEpochs(signer?: wallet.Account): Promise { + return PuppetAPI.totalEpochs(this.node.url, this.networkMagic, this.scriptHash, signer) + } + + async totalSupply(signer?: wallet.Account): Promise { + return PuppetAPI.totalSupply(this.node.url, this.networkMagic, this.scriptHash, signer) + } + + async transfer(to: string, tokenId: string, signer: wallet.Account, data: any): Promise { + return PuppetAPI.transfer(this.node.url, this.networkMagic, this.scriptHash,to, tokenId, signer, data) + } + + async update(script: string, manifest: string, signer: wallet.Account): Promise { + return PuppetAPI.update(this.node.url, this.networkMagic, this.scriptHash, script, manifest, '', signer) + } + +} diff --git a/sdk/src/api/gift.ts b/sdk/src/api/gift.ts new file mode 100644 index 0000000..76da3f8 --- /dev/null +++ b/sdk/src/api/gift.ts @@ -0,0 +1,478 @@ +import {InteropInterface} from "./interface"; +import Neon, { sc, u } from "@cityofzion/neon-js"; +import { wallet } from "@cityofzion/neon-core"; +import {StackItemJson, StackItemMapLike} from "@cityofzion/neon-core/lib/sc"; +import {EpochType, PuppetType} from "../interface"; +import {formatter, variableInvoke} from "../helpers"; + +export class PuppetAPI { + + /** + * Returns the balance of an account + * @param node + * @param networkMagic + * @param contractHash + * @param address + * @param signer + */ + static async balanceOf( + node: string, + networkMagic: number, + contractHash: string, + address: string, + signer?: wallet.Account + ): Promise { + const method = "balanceOf"; + + const params = [sc.ContractParam.hash160(address)]; + const res = await variableInvoke(node, networkMagic, contractHash, method, params, signer) + if (signer) { + return res + } + return parseInt(res[0].value as string); + } + + static async createEpoch( + node: string, + networkMagic: number, + contractHash: string, + label: string, + generatorInstanceId: number, + initialRollCollectionId: number, + mintFee: number, + sysFee: number, + maxSupply: number, + signer: wallet.Account, + ): Promise { + const method = "create_epoch"; + const params = [ + sc.ContractParam.string(label), + sc.ContractParam.integer(generatorInstanceId), + sc.ContractParam.integer(initialRollCollectionId), + sc.ContractParam.integer(mintFee), + sc.ContractParam.integer(sysFee), + sc.ContractParam.integer(maxSupply) + ]; + return await variableInvoke(node, networkMagic, contractHash, method, params, signer) + } + + /** + * Returns the decimals of the token + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async decimals( + node: string, + networkMagic: number, + contractHash: string, + signer?: wallet.Account + ): Promise { + const method = "decimals"; + + const res = await variableInvoke(node, networkMagic, contractHash, method, [], signer) + if (signer) { + return res + } + return parseInt(res[0].value as string); + } + + /** + * Initializes the smart contract on first deployment (REQUIRED) + * @param node + * @param networkMagic + * @param contractHash + * @param signer The signing account, which will become the first admin if upgrade == false + */ + static async deploy( + node: string, + networkMagic: number, + contractHash: string, + signer: wallet.Account + ): Promise { + const method = "deploy"; + + return await variableInvoke(node, networkMagic, contractHash, method, [], signer) + } + + static async getAttributeMod( + node: string, + networkMagic: number, + contractHash: string, + attributeValue: number, + signer?: wallet.Account + ): Promise { + const method = "roll_initial_stat"; + const params = [ + sc.ContractParam.integer(attributeValue) + ] + const res = await variableInvoke(node, networkMagic, contractHash, method, params, signer) + if (signer) { + return res + } + return parseInt(res[0].value as string); + } + + static async getPuppetJSON( + node: string, + networkMagic: number, + contractHash: string, + tokenId: string, + signer?: wallet.Account + ): Promise { + const method = "get_puppet_json"; + const param = [sc.ContractParam.string(tokenId)]; + + const res = await variableInvoke(node, networkMagic, contractHash, method, param, signer) + if (signer) { + return res + } + + return formatter(res[0]) as PuppetType + } + + static async getPuppetJSONFlat( + node: string, + networkMagic: number, + contractHash: string, + tokenId: string, + signer?: wallet.Account + ): Promise { + const method = "get_puppet_json_flat"; + const params = [sc.ContractParam.string(tokenId)]; + const res = await variableInvoke(node, networkMagic, contractHash, method, params, signer) + if (signer) { + return res + } + return formatter(res[0]) + } + + static async getPuppetRaw( + node: string, + networkMagic: number, + contractHash: string, + tokenId: string, + signer?: wallet.Account + ): Promise { + const method = "get_puppet_raw"; + + const params = [sc.ContractParam.string(tokenId)]; + const res = await variableInvoke(node, networkMagic, contractHash, method, params, signer) + if (signer) { + return res + } + return res[0].value; + } + + /** + * Gets the owner account of a tokenId + * @param node + * @param networkMagic + * @param contractHash + * @param tokenId The tokenId to return the owner of + * @param signer + */ + static async ownerOf( + node: string, + networkMagic: number, + contractHash: string, + tokenId: string, + signer?: wallet.Account + ): Promise { + const method = "ownerOf"; + + const params = [sc.ContractParam.string(tokenId)]; + const res = await variableInvoke(node, networkMagic, contractHash, method, params, signer) + if (signer) { + return res + } + const rawValue = u.base642hex(res[0].value as string) + return new wallet.Account(u.reverseHex(rawValue)) + } + + static async offlineMint( + node: string, + networkMagic: number, + contractHash: string, + epochId: number, + owner: string, + signer: wallet.Account + ): Promise { + + const method = "offline_mint"; + const params = [ + sc.ContractParam.integer(epochId), + sc.ContractParam.hash160(owner) + ] + return await variableInvoke(node, networkMagic, contractHash, method, params, signer) + } + + /** + * Gets the properties of a token + * @param node + * @param networkMagic + * @param contractHash + * @param tokenId The tokenId of the token being requested + * @param signer An optional signer. Populating this value will publish a transaction and return a txid + */ + static async properties( + node: string, + networkMagic: number, + contractHash: string, + tokenId: string, + signer?: wallet.Account + ): Promise { + const method = "properties"; + const params = [sc.ContractParam.string(tokenId)]; + const res = await variableInvoke(node, networkMagic, contractHash, method, params, signer) + if (signer) { + return res + } + return formatter(res[0]) + } + + static async setMintFee( + node: string, + networkMagic: number, + contractHash: string, + epochId: number, + fee: number, + signer: wallet.Account, + ): Promise { + const method = "set_mint_fee"; + const params = [ + sc.ContractParam.integer(epochId), + sc.ContractParam.integer(fee) + ]; + + return await variableInvoke(node, networkMagic, contractHash, method, params, signer) + } + + /** + * Returns the token symbol + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async symbol( + node: string, + networkMagic: number, + contractHash: string, + signer?: wallet.Account + ): Promise { + const method = "symbol"; + + const res = await variableInvoke(node, networkMagic, contractHash, method, [], signer) + if (signer) { + return res + } + return Neon.u.HexString.fromBase64(res[0].value as string).toAscii(); + } + + /** + * Gets and array of strings(tokenIds) representing all the tokens associated with the contract + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async tokens( + node: string, + networkMagic: number, + contractHash: string, + signer?: wallet.Account + ): Promise { + const method = "tokens"; + + const res = await variableInvoke(node, networkMagic, contractHash, method, [], signer) + if (signer) { + return res + } + + if (res === undefined || res.length === 0) { + throw new Error("unrecognized response"); + } + const iterator: InteropInterface = res[0] as InteropInterface + if (iterator.iterator && iterator.iterator.length > 0 && iterator.iterator[0].value) { + return iterator.iterator.map( (token: StackItemJson) => { + const attrs: StackItemJson[] = token.value as StackItemJson[] + return formatter(attrs[0]) + }) + } + if (iterator.iterator && iterator.iterator.length === 0) { + return [] + } + + throw new Error("unable to resolve respond format") + } + + /** + * Gets an array of strings(tokenId) owned by an address + * @param node + * @param networkMagic + * @param contractHash + * @param address The string formatted address of an account + * @param signer + */ + static async tokensOf( + node: string, + networkMagic: number, + contractHash: string, + address: string, + signer?: wallet.Account + ): Promise { + const method = "tokensOf"; + + const params = [sc.ContractParam.hash160(address)]; + const res = await variableInvoke(node, networkMagic, contractHash, method, params, signer) + if (signer) { + return res + } + + // @ts-ignore + const tokens: string[] = [] + res.forEach((token: any) => { + if (token.value.length === 2) { + tokens.push(formatter(token.value[1])) + } else { + tokens.push(formatter(token)) + } + }) + return tokens + } + + /** + * Gets the total number of accounts stored in the contract + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async totalAccounts( + node: string, + networkMagic: number, + contractHash: string, + signer?: wallet.Account + ): Promise { + const method = "total_accounts"; + + const res = await variableInvoke(node, networkMagic, contractHash, method, [], signer) + if (signer) { + return res + } + return parseInt(res[0].value as string); + } + + static async totalEpochs( + node: string, + networkMagic: number, + contractHash: string, + signer?: wallet.Account + ): Promise { + const method = "total_epochs"; + + const res = await variableInvoke(node, networkMagic, contractHash, method, [], signer) + if (signer) { + return res + } + return parseInt(res[0].value as string); + } + + /** + * Returns the total supply of the token + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async totalSupply( + node: string, + networkMagic: number, + contractHash: string, + signer?: wallet.Account + ): Promise { + const method = "totalSupply"; + + const res = await variableInvoke(node, networkMagic, contractHash, method, [], signer) + if (signer) { + return res + } + return parseInt(res[0].value as string); + } + + /** + * Transfers a token to another account + * @param node + * @param networkMagic + * @param contractHash + * @param toAddress + * @param tokenId + * @param signer + * @param data + */ + static async transfer( + node: string, + networkMagic: number, + contractHash: string, + toAddress: string, + tokenId: string, + signer: wallet.Account, + data?: any + ): Promise { + const method = "transfer"; + const params = [ + sc.ContractParam.hash160(toAddress), + sc.ContractParam.string(tokenId), + data, + ]; + + return await variableInvoke(node, networkMagic, contractHash, method, params, signer) + } + + static async update( + node: string, + networkMagic: number, + contractHash: string, + script: string, + manifest: string, + data: any, + signer: wallet.Account + ): Promise { + const method = "update"; + const params = [ + sc.ContractParam.byteArray(script), + sc.ContractParam.string(manifest), + sc.ContractParam.any(data) + ]; + + const res = await variableInvoke(node, networkMagic, contractHash, method, params, signer) + if (signer) { + return res + } + return formatter(res); + } + + + //setUserPermissions + + static async getEpochJSON( + node: string, + networkMagic: number, + contractHash: string, + epochId: number, + signer?: wallet.Account + ): Promise { + const method = "get_epoch_json"; + const param = [sc.ContractParam.integer(epochId)]; + + const res = await variableInvoke(node, networkMagic, contractHash, method, param, signer) + if (signer) { + return res + } + + return formatter(res) as EpochType + } + +} From a20733209fb8195844287a7a8bc2b9fc7fc84278 Mon Sep 17 00:00:00 2001 From: Tyler Adams Date: Mon, 19 Dec 2022 08:18:23 -0700 Subject: [PATCH 6/9] checkpoint --- contracts/chest/chest.manifest.json | 74 +- contracts/chest/chest.nef | Bin 4169 -> 4534 bytes contracts/chest/chest.py | 242 ++-- contracts/gift/gift.manifest.json | 408 ++++++ contracts/gift/gift.nef | Bin 0 -> 4164 bytes contracts/gift/gift.py | 2 - package-lock.json | 1542 ++++++++++++++++---- package.json | 4 +- scripts/deploy.js | 2 +- sdk/dist/Chest.d.ts | 43 + sdk/dist/Chest.js | 114 ++ sdk/dist/Chest.js.map | 1 + sdk/dist/Collection.d.ts | 167 +++ sdk/dist/Collection.js | 244 ++++ sdk/dist/Collection.js.map | 1 + sdk/dist/Dice.d.ts | 98 ++ sdk/dist/Dice.js | 145 ++ sdk/dist/Dice.js.map | 1 + sdk/dist/Generator.d.ts | 23 + sdk/dist/Generator.js | 113 ++ sdk/dist/Generator.js.map | 1 + sdk/dist/Gift.d.ts | 30 + sdk/dist/Gift.js | 129 ++ sdk/dist/Gift.js.map | 1 + sdk/dist/Puppet.d.ts | 31 + sdk/dist/Puppet.js | 132 ++ sdk/dist/Puppet.js.map | 1 + sdk/dist/Template.d.ts | 37 + sdk/dist/Template.js | 81 ++ sdk/dist/Template.js.map | 1 + sdk/dist/api/chest.d.ts | 10 + sdk/dist/api/chest.js | 90 ++ sdk/dist/api/chest.js.map | 1 + sdk/dist/api/collection.d.ts | 17 + sdk/dist/api/collection.js | 202 +++ sdk/dist/api/collection.js.map | 1 + sdk/dist/api/dice.d.ts | 7 + sdk/dist/api/dice.js | 58 + sdk/dist/api/dice.js.map | 1 + sdk/dist/api/generator.d.ts | 17 + sdk/dist/api/generator.js | 153 ++ sdk/dist/api/generator.js.map | 1 + sdk/dist/api/gift.d.ts | 108 ++ sdk/dist/api/gift.js | 316 +++++ sdk/dist/api/gift.js.map | 1 + sdk/dist/api/index.d.ts | 8 + sdk/dist/api/index.js | 25 + sdk/dist/api/index.js.map | 1 + sdk/dist/api/interface.d.ts | 29 + sdk/dist/api/interface.js | 99 ++ sdk/dist/api/interface.js.map | 1 + sdk/dist/api/puppet.d.ts | 109 ++ sdk/dist/api/puppet.js | 327 +++++ sdk/dist/api/puppet.js.map | 1 + sdk/dist/api/template.d.ts | 4 + sdk/dist/api/template.js | 27 + sdk/dist/api/template.js.map | 1 + sdk/dist/helpers/helpers.d.ts | 8 + sdk/dist/helpers/helpers.js | 143 ++ sdk/dist/helpers/helpers.js.map | 1 + sdk/dist/helpers/index.d.ts | 1 + sdk/dist/helpers/index.js | 18 + sdk/dist/helpers/index.js.map | 1 + sdk/dist/index.d.ts | 9 + sdk/dist/index.js | 39 + sdk/dist/index.js.map | 1 + sdk/dist/interface/index.d.ts | 1 + sdk/dist/interface/index.js | 18 + sdk/dist/interface/index.js.map | 1 + sdk/dist/interface/interface.d.ts | 126 ++ sdk/dist/interface/interface.js | 23 + sdk/dist/interface/interface.js.map | 1 + sdk/package-lock.json | 2017 ++++++++++++++++++++++++++- sdk/src/Chest.ts | 28 +- sdk/src/Collection.ts | 2 +- sdk/src/Dice.ts | 2 +- sdk/src/Generator.ts | 2 +- sdk/src/Gift.ts | 60 +- sdk/src/Puppet.ts | 2 +- sdk/src/Template.ts | 2 +- sdk/src/api/chest.ts | 90 +- sdk/src/api/gift.ts | 42 +- sdk/src/api/index.ts | 1 + sdk/src/interface/interface.ts | 23 + sdk/test/integration/chest.js | 101 +- 85 files changed, 7498 insertions(+), 548 deletions(-) create mode 100644 contracts/gift/gift.manifest.json create mode 100644 contracts/gift/gift.nef create mode 100644 sdk/dist/Chest.d.ts create mode 100644 sdk/dist/Chest.js create mode 100644 sdk/dist/Chest.js.map create mode 100644 sdk/dist/Collection.d.ts create mode 100644 sdk/dist/Collection.js create mode 100644 sdk/dist/Collection.js.map create mode 100644 sdk/dist/Dice.d.ts create mode 100644 sdk/dist/Dice.js create mode 100644 sdk/dist/Dice.js.map create mode 100644 sdk/dist/Generator.d.ts create mode 100644 sdk/dist/Generator.js create mode 100644 sdk/dist/Generator.js.map create mode 100644 sdk/dist/Gift.d.ts create mode 100644 sdk/dist/Gift.js create mode 100644 sdk/dist/Gift.js.map create mode 100644 sdk/dist/Puppet.d.ts create mode 100644 sdk/dist/Puppet.js create mode 100644 sdk/dist/Puppet.js.map create mode 100644 sdk/dist/Template.d.ts create mode 100644 sdk/dist/Template.js create mode 100644 sdk/dist/Template.js.map create mode 100644 sdk/dist/api/chest.d.ts create mode 100644 sdk/dist/api/chest.js create mode 100644 sdk/dist/api/chest.js.map create mode 100644 sdk/dist/api/collection.d.ts create mode 100644 sdk/dist/api/collection.js create mode 100644 sdk/dist/api/collection.js.map create mode 100644 sdk/dist/api/dice.d.ts create mode 100644 sdk/dist/api/dice.js create mode 100644 sdk/dist/api/dice.js.map create mode 100644 sdk/dist/api/generator.d.ts create mode 100644 sdk/dist/api/generator.js create mode 100644 sdk/dist/api/generator.js.map create mode 100644 sdk/dist/api/gift.d.ts create mode 100644 sdk/dist/api/gift.js create mode 100644 sdk/dist/api/gift.js.map create mode 100644 sdk/dist/api/index.d.ts create mode 100644 sdk/dist/api/index.js create mode 100644 sdk/dist/api/index.js.map create mode 100644 sdk/dist/api/interface.d.ts create mode 100644 sdk/dist/api/interface.js create mode 100644 sdk/dist/api/interface.js.map create mode 100644 sdk/dist/api/puppet.d.ts create mode 100644 sdk/dist/api/puppet.js create mode 100644 sdk/dist/api/puppet.js.map create mode 100644 sdk/dist/api/template.d.ts create mode 100644 sdk/dist/api/template.js create mode 100644 sdk/dist/api/template.js.map create mode 100644 sdk/dist/helpers/helpers.d.ts create mode 100644 sdk/dist/helpers/helpers.js create mode 100644 sdk/dist/helpers/helpers.js.map create mode 100644 sdk/dist/helpers/index.d.ts create mode 100644 sdk/dist/helpers/index.js create mode 100644 sdk/dist/helpers/index.js.map create mode 100644 sdk/dist/index.d.ts create mode 100644 sdk/dist/index.js create mode 100644 sdk/dist/index.js.map create mode 100644 sdk/dist/interface/index.d.ts create mode 100644 sdk/dist/interface/index.js create mode 100644 sdk/dist/interface/index.js.map create mode 100644 sdk/dist/interface/interface.d.ts create mode 100644 sdk/dist/interface/interface.js create mode 100644 sdk/dist/interface/interface.js.map diff --git a/contracts/chest/chest.manifest.json b/contracts/chest/chest.manifest.json index f43ab7c..ff5bbf9 100644 --- a/contracts/chest/chest.manifest.json +++ b/contracts/chest/chest.manifest.json @@ -16,39 +16,39 @@ "type": "Integer" }, { - "name": "eligible_epochs", - "type": "Array" - }, - { - "name": "puppet_traits", + "name": "eligibility_cases", "type": "Array" } ], - "returntype": "ByteArray", + "returntype": "Integer", "safe": false }, { - "name": "loot_chest_with_puppet", - "offset": 283, + "name": "loot_chest_as_owner", + "offset": 314, "parameters": [ { "name": "chest_id", - "type": "ByteArray" - }, - { - "name": "puppet_id", - "type": "ByteArray" + "type": "Integer" } ], "returntype": "Map", "safe": false }, { - "name": "loot_chest_as_owner", - "offset": 473, + "name": "loot_chest", + "offset": 427, "parameters": [ { "name": "chest_id", + "type": "Integer" + }, + { + "name": "nft_script_hash", + "type": "Hash160" + }, + { + "name": "token_id", "type": "ByteArray" } ], @@ -56,15 +56,19 @@ "safe": false }, { - "name": "is_puppet_eligible", - "offset": 584, + "name": "is_eligible", + "offset": 601, "parameters": [ { "name": "chest_id", - "type": "ByteArray" + "type": "Integer" }, { - "name": "puppet_id", + "name": "nft_script_hash", + "type": "Hash160" + }, + { + "name": "token_id", "type": "ByteArray" } ], @@ -73,11 +77,11 @@ }, { "name": "get_chest_json", - "offset": 803, + "offset": 789, "parameters": [ { "name": "chest_id", - "type": "ByteArray" + "type": "Integer" } ], "returntype": "Map", @@ -85,11 +89,11 @@ }, { "name": "get_chest", - "offset": 817, + "offset": 803, "parameters": [ { "name": "chest_id", - "type": "ByteArray" + "type": "Integer" } ], "returntype": "Array", @@ -97,11 +101,11 @@ }, { "name": "get_chest_raw", - "offset": 880, + "offset": 866, "parameters": [ { "name": "chest_id", - "type": "ByteArray" + "type": "Integer" } ], "returntype": "ByteArray", @@ -109,14 +113,14 @@ }, { "name": "total_chests", - "offset": 908, + "offset": 906, "parameters": [], "returntype": "Integer", "safe": false }, { "name": "onNEP11Payment", - "offset": 962, + "offset": 975, "parameters": [ { "name": "from_address", @@ -140,7 +144,7 @@ }, { "name": "onNEP17Payment", - "offset": 1061, + "offset": 1074, "parameters": [ { "name": "from_address", @@ -160,7 +164,7 @@ }, { "name": "update", - "offset": 1292, + "offset": 1305, "parameters": [ { "name": "script", @@ -180,7 +184,7 @@ }, { "name": "_deploy", - "offset": 1416, + "offset": 1429, "parameters": [ { "name": "data", @@ -196,7 +200,7 @@ }, { "name": "_initialize", - "offset": 1454, + "offset": 1467, "parameters": [], "returntype": "Void", "safe": false @@ -204,20 +208,20 @@ ], "events": [ { - "name": "NewChest", + "name": "ChestOpened", "parameters": [ { "name": "ChestId", - "type": "ByteArray" + "type": "Integer" } ] }, { - "name": "ChestOpened", + "name": "NewChest", "parameters": [ { "name": "ChestId", - "type": "ByteArray" + "type": "Integer" } ] } diff --git a/contracts/chest/chest.nef b/contracts/chest/chest.nef index d7983e036720a0e8aaf9215faeda742efe30ec54..032ca487ef22e9d87039d86b04df1bae4975d910 100644 GIT binary patch delta 1702 zcmZuxT}&fY6rP_>3*B3GS_DKBEfs6C8&-&1vt&)S4US}s?jM^pW@E4{19RJ>JT6nJ8=A;6ATUiY&V?3K)%&Sa>j-m1DIggdS=Q`Nqm`m&zbL> z``z!HbH5ATeeOmp+kK*Qx-Bx@$@T4w_!F$F>8mASd8ui35&y+el-fP%pDjnSM8Z2@ z3WkJfH>{?FIeRTgxZYkTCG4|Tg0D~C$Q0|?SjUCBPE~4*e|Yp5*S|7b$}VdKKJ;3D z|Gp=e)@6R*%FF)!{dg)f7I1h3fX6%}?*Fkf%uR*3)ex)QiU;0UnQvbZgp_FzJVH~{ zgh%oC7g60=aiUieb1i!8eOgH>o@j!j4g5PGR0;ovte2PzMMRObgs(PGlrH0K7ez%A zZq~rM4RTm#$pLGv;9qi7wMNKH?ldg^lQqpi_W?BVGruak0HG(poww-;o+g{%U5s^x)~ zqBP>TzVpjE0s!?;9jpab#~R~KIYw^GTa2|fxp7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4Wr99N(?p(*>{ux=cm5Ic+gn)9WeYfTlTdYMB>xDBEKvY^?15^t*8er-yTVpwRGlGMwBw+60h$y*AxNz-2p55+7b9Ni*!3QIHhLt6X|hYo921w z?jL_X_I}~ZSKsJfdS;IOZ2r#bAFmDA-K_}qNVy>D=mjXN3iM!{+U!|6rto=w!k#D_ zwjR;ZgH1~sIHDsO@;N)8qa|>2Gdh|BpC&O?SYEKgr7SuG#hS{3ibRQW+w7p-6#*E= zZ#~Ppl3$0PikIWJBFWka>-HyViwiVN`4#rzKq8Q6PXrTe8w~wh^~iGAX`bsL7s5YX z8{;_cBI}}| NeoMetadata: NewChest = CreateNewEvent( [ - ('ChestId', bytes), + ('ChestId', int), ], 'NewChest' ) ChestOpened = CreateNewEvent( [ - ('ChestId', bytes), + ('ChestId', int), ('Contents', [Dict[str, Any]]) ], 'ChestOpened' @@ -94,6 +94,7 @@ def format(self) -> Dict[str, Any]: 'quantity': self._quantity } + def create_reservoir_item(type: str, script_hash: UInt160, quantity: int, token_id: bytes ) -> bytes: """ creates a new chest @@ -125,66 +126,164 @@ def reservoir_write_pointer() -> int: @public -def create_chest(name: bytes, chest_type: int, eligible_epochs: [int], puppet_traits: [bytes]) -> bytes: +def create_chest(name: bytes, chest_type: int, eligibility_cases: List) -> int: """ Creates a new collection :param name: The name of the chest :param chest_type: The type of chest to create + :param eligibility_cases: The set of cases which will be evaluated to determine whether a token is eligible :return: The chest id """ tx = cast(Transaction, script_container) owner: UInt160 = tx.sender - traits: Dict[str, str] = {} - for raw_trait in puppet_traits: - raw_trait_str: [str] = cast(List[str], raw_trait) - traits[raw_trait_str[0]] = raw_trait_str[1] + eligibility_cases_typed: [EligibilityCase] = [] + for eligibility_case in eligibility_cases: + case_raw: List = cast(List, eligibility_case) + script_hash: UInt160 = cast(UInt160, case_raw[0]) + attributes: List[List] = cast(List[List], case_raw[1]) + eligibility_cases_typed.append(EligibilityCase(script_hash, attributes)) - chest_id: bytes = create_chest_internal(owner, name, chest_type, eligible_epochs, traits) + chest_id: int = create_chest_internal(owner, name, chest_type, eligibility_cases_typed) NewChest(chest_id) return chest_id - +#TODO Method: set_chest_eligibility - mutable chest eligibility +''' @public -def loot_chest_with_puppet(chest_id: bytes, puppet_id: bytes) -> Dict[str, Any]: +def set_chest_eligibility(chest_id: bytes, eligibility: Dict[str, Any]) -> bool: + TODO Nest attributes (like on puppets) + [{ + sriptHash: "", + properties: "", + }] + return False +''' + +@public +def loot_chest_as_owner(chest_id: int) -> Dict[str, Any]: chest: Chest = get_chest(chest_id) + owner: UInt160 = chest.get_author() tx = cast(Transaction, script_container) signer: UInt160 = tx.sender - puppet_json: Dict[str, Any] = ContractPuppet.get_puppet_json(puppet_id) - owner_uint: UInt160 = cast(UInt160, puppet_json['owner']) - assert owner_uint == signer, "You do not own this puppet" - - assert chest.is_puppet_eligible(puppet_json), "Ineligible Puppet" + assert signer == owner, "Signer is not the current owner of this chest" - proceeds: ReservoirItem = chest.loot(signer, cast(bytes, puppet_json['tokenId'])) + proceeds: ReservoirItem = chest.loot(signer, owner, b'') - # return the loot proceeds here return proceeds.format() @public -def loot_chest_as_owner(chest_id: bytes) -> Dict[str, Any]: +def loot_chest(chest_id: int, nft_script_hash: UInt160, token_id: bytes) -> Dict[str, Any]: chest: Chest = get_chest(chest_id) - owner: UInt160 = chest.get_author() tx = cast(Transaction, script_container) signer: UInt160 = tx.sender - assert signer == owner, "Signer is not the current owner of this chest" + nft_properties_json: Dict[str, Any] = call_contract(nft_script_hash, 'properties', [token_id]) + owner_uint: UInt160 = call_contract(nft_script_hash, 'ownerOf', [token_id]) - proceeds: ReservoirItem = chest.loot(signer, owner) + assert owner_uint == signer, "You do not own this token" + assert chest.is_eligible(nft_script_hash, nft_properties_json), "Ineligible token" - return proceeds.format() + proceeds: ReservoirItem = chest.loot(signer, nft_script_hash, cast(bytes, nft_properties_json['tokenId'])) + return proceeds.format() @public -def is_puppet_eligible(chest_id: bytes, puppet_id: bytes) -> bool: +def is_eligible(chest_id: int, nft_script_hash: UInt160, token_id: bytes) -> bool: chest: Chest = get_chest(chest_id) - puppet_json: Dict[str, Any] = ContractPuppet.get_puppet_json(puppet_id) - return chest.is_puppet_eligible(puppet_json) + nft_properties_json: Dict[str, Any] = call_contract(nft_script_hash, 'properties', [token_id]) + return chest.is_eligible(nft_script_hash, nft_properties_json) + +################################ +class Attribute: + + def __init__(self, logic: str, key: str, value: Any): + self._logic: str = logic + self._key: str = key + self._value: Any = value + + def evaluate(self, attr: Dict[str, Any]) -> bool: + + if attr["trait_type"] != self._key: + return False + value = attr["value"] + + if self._logic == 'e': + return cast(bytes, value) == cast(bytes, self._value) + if self._logic == 'gt': + return cast(int, value) > cast(int, self._value) + if self._logic == 'gte': + return cast(int, value) >= cast(int, self._value) + if self._logic == 'lt': + return cast(int, value) < cast(int, self._value) + if self._logic == 'lte': + return cast(int, value) <= cast(int, self._value) + if self._logic == 'ne': + return value != self._value + return False + + def export(self) -> Dict[str, Any]: + return { + 'logic': self._logic, + 'key': self._key, + 'value': self._value + } + + def get_key(self) -> str: + return self._key + + +class EligibilityCase: + + def __init__(self, script_hash: UInt160, attributes_raw: List[List]): + self._script_hash: UInt160 = script_hash + self._attributes: [Attribute] = [] + + for attr in attributes_raw: + logic: str = cast(str, attr[0]) + key: str = cast(str, attr[1]) + value: Any = attr[2] + + self._attributes.append(Attribute(logic, key, value)) + + + def evaluateCase(self, script_hash: UInt160, nft_props: Dict[str, Any]) -> bool: + if script_hash != self._script_hash: + return False + + nft_attrs: List[Dict[str, Dict]] = cast(List[Dict[str, Dict]], nft_props["attributes"]) + + eval_case_closed: bool = True + for attr_case in self._attributes: + attr_key: str = attr_case.get_key() + attr_case_closed: bool = False + for nft_attr in nft_attrs: + trait_type: str = cast(str, nft_attr["trait_type"]) + if attr_key == trait_type: + attr_case_closed = attr_case.evaluate(nft_attr) + break + + eval_case_closed = eval_case_closed and attr_case_closed + if eval_case_closed == False: + break + return eval_case_closed + + def export(self) -> Dict[str, Any]: + attributes: List[Dict] = [] + for attr in self._attributes: + attr_json: Dict[str, Any] = attr.export() + attributes.append(attr_json) + + return { + 'script_hash': self._script_hash, + 'attributes': attributes + } + ################################ @@ -219,8 +318,7 @@ def __init__(self): self._type: int = 0 # eligibility - self._eligible_epochs: [int] = [] - self._puppet_traits: Dict[str, str] = {} + self._eligibility_cases: List[EligibilityCase] = [] # looting self._loot_available: int = 0 @@ -289,12 +387,8 @@ def set_id(self, chest_id: bytes) -> bool: self._id = chest_id return True - def set_eligible_epochs(self, eligible_epochs: [int]) -> bool: - self._eligible_epochs = eligible_epochs - return True - - def set_puppet_traits(self, puppet_traits: Dict[str, str]) -> bool: - self._puppet_traits = puppet_traits + def set_eligibility(self, eligibility: List[EligibilityCase]) -> bool: + self._eligibility_cases = eligibility return True def set_name(self, name: bytes) -> bool: @@ -307,71 +401,63 @@ def set_type(self, chest_type: int) -> bool: def export(self) -> Dict[str, Any]: exported = { - 'id': self._id, + 'id': self._id.to_int(), 'author': self._author, 'name': self._name, 'type': self._type, - 'eligible_epochs': self._eligible_epochs, - 'puppet_traits': self._puppet_traits, + 'eligibility_cases': self._eligibility_cases, 'loot_available': self._loot_available } return exported - def loot(self, destination: UInt160, looter_id: bytes) -> ReservoirItem: + def loot(self, destination: UInt160, nft_script_hash: UInt160, token_id: bytes) -> ReservoirItem: assert self._loot_available > 0 loot_id: int = ContractDice.rand_between(0, self._loot_available - 1) loot_id_bytes: bytes = loot_id.to_bytes() chest_loot: ReservoirItem = self.get_reservoir_value_from_loot_id(loot_id_bytes) - ChestOpened(self._id) + ChestOpened(self._id.to_int()) # replace the sampled loot_id pointer with the last loot_id pointer to defrag the storage last_reservoir_id: bytes = self.get_reservoir_id_from_loot_id((self._loot_available - 1).to_bytes()) - self.set_loot_id(loot_id.to_bytes(), last_reservoir_id) + loot_id_bytes: bytes = loot_id.to_bytes() + self.set_loot_id(loot_id_bytes, last_reservoir_id) # decrement loot available write pointer self.set_loot_available(self._loot_available - 1) # update looter yield + looter_id: bytes = mk_looter_id(nft_script_hash, token_id) yield_amount: int = self.get_looter_yield(looter_id) self.set_looter_yield(looter_id, yield_amount + 1) x: bool = chest_loot.transfer(destination) return chest_loot - def is_puppet_eligible(self, puppet: Dict[str, Any]) -> bool: - - epoch: int = cast(int, puppet['epochId']) - - # verify the puppet epoch is eligible - if epoch not in self._eligible_epochs: - return False - - traits: Dict[str, Any] = cast(Dict[str, Any], puppet['traits']) - - # check all the trait requirements for the chest - # this currently only supports a byte match for the entire trait field - for challenge_key in self._puppet_traits.keys(): - if self._puppet_traits[challenge_key] != traits[challenge_key]: - return False + def is_eligible(self, nft_script_hash: UInt160, nft_properties: Dict[str, Any]) -> bool: - # type 0 only allows a single loot per puppet if self._type == 0: - looter_id: bytes = cast(bytes, puppet['tokenId']) + looter_id: bytes = mk_looter_id(nft_script_hash, cast(bytes, nft_properties["tokenId"])) looter_yield: int = self.get_looter_yield(looter_id) if looter_yield != 0: return False - return True + for case in self._eligibility_cases: + case_result: bool = case.evaluateCase(nft_script_hash, nft_properties) + if case_result: + return True + return False + def fill_chest(self, reservoir_id: bytes) -> bool: loot_available: int = self._loot_available self.set_loot_available(loot_available + 1) - self.set_loot_id(loot_available.to_bytes(), reservoir_id) + loot_available_bytes: bytes = loot_available.to_bytes() + self.set_loot_id(loot_available_bytes, reservoir_id) return True -def create_chest_internal(author: UInt160, name: bytes, chest_type: int, eligible_epochs: [int], puppet_traits: Dict[str, str]) -> bytes: +def create_chest_internal(author: UInt160, name: bytes, chest_type: int, eligibility_cases: [EligibilityCase]) -> int: """ creates a new chest :param author: The author of the chest @@ -385,17 +471,16 @@ def create_chest_internal(author: UInt160, name: bytes, chest_type: int, eligibl chest.set_author(author) chest.set_name(name) chest.set_type(chest_type) - chest.set_eligible_epochs(eligible_epochs) - chest.set_puppet_traits(puppet_traits) + chest.set_eligibility(eligibility_cases) key: bytes = mk_chest_key(chest_id) put(key, serialize(chest)) put(TOTAL_CHESTS, chest_id) - return chest_id + return chest_id.to_int() @public -def get_chest_json(chest_id: bytes) -> Dict[str, Any]: +def get_chest_json(chest_id: int) -> Dict[str, Any]: """ Gets a JSON formatted collection :param chest_id: The chest_id being requested @@ -406,7 +491,7 @@ def get_chest_json(chest_id: bytes) -> Dict[str, Any]: @public -def get_chest(chest_id: bytes) -> Chest: +def get_chest(chest_id: int) -> Chest: """ Gets a Collection instance :param chest_id: The chest_id being requested @@ -419,13 +504,13 @@ def get_chest(chest_id: bytes) -> Chest: @public -def get_chest_raw(chest_id: bytes) -> bytes: +def get_chest_raw(chest_id: int) -> bytes: """ Gets the raw bytes of a collection :param chest_id: The chest_id being requested :return: The serialized Collection class instance """ - key: bytes = mk_chest_key(chest_id) + key: bytes = mk_chest_key(chest_id.to_bytes()) return get(key) @@ -445,6 +530,11 @@ def mk_chest_key(chest_id: bytes) -> bytes: return CHEST_KEY + chest_id +def mk_looter_id(nft_script_hash: UInt160, token_id: bytes) -> bytes: + return nft_script_hash + b'_' + token_id + + + def mk_reservoir_key(reservoir_id: bytes) -> bytes: return RESERVOIR_KEY + reservoir_id @@ -471,7 +561,7 @@ def onNEP11Payment(from_address: UInt160, amount: int, token_id: bytes, data: An ] ''' - data_payload: [bytes] = cast(List[bytes], data) + data_payload: List[int] = cast(List[int], data) chest: Chest = get_chest(data_payload[0]) author: UInt160 = chest.get_author() @@ -488,7 +578,7 @@ def onNEP17Payment(from_address: UInt160, amount: int, data: Any): """ :param from_address: the address of the one who is trying to send cryptocurrency to this smart contract :type from_address: UInt160 - :param amount: the amount of cryptocurrency that is being sent to the this smart contract + :param amount: the amount of cryptocurrency that is being sent to this smart contract :type amount: int :param data: any pertinent data that might validate the transaction :type data: Any @@ -500,12 +590,12 @@ def onNEP17Payment(from_address: UInt160, amount: int, data: Any): amount_per_reservoir_item ] """ - data_payload: [bytes] = cast(List[bytes], data) + data_payload: List[int] = cast(List[int], data) chest: Chest = get_chest(data_payload[0]) author: UInt160 = chest.get_author() assert from_address == author, "You don't have the right." - amount_per_reservoir_item: int = cast(int, data_payload[1]) + amount_per_reservoir_item: int = data_payload[1] assert amount >= amount_per_reservoir_item, "transfer amount is less than the amount_per_reservoir_item" @@ -547,17 +637,9 @@ def _deploy(data: Any, update: bool): put(OWNER_KEY, signer) -@contract('0x4380f2c1de98bb267d3ea821897ec571a04fe3e0') +@contract('0x16d6a0be0506b26e0826dd352724cda0defa7131') class ContractDice: @staticmethod def rand_between(start: int, end: int) -> int: - pass - - -@contract('0x76a8f8a7a901b29a33013b469949f4b08db15756') -class ContractPuppet: - - @staticmethod - def get_puppet_json(token_id: bytes) -> Dict[str, Any]: - pass + pass \ No newline at end of file diff --git a/contracts/gift/gift.manifest.json b/contracts/gift/gift.manifest.json new file mode 100644 index 0000000..4f006c7 --- /dev/null +++ b/contracts/gift/gift.manifest.json @@ -0,0 +1,408 @@ +{ + "name": "gift", + "groups": [], + "abi": { + "methods": [ + { + "name": "symbol", + "offset": 0, + "parameters": [], + "returntype": "String", + "safe": true + }, + { + "name": "decimals", + "offset": 2, + "parameters": [], + "returntype": "Integer", + "safe": true + }, + { + "name": "totalSupply", + "offset": 4, + "parameters": [], + "returntype": "Integer", + "safe": true + }, + { + "name": "balanceOf", + "offset": 40, + "parameters": [ + { + "name": "owner", + "type": "Hash160" + } + ], + "returntype": "Integer", + "safe": true + }, + { + "name": "tokensOf", + "offset": 98, + "parameters": [ + { + "name": "owner", + "type": "Hash160" + } + ], + "returntype": "InteropInterface", + "safe": true + }, + { + "name": "transfer", + "offset": 156, + "parameters": [ + { + "name": "to", + "type": "Hash160" + }, + { + "name": "token_id", + "type": "ByteArray" + }, + { + "name": "data", + "type": "Any" + } + ], + "returntype": "Boolean", + "safe": false + }, + { + "name": "ownerOf", + "offset": 420, + "parameters": [ + { + "name": "token_id", + "type": "ByteArray" + } + ], + "returntype": "Hash160", + "safe": true + }, + { + "name": "tokens", + "offset": 439, + "parameters": [], + "returntype": "InteropInterface", + "safe": true + }, + { + "name": "properties", + "offset": 460, + "parameters": [ + { + "name": "tokenId", + "type": "ByteArray" + } + ], + "returntype": "Map", + "safe": true + }, + { + "name": "_deploy", + "offset": 1938, + "parameters": [ + { + "name": "data", + "type": "Any" + }, + { + "name": "update", + "type": "Boolean" + } + ], + "returntype": "Void", + "safe": false + }, + { + "name": "onNEP11Payment", + "offset": 508, + "parameters": [ + { + "name": "from_address", + "type": "Hash160" + }, + { + "name": "amount", + "type": "Integer" + }, + { + "name": "token_id", + "type": "ByteArray" + }, + { + "name": "data", + "type": "Any" + } + ], + "returntype": "Void", + "safe": false + }, + { + "name": "onNEP17Payment", + "offset": 513, + "parameters": [ + { + "name": "from_address", + "type": "Hash160" + }, + { + "name": "amount", + "type": "Integer" + }, + { + "name": "data", + "type": "Any" + } + ], + "returntype": "Void", + "safe": false + }, + { + "name": "total_accounts", + "offset": 518, + "parameters": [], + "returntype": "Integer", + "safe": false + }, + { + "name": "offline_mint", + "offset": 554, + "parameters": [ + { + "name": "epoch_id", + "type": "ByteArray" + }, + { + "name": "account", + "type": "Hash160" + } + ], + "returntype": "ByteArray", + "safe": false + }, + { + "name": "update", + "offset": 628, + "parameters": [ + { + "name": "script", + "type": "ByteArray" + }, + { + "name": "manifest", + "type": "ByteArray" + }, + { + "name": "data", + "type": "Any" + } + ], + "returntype": "Void", + "safe": false + }, + { + "name": "set_mint_fee", + "offset": 739, + "parameters": [ + { + "name": "epoch_id", + "type": "ByteArray" + }, + { + "name": "amount", + "type": "Integer" + } + ], + "returntype": "Boolean", + "safe": false + }, + { + "name": "get_user_json", + "offset": 1085, + "parameters": [ + { + "name": "address", + "type": "Hash160" + } + ], + "returntype": "Map", + "safe": false + }, + { + "name": "get_user", + "offset": 1099, + "parameters": [ + { + "name": "address", + "type": "Hash160" + } + ], + "returntype": "Array", + "safe": false + }, + { + "name": "set_user_permissions", + "offset": 1320, + "parameters": [ + { + "name": "user", + "type": "Hash160" + }, + { + "name": "permissions", + "type": "Map" + } + ], + "returntype": "Boolean", + "safe": false + }, + { + "name": "create_epoch", + "offset": 1413, + "parameters": [ + { + "name": "label", + "type": "ByteArray" + }, + { + "name": "generator_instance_id", + "type": "ByteArray" + }, + { + "name": "initial_roll_collection_id", + "type": "ByteArray" + }, + { + "name": "mint_fee", + "type": "Integer" + }, + { + "name": "sys_fee", + "type": "Integer" + }, + { + "name": "max_supply", + "type": "Integer" + } + ], + "returntype": "Integer", + "safe": false + }, + { + "name": "get_epoch_json", + "offset": 1535, + "parameters": [ + { + "name": "epoch_id", + "type": "ByteArray" + } + ], + "returntype": "Map", + "safe": false + }, + { + "name": "get_epoch", + "offset": 1549, + "parameters": [ + { + "name": "epoch_id", + "type": "ByteArray" + } + ], + "returntype": "Array", + "safe": false + }, + { + "name": "total_epochs", + "offset": 1632, + "parameters": [], + "returntype": "Integer", + "safe": false + }, + { + "name": "get_token", + "offset": 1749, + "parameters": [ + { + "name": "token_id", + "type": "ByteArray" + } + ], + "returntype": "Array", + "safe": false + }, + { + "name": "get_token_json", + "offset": 1803, + "parameters": [ + { + "name": "token_id", + "type": "ByteArray" + } + ], + "returntype": "Map", + "safe": false + }, + { + "name": "get_token_json_flat", + "offset": 1817, + "parameters": [ + { + "name": "token_id", + "type": "ByteArray" + } + ], + "returntype": "Map", + "safe": false + }, + { + "name": "_initialize", + "offset": 2123, + "parameters": [], + "returntype": "Void", + "safe": false + } + ], + "events": [ + { + "name": "Transfer", + "parameters": [ + { + "name": "from_addr", + "type": "Any" + }, + { + "name": "to_addr", + "type": "Any" + }, + { + "name": "amount", + "type": "Integer" + }, + { + "name": "token_id", + "type": "ByteArray" + } + ] + } + ] + }, + "permissions": [ + { + "contract": "*", + "methods": "*" + } + ], + "trusts": [], + "features": {}, + "supportedstandards": [ + "NEP-11" + ], + "extra": { + "Author": "COZ, Inc.", + "Description": "An NFT for giving thanks", + "Email": "contact@coz.io" + } +} \ No newline at end of file diff --git a/contracts/gift/gift.nef b/contracts/gift/gift.nef new file mode 100644 index 0000000000000000000000000000000000000000..8bb1edab8ac9ba2c4e87bb934e0b7705441b5266 GIT bin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gAlDDS?b7 LrR4p$zs39qfqLrh literal 0 HcmV?d00001 diff --git a/contracts/gift/gift.py b/contracts/gift/gift.py index 1e3bcd6..bebb351 100644 --- a/contracts/gift/gift.py +++ b/contracts/gift/gift.py @@ -770,7 +770,6 @@ def generate(self, owner: UInt160, token_id: bytes, epoch_id: bytes) -> bool: return True - def get_owner(self) -> UInt160: """ Getter for the puppet owner @@ -778,7 +777,6 @@ def get_owner(self) -> UInt160: """ return UInt160(self._owner) - def get_state(self) -> Dict[str, Any]: """ Gets the state of the puppet. This differs from an export in that it includes all secondary features like diff --git a/package-lock.json b/package-lock.json index 8ce2cf7..093308d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,992 @@ { "name": "props", - "version": "1.0.0", - "lockfileVersion": 1, + "version": "1.4.1", + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "props", + "version": "1.4.1", + "license": "ISC", + "dependencies": { + "@cityofzion/neon-core": "^5.0.0-next.16", + "@cityofzion/neon-js": "^5.0.0-next.16", + "aws-sdk": "^2.1066.0", + "chart.js": "^3.7.0", + "lodash": "^4.17.21", + "node-pre-gyp": "^0.17.0" + } + }, + "node_modules/@cityofzion/neon-api": { + "version": "5.0.0-next.16", + "resolved": "https://registry.npmjs.org/@cityofzion/neon-api/-/neon-api-5.0.0-next.16.tgz", + "integrity": "sha512-wn7skR+gPvMGUS2GTP9xAW6TP0kwigtLC9+tV7xbl2idaRk3SVGzpI6TrPzCAtZ+mTCqznUjzT/R2jQTSxsCPg==", + "dependencies": { + "isomorphic-ws": "4.0.1", + "ws": "7.4.4" + }, + "peerDependencies": { + "@cityofzion/neon-core": "~5.0.0-next.7" + } + }, + "node_modules/@cityofzion/neon-core": { + "version": "5.0.0-next.16", + "resolved": "https://registry.npmjs.org/@cityofzion/neon-core/-/neon-core-5.0.0-next.16.tgz", + "integrity": "sha512-C9YoomPA5JuOh2HpYY99OYicJBRg+LncPbtTQ4WZ8ujQ4w9DA8DIdLJ0cfWCWFPvGxAt3dW2sxYMzWn+5oNWxg==", + "dependencies": { + "abort-controller": "3.0.0", + "bignumber.js": "7.2.1", + "bn.js": "5.2.0", + "bs58": "4.0.1", + "buffer": "6.0.3", + "cross-fetch": "^3.1.4", + "crypto-js": "4.1.1", + "elliptic": "6.5.4", + "loglevel": "1.7.1", + "loglevel-plugin-prefix": "0.8.4", + "scrypt-js": "3.0.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@cityofzion/neon-js": { + "version": "5.0.0-next.16", + "resolved": "https://registry.npmjs.org/@cityofzion/neon-js/-/neon-js-5.0.0-next.16.tgz", + "integrity": "sha512-mN/0OHzsCPFJqN1WC/cjHBEoSEvURWRkiQdCQBLAbD71Mo12SXEWOd10858c9MQbfTPovT/pSy+eZdGSCANZwg==", + "dependencies": { + "@cityofzion/neon-api": "^5.0.0-next.16", + "@cityofzion/neon-core": "^5.0.0-next.16" + } + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" + }, + "node_modules/are-we-there-yet": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz", + "integrity": "sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==", + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "node_modules/aws-sdk": { + "version": "2.1066.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1066.0.tgz", + "integrity": "sha512-9BZPdJgIvau8Jf2l3PxInNqQd733uKLqGGDywMV71duxNTLgdBZe2zvCkbgl22+ldC8R2LVMdS64DzchfQIxHg==", + "dependencies": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.16.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "uuid": "3.3.2", + "xml2js": "0.4.19" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/aws-sdk/node_modules/buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "dependencies": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, + "node_modules/aws-sdk/node_modules/ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bignumber.js": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-7.2.1.tgz", + "integrity": "sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ==", + "engines": { + "node": "*" + } + }, + "node_modules/bn.js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", + "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/chart.js": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.7.0.tgz", + "integrity": "sha512-31gVuqqKp3lDIFmzpKIrBeum4OpZsQjSIAqlOpgjosHDJZlULtvwLEZKtEhIAZc7JMPaHlYMys40Qy9Mf+1AAg==" + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" + }, + "node_modules/code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==" + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, + "node_modules/cross-fetch": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.4.tgz", + "integrity": "sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ==", + "dependencies": { + "node-fetch": "2.6.1" + } + }, + "node_modules/crypto-js": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", + "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" + }, + "node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==" + }, + "node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/fs-minipass": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", + "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", + "dependencies": { + "minipass": "^2.6.0" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg==", + "dependencies": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==" + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/ignore-walk": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.4.tgz", + "integrity": "sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ==", + "dependencies": { + "minimatch": "^3.0.4" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + }, + "node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "node_modules/isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "peerDependencies": { + "ws": "*" + } + }, + "node_modules/jmespath": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz", + "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/loglevel": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.7.1.tgz", + "integrity": "sha512-Hesni4s5UkWkwCGJMQGAh71PaLUmKFM60dHvq0zi/vDhhrzuk+4GgNbTXJ12YYQJn6ZKBDNIjYcuQGKudvqrIw==", + "engines": { + "node": ">= 0.6.0" + }, + "funding": { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/loglevel" + } + }, + "node_modules/loglevel-plugin-prefix": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/loglevel-plugin-prefix/-/loglevel-plugin-prefix-0.8.4.tgz", + "integrity": "sha512-WpG9CcFAOjz/FtNht+QJeGpvVl/cdR6P0z6OcXSkr8wFJOsV2GRj2j10JLfjuA4aYkcKCNIEqRGCyTife9R8/g==" + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "dependencies": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "node_modules/minizlib": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", + "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", + "dependencies": { + "minipass": "^2.9.0" + } + }, + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/needle": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/needle/-/needle-2.9.1.tgz", + "integrity": "sha512-6R9fqJ5Zcmf+uYaFgdIHmLwNldn5HbK8L5ybn7Uz+ylX/rnOsSp1AHcvQSrCaFN+qNM1wpymHqD7mVasEOlHGQ==", + "dependencies": { + "debug": "^3.2.6", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + }, + "bin": { + "needle": "bin/needle" + }, + "engines": { + "node": ">= 4.4.x" + } + }, + "node_modules/needle/node_modules/sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, + "node_modules/node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/node-pre-gyp": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.17.0.tgz", + "integrity": "sha512-abzZt1hmOjkZez29ppg+5gGqdPLUuJeAEwVPtHYEJgx0qzttCbcKFpxrCQn2HYbwCv2c+7JwH4BgEzFkUGpn4A==", + "deprecated": "Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future", + "dependencies": { + "detect-libc": "^1.0.3", + "mkdirp": "^0.5.5", + "needle": "^2.5.2", + "nopt": "^4.0.3", + "npm-packlist": "^1.4.8", + "npmlog": "^4.1.2", + "rc": "^1.2.8", + "rimraf": "^2.7.1", + "semver": "^5.7.1", + "tar": "^4.4.13" + }, + "bin": { + "node-pre-gyp": "bin/node-pre-gyp" + } + }, + "node_modules/nopt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "dependencies": { + "abbrev": "1", + "osenv": "^0.1.4" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, + "node_modules/npm-bundled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.2.tgz", + "integrity": "sha512-x5DHup0SuyQcmL3s7Rx/YQ8sbw/Hzg0rj48eN0dV7hf5cmQq5PXIeioroH3raV1QC1yh3uTYuMThvEQF3iKgGQ==", + "dependencies": { + "npm-normalize-package-bin": "^1.0.1" + } + }, + "node_modules/npm-normalize-package-bin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", + "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==" + }, + "node_modules/npm-packlist": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.8.tgz", + "integrity": "sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A==", + "dependencies": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1", + "npm-normalize-package-bin": "^1.0.1" + } + }, + "node_modules/npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dependencies": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "node_modules/number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dependencies": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "node_modules/punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=" + }, + "node_modules/querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", + "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/sax": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", + "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" + }, + "node_modules/scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" + }, + "node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tar": { + "version": "4.4.19", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.19.tgz", + "integrity": "sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA==", + "dependencies": { + "chownr": "^1.1.4", + "fs-minipass": "^1.2.7", + "minipass": "^2.9.0", + "minizlib": "^1.3.3", + "mkdirp": "^0.5.5", + "safe-buffer": "^5.2.1", + "yallist": "^3.1.1" + }, + "engines": { + "node": ">=4.5" + } + }, + "node_modules/url": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", + "integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=", + "dependencies": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "bin": { + "uuid": "bin/uuid" + } + }, + "node_modules/wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/ws": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz", + "integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "node_modules/xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + } + }, "dependencies": { "@cityofzion/neon-api": { "version": "5.0.0-next.16", @@ -40,32 +1024,6 @@ "@cityofzion/neon-core": "^5.0.0-next.16" } }, - "@mapbox/node-pre-gyp": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.8.tgz", - "integrity": "sha512-CMGKi28CF+qlbXh26hDe6NxCd7amqeAzEqnS6IHeO6LoaKyM/n+Xw3HT1COdq8cuioOdlKdqn/hCmqPUOMOywg==", - "requires": { - "detect-libc": "^1.0.3", - "https-proxy-agent": "^5.0.0", - "make-dir": "^3.1.0", - "node-fetch": "^2.6.5", - "nopt": "^5.0.0", - "npmlog": "^5.0.1", - "rimraf": "^3.0.2", - "semver": "^7.3.5", - "tar": "^6.1.11" - }, - "dependencies": { - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "requires": { - "whatwg-url": "^5.0.0" - } - } - } - }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -79,31 +1037,23 @@ "event-target-shim": "^5.0.0" } }, - "agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "requires": { - "debug": "4" - } - }, "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==" }, "aproba": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", - "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" }, "are-we-there-yet": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", - "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz", + "integrity": "sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==", "requires": { "delegates": "^1.0.0", - "readable-stream": "^3.6.0" + "readable-stream": "^2.0.6" } }, "aws-sdk": { @@ -198,40 +1148,35 @@ "ieee754": "^1.2.1" } }, - "canvas": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/canvas/-/canvas-2.9.0.tgz", - "integrity": "sha512-0l93g7uxp7rMyr7H+XRQ28A3ud0dKIUTIEkUe1Dxh4rjUYN7B93+SjC3r1PDKA18xcQN87OFGgUnyw7LSgNLSQ==", - "requires": { - "@mapbox/node-pre-gyp": "^1.0.0", - "nan": "^2.15.0", - "simple-get": "^3.0.3" - } - }, "chart.js": { "version": "3.7.0", "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.7.0.tgz", "integrity": "sha512-31gVuqqKp3lDIFmzpKIrBeum4OpZsQjSIAqlOpgjosHDJZlULtvwLEZKtEhIAZc7JMPaHlYMys40Qy9Mf+1AAg==" }, "chownr": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", - "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==" + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" }, - "color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==" + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==" }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, "console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==" + }, + "core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, "cross-fetch": { "version": "3.1.4", @@ -247,30 +1192,27 @@ "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" }, "debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "requires": { - "ms": "2.1.2" + "ms": "^2.1.1" } }, - "decompress-response": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", - "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", - "requires": { - "mimic-response": "^2.0.0" - } + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" }, "delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" + "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==" }, "detect-libc": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", - "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==" }, "elliptic": { "version": "6.5.4", @@ -293,11 +1235,6 @@ } } }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" - }, "event-target-shim": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", @@ -309,43 +1246,42 @@ "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=" }, "fs-minipass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", + "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", "requires": { - "minipass": "^3.0.0" + "minipass": "^2.6.0" } }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "gauge": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", - "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg==", "requires": { - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.2", + "aproba": "^1.0.3", "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.1", - "object-assign": "^4.1.1", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", "signal-exit": "^3.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.2" + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" } }, "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } @@ -353,7 +1289,7 @@ "has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==" }, "hash.js": { "version": "1.1.7", @@ -374,13 +1310,12 @@ "minimalistic-crypto-utils": "^1.0.1" } }, - "https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "requires": { - "agent-base": "6", - "debug": "4" + "safer-buffer": ">= 2.1.2 < 3" } }, "ieee754": { @@ -388,10 +1323,18 @@ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" }, + "ignore-walk": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.4.tgz", + "integrity": "sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ==", + "requires": { + "minimatch": "^3.0.4" + } + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "requires": { "once": "^1.3.0", "wrappy": "1" @@ -402,10 +1345,18 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + }, "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==", + "requires": { + "number-is-nan": "^1.0.0" + } }, "isarray": { "version": "1.0.0", @@ -415,7 +1366,8 @@ "isomorphic-ws": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", - "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==" + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "requires": {} }, "jmespath": { "version": "0.16.0", @@ -437,34 +1389,6 @@ "resolved": "https://registry.npmjs.org/loglevel-plugin-prefix/-/loglevel-plugin-prefix-0.8.4.tgz", "integrity": "sha512-WpG9CcFAOjz/FtNht+QJeGpvVl/cdR6P0z6OcXSkr8wFJOsV2GRj2j10JLfjuA4aYkcKCNIEqRGCyTife9R8/g==" }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "requires": { - "yallist": "^4.0.0" - } - }, - "make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "requires": { - "semver": "^6.0.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" - } - } - }, - "mimic-response": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz", - "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==" - }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -476,86 +1400,176 @@ "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" }, "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "requires": { "brace-expansion": "^1.1.7" } }, + "minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==" + }, "minipass": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.6.tgz", - "integrity": "sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", "requires": { - "yallist": "^4.0.0" + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" } }, "minizlib": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", - "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", + "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", "requires": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" + "minipass": "^2.9.0" } }, "mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "requires": { + "minimist": "^1.2.6" + } }, "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "nan": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", - "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "needle": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/needle/-/needle-2.9.1.tgz", + "integrity": "sha512-6R9fqJ5Zcmf+uYaFgdIHmLwNldn5HbK8L5ybn7Uz+ylX/rnOsSp1AHcvQSrCaFN+qNM1wpymHqD7mVasEOlHGQ==", + "requires": { + "debug": "^3.2.6", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + }, + "dependencies": { + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + } + } }, "node-fetch": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" }, + "node-pre-gyp": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.17.0.tgz", + "integrity": "sha512-abzZt1hmOjkZez29ppg+5gGqdPLUuJeAEwVPtHYEJgx0qzttCbcKFpxrCQn2HYbwCv2c+7JwH4BgEzFkUGpn4A==", + "requires": { + "detect-libc": "^1.0.3", + "mkdirp": "^0.5.5", + "needle": "^2.5.2", + "nopt": "^4.0.3", + "npm-packlist": "^1.4.8", + "npmlog": "^4.1.2", + "rc": "^1.2.8", + "rimraf": "^2.7.1", + "semver": "^5.7.1", + "tar": "^4.4.13" + } + }, "nopt": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", - "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.2.tgz", + "integrity": "sha512-x5DHup0SuyQcmL3s7Rx/YQ8sbw/Hzg0rj48eN0dV7hf5cmQq5PXIeioroH3raV1QC1yh3uTYuMThvEQF3iKgGQ==", + "requires": { + "npm-normalize-package-bin": "^1.0.1" + } + }, + "npm-normalize-package-bin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", + "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==" + }, + "npm-packlist": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.8.tgz", + "integrity": "sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A==", "requires": { - "abbrev": "1" + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1", + "npm-normalize-package-bin": "^1.0.1" } }, "npmlog": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", - "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "requires": { - "are-we-there-yet": "^2.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^3.0.0", - "set-blocking": "^2.0.0" + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" } }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==" + }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "requires": { "wrappy": "1" } }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==" + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==" + }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, "punycode": { "version": "1.3.2", @@ -567,20 +1581,42 @@ "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=" }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + } + }, "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } } }, "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", "requires": { "glob": "^7.1.3" } @@ -590,6 +1626,11 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, "sax": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", @@ -601,82 +1642,72 @@ "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" }, "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "requires": { - "lru-cache": "^6.0.0" - } + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" }, "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" }, "signal-exit": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz", - "integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==" - }, - "simple-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==" + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, - "simple-get": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.0.tgz", - "integrity": "sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==", + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "requires": { - "decompress-response": "^4.2.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" + "safe-buffer": "~5.1.0" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + } } }, "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==", "requires": { - "safe-buffer": "~5.2.0" + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" } }, "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", "requires": { - "ansi-regex": "^5.0.1" + "ansi-regex": "^2.0.0" } }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==" + }, "tar": { - "version": "6.1.11", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", - "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", + "version": "4.4.19", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.19.tgz", + "integrity": "sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA==", "requires": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^3.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" + "chownr": "^1.1.4", + "fs-minipass": "^1.2.7", + "minipass": "^2.9.0", + "minizlib": "^1.3.3", + "mkdirp": "^0.5.5", + "safe-buffer": "^5.2.1", + "yallist": "^3.1.1" } }, - "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" - }, "url": { "version": "0.10.3", "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", @@ -689,27 +1720,13 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, "uuid": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" }, - "webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" - }, - "whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", - "requires": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "wide-align": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", @@ -721,12 +1738,13 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "ws": { "version": "7.4.4", "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz", - "integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==" + "integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==", + "requires": {} }, "xml2js": { "version": "0.4.19", @@ -743,9 +1761,9 @@ "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" }, "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" } } } diff --git a/package.json b/package.json index 0e325ea..61e6b05 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,8 @@ "@cityofzion/neon-core": "^5.0.0-next.16", "@cityofzion/neon-js": "^5.0.0-next.16", "aws-sdk": "^2.1066.0", - "canvas": "^2.9.0", "chart.js": "^3.7.0", - "lodash": "^4.17.21" + "lodash": "^4.17.21", + "node-pre-gyp": "^0.17.0" } } diff --git a/scripts/deploy.js b/scripts/deploy.js index 013844f..169f52b 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -29,7 +29,7 @@ async function NEFHunter(dirPath) { const network = JSON.parse(fs.readFileSync("default.neo-express").toString()); const basePath = process.argv[2] || 'contracts' -const NODE = process.argv[3] || 'http://localhost:50012' +const NODE = process.argv[3] || 'http://127.0.0.1:50012' const PRIVATE_KEY = process.argv[4] || network.wallets[0].accounts[0]['private-key'] const SIGNER = new Neon.wallet.Account(PRIVATE_KEY) const TIME_CONSTANT = process.argv[5] || 5000 diff --git a/sdk/dist/Chest.d.ts b/sdk/dist/Chest.d.ts new file mode 100644 index 0000000..f7146c3 --- /dev/null +++ b/sdk/dist/Chest.d.ts @@ -0,0 +1,43 @@ +import { rpc, wallet } from '@cityofzion/neon-core'; +import { EligibilityCase, PropConstructorOptions } from "./interface"; +/** + TEMPLATE CONTRACT CLASS + Use this class template to build out the typescript interface for your smart contract. If you rename this or the + `api` equivalent, make sure to update the respective `index.ts` and rebuild. + */ +export declare class Chest { + private options; + private networkMagic; + constructor(options?: PropConstructorOptions); + /** + * DO NOT EDIT ME + * Gets the magic number for the network and configures the class instance. + */ + init(): Promise; + /** + * DO NOT EDIT ME + * The the node that the instance is connected to. + */ + get node(): rpc.RPCClient; + /** + * DO NOT EDIT ME + * The contract script hash that is being interfaced with. + */ + get scriptHash(): string; + /** + * + * EDIT ME!!! + * + * This template method is designed to be a passthough so you should really only be changing the name and parameter types. + * All the magic happens in the TemplateAPI.templateMethod. Check there to align your sdk with your smart contract. + * Create one of these pass throughs for each method you expose in your smart contract. The goal of this entire class is to + * simplify the network configuration steps which can be complicated. + */ + createChest(name: string, type: number, eligibilityCases: [EligibilityCase], signer: wallet.Account): Promise; + isEligible(chestId: number, nftScriptHash: string, tokenId: string, signer?: wallet.Account): Promise; + lootChest(chestId: number, nftScriptHash: string, tokenId: string, signer: wallet.Account): Promise; + lootChestVerified(chestId: number, nftScriptHash: string, tokenId: string, signer: wallet.Account): Promise; + lootChestAsOwner(chestId: number, signer: wallet.Account): Promise; + getChestJSON(chestId: number, signer?: wallet.Account): Promise; + totalChests(name: string, type: number, signer?: wallet.Account): Promise; +} diff --git a/sdk/dist/Chest.js b/sdk/dist/Chest.js new file mode 100644 index 0000000..a24dcd7 --- /dev/null +++ b/sdk/dist/Chest.js @@ -0,0 +1,114 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Chest = void 0; +const lodash_1 = require("lodash"); +const neon_core_1 = require("@cityofzion/neon-core"); +const api_1 = require("./api"); +const interface_1 = require("./interface"); +const helpers_1 = require("./helpers"); +const DEFAULT_OPTIONS = { + network: interface_1.NetworkOption.LocalNet +}; +/** + TEMPLATE CONTRACT CLASS + Use this class template to build out the typescript interface for your smart contract. If you rename this or the + `api` equivalent, make sure to update the respective `index.ts` and rebuild. + */ +class Chest { + // Once you get a scriptHash from deploying your smart contract via `npm run deploy`, update the `this.options.scriptHash` value. + // The default is analogous to localnet (neo-express) so you will most likely want to be updating that value. Remember to + // compile the sdk before use or your change wont take effect. Do that by running `tsc` in the sdk directory. + constructor(options = {}) { + this.options = DEFAULT_OPTIONS; + this.networkMagic = -1; + switch (options.network) { + case interface_1.NetworkOption.TestNet: + this.options.node = 'https://testnet1.neo.coz.io:443'; + this.options.scriptHash = ''; + break; + case interface_1.NetworkOption.MainNet: + this.options.node = 'https://mainnet1.neo.coz.io:443'; + this.options.scriptHash = '0xb94e721f5425ba1d8830ad752e50e0474f989da5'; + break; + default: + this.options.node = 'http://127.0.0.1:50012'; + this.options.scriptHash = '0x56f1d90192dba1088580ed3e34685a8695934b44'; + break; + } + this.options = (0, lodash_1.merge)({}, this.options, options); + } + /** + * DO NOT EDIT ME + * Gets the magic number for the network and configures the class instance. + */ + async init() { + const getVersionRes = await this.node.getVersion(); + this.networkMagic = getVersionRes.protocol.network; + } + /** + * DO NOT EDIT ME + * The the node that the instance is connected to. + */ + get node() { + if (this.options.node) { + return new neon_core_1.rpc.RPCClient(this.options.node); + } + throw new Error('no node selected!'); + } + /** + * DO NOT EDIT ME + * The contract script hash that is being interfaced with. + */ + get scriptHash() { + if (this.options.scriptHash) { + return this.options.scriptHash; + } + throw new Error('node scripthash defined'); + } + /** + * + * EDIT ME!!! + * + * This template method is designed to be a passthough so you should really only be changing the name and parameter types. + * All the magic happens in the TemplateAPI.templateMethod. Check there to align your sdk with your smart contract. + * Create one of these pass throughs for each method you expose in your smart contract. The goal of this entire class is to + * simplify the network configuration steps which can be complicated. + */ + async createChest(name, type, eligibilityCases, signer) { + return api_1.ChestAPI.createChest(this.node.url, this.networkMagic, this.scriptHash, name, type, eligibilityCases, signer); + } + async isEligible(chestId, nftScriptHash, tokenId, signer) { + return api_1.ChestAPI.isEligible(this.node.url, this.networkMagic, this.scriptHash, chestId, nftScriptHash, tokenId, signer); + } + async lootChest(chestId, nftScriptHash, tokenId, signer) { + return api_1.ChestAPI.lootChest(this.node.url, this.networkMagic, this.scriptHash, chestId, nftScriptHash, tokenId, signer); + } + async lootChestVerified(chestId, nftScriptHash, tokenId, signer) { + const timeout = 60000; + let age = 0; + const txid = await api_1.ChestAPI.lootChest(this.node.url, this.networkMagic, this.scriptHash, chestId, nftScriptHash, tokenId, signer); + while (timeout >= age) { + try { + let res = await (0, helpers_1.txDidComplete)(this.node.url, txid, false); + res[0].scriptHash = neon_core_1.u.reverseHex(neon_core_1.u.str2hexstring(res[0].scriptHash)); + return res; + } + catch (e) { + await (0, helpers_1.sleep)(1000); + age += 1000; + } + } + throw new Error("timeout exceeded"); + } + async lootChestAsOwner(chestId, signer) { + return api_1.ChestAPI.lootChestAsOwner(this.node.url, this.networkMagic, this.scriptHash, chestId, signer); + } + async getChestJSON(chestId, signer) { + return api_1.ChestAPI.getChestJSON(this.node.url, this.networkMagic, this.scriptHash, chestId, signer); + } + async totalChests(name, type, signer) { + return api_1.ChestAPI.totalChests(this.node.url, this.networkMagic, this.scriptHash, signer); + } +} +exports.Chest = Chest; +//# sourceMappingURL=Chest.js.map \ No newline at end of file diff --git a/sdk/dist/Chest.js.map b/sdk/dist/Chest.js.map new file mode 100644 index 0000000..9469ea5 --- /dev/null +++ b/sdk/dist/Chest.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Chest.js","sourceRoot":"","sources":["../src/Chest.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,qDAAoD;AACpD,+BAA2C;AAC3C,2CAAmF;AACnF,uCAA0D;AAE1D,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED;;;;GAIG;AAEH,MAAa,KAAK;IAIhB,iIAAiI;IACjI,0HAA0H;IAC1H,8GAA8G;IAC9G,YAAY,UAAkC,EAAE;QANxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAM/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,EAAE,CAAA;gBAC5B,MAAK;YACP,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBAC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I,CAAA;aACZ;SACF;QACD,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,OAAe,EAAE,MAAsB;QAC5D,OAAO,cAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IACtG,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAAe,EAAE,MAAuB;QACzD,OAAO,cAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IAClG,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,IAAY,EAAE,IAAY,EAAE,MAAuB;QACnE,OAAO,cAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACxF,CAAC;CAEF;AA1GD,sBA0GC"} \ No newline at end of file diff --git a/sdk/dist/Collection.d.ts b/sdk/dist/Collection.d.ts new file mode 100644 index 0000000..3c862d1 --- /dev/null +++ b/sdk/dist/Collection.d.ts @@ -0,0 +1,167 @@ +import { rpc, wallet } from '@cityofzion/neon-core'; +import { CollectionType, PropConstructorOptions } from "./interface"; +/** + * The Collection prop is designed to store static-immutable data for reference in other projects. Storing static data + * in contracts is very expensive and inefficient, especially for new projects. This contract resolves that issue by creating + * library for static data. This class exposes the interface along with a number of helpful features to make the smart + * contract easy to use for typescript developers. + * + * All of the prop helper classes will auto-configure your network settings. The default configuration will interface with + * the contract compiled with this project and deployed locally at http://localhost:50012. For more information on deploying + * contract packages, refer to the quickstart. + * + * All methods support a signer. If the method can be run as a test-invoke, optionally populating the signer parameter + * will publish the invocation and return the txid instead of the method response. + * + * To use this class: + * ```typescript + * import {Collection} from "../../dist" //import {Collection} from "@cityofzion/props + * + * const collection: Collection = new Collection() + * await collection.init() // interfaces with the node to resolve network magic + * + * const total = await collection.totalCollections() + * console.log(total) // outputs the total collection count in the contract + * ``` + */ +export declare class Collection { + private options; + private networkMagic; + constructor(options?: PropConstructorOptions); + /** + * Gets the magic number for the network and configures the class instance. + */ + init(): Promise; + /** + * The the node that the instance is connected to. + */ + get node(): rpc.RPCClient; + /** + * The contract script hash that is being interfaced with. + */ + get scriptHash(): string; + /** + * Publishes an array of immutable data to the smart contract along with some useful metadata. + * + * @param description A useful description of the collection. + * @param collectionType The type of the data being store. This is an unregulated field. Standard NVM datatypes should + * adhere to existing naming conventions. + * @param extra An unregulated field for unplanned feature development. + * @param values An array of values that represent the body of the collection. + * @param signer The signer of the transaction. + * + * @returns A transaction ID. Refer to {@link helpers.txDidComplete} for parsing. + */ + createCollection(description: string, collectionType: string, extra: string, values: string[], signer: wallet.Account): Promise; + /** + * Loads a {@link CollectionType} formatted JSON file and pushes it to the smart contract. + * + * @param path The path to the file. + * @param signer The signer of the transaction. + * + * @returns A transaction ID. Refer to {@link helper.txDidComplete} for parsing. + */ + createFromFile(path: string, signer: wallet.Account): Promise; + /** + * Gets a JSON formatting collection from the smart contract. + * + * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The requested collection **OR** a txid if the signer parameter is populated. + */ + getCollectionJSON(collectionId: number, signer?: wallet.Account): Promise; + /** + * Gets the bytestring representation of the collection. This is primarilly used for inter-contract interfacing, + * but we include it here for completeness. + * + * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The bytestring representation of the collection. **OR** a txid if the signer parameter is populated. + */ + getCollection(collectionId: number, signer?: wallet.Account): Promise; + /** + * Returns the value of a collection from a requested index. + * + * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. + * @param index The index of the array element being requested. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The value of the collection element **OR** a txid if the signer parameter is populated. + */ + getCollectionElement(collectionId: number, index: number, signer?: wallet.Account): Promise; + /** + * Gets the array length of a requested collection. + * + * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The length of the collection **OR** a txid if the signer parameter is populated. + */ + getCollectionLength(collectionId: number, signer?: wallet.Account): Promise; + /** + * Gets the values of a collection, omitting the metadata. + * + * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The values in the collection **OR** a txid if the signer parameter is populated. + */ + getCollectionValues(collectionId: number, signer?: wallet.Account): Promise; + /** + * Maps byte entropy onto a collection's values and returns the index of the result. The mapping is made as follows: + * + * [0 -> MAX(entropyBytes.length)][entropy] -> [0 -> collection.length][index] + * + * This method is primarily useful for computationally efficient contract interfacing. For random sampling, or + * sampling from a distribution, use {@link getCollectionLength} in combination with {@link getCollectionElement} or + * {@link sampleFromCollection}. + * + * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. + * @param entropy Bytes to use for the mapping. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The element from the mapping **OR** a txid if the signer parameter is populated. + */ + mapBytesOntoCollection(collectionId: number, entropy: string, signer?: wallet.Account): Promise; + /** + * Samples a uniform random value from the collection using a Contract.Call to the {@link Dice} contract. + * + * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. + * @param samples The number of samples to return + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns A uniform random sample from the collection. **OR** a txid if the signer parameter is populated. + * **Note:** This method will not randomly generate unless the transaction is published so use the signer field for + * testing. + */ + sampleFromCollection(collectionId: number, samples: number, signer?: wallet.Account): Promise; + /** + * Samples uniformly from a collection provided at the time of invocation. Users have the option to 'pick', which + * prevents a value from being selected multiple times. The results are published as outputs on the transaction. + * @param values an array of values to sample from + * @param samples the number of samples to fairly select from the values + * @param pick Are selected values removed from the list of options for future samples? + * @param signer The signer of the transaction. + */ + sampleFromRuntimeCollection(values: string[], samples: number, pick: boolean, signer: wallet.Account): Promise; + /** + * Gets the total collections. Collection IDs are autogenerated on range [1 -> totalCollections] inclusive if you are + * planning to iterate of their collection IDs. + * + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The total number of collections stored in the contract. **OR** a txid if the signer parameter is populated. + */ + totalCollections(signer?: wallet.Account): Promise; + update(script: string, manifest: string, signer: wallet.Account): Promise; +} diff --git a/sdk/dist/Collection.js b/sdk/dist/Collection.js new file mode 100644 index 0000000..8bc99a5 --- /dev/null +++ b/sdk/dist/Collection.js @@ -0,0 +1,244 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Collection = void 0; +const lodash_1 = require("lodash"); +const neon_core_1 = require("@cityofzion/neon-core"); +const neon_js_1 = require("@cityofzion/neon-js"); +const interface_1 = require("./interface"); +const api_1 = require("./api"); +const fs_1 = __importDefault(require("fs")); +const DEFAULT_OPTIONS = { + network: interface_1.NetworkOption.LocalNet +}; +/** + * The Collection prop is designed to store static-immutable data for reference in other projects. Storing static data + * in contracts is very expensive and inefficient, especially for new projects. This contract resolves that issue by creating + * library for static data. This class exposes the interface along with a number of helpful features to make the smart + * contract easy to use for typescript developers. + * + * All of the prop helper classes will auto-configure your network settings. The default configuration will interface with + * the contract compiled with this project and deployed locally at http://localhost:50012. For more information on deploying + * contract packages, refer to the quickstart. + * + * All methods support a signer. If the method can be run as a test-invoke, optionally populating the signer parameter + * will publish the invocation and return the txid instead of the method response. + * + * To use this class: + * ```typescript + * import {Collection} from "../../dist" //import {Collection} from "@cityofzion/props + * + * const collection: Collection = new Collection() + * await collection.init() // interfaces with the node to resolve network magic + * + * const total = await collection.totalCollections() + * console.log(total) // outputs the total collection count in the contract + * ``` + */ +class Collection { + constructor(options = {}) { + this.options = DEFAULT_OPTIONS; + this.networkMagic = -1; + switch (options.network) { + case interface_1.NetworkOption.TestNet: + this.options.node = 'https://testnet1.neo.coz.io:443'; + this.options.scriptHash = '0x429ba9252c761b6119ab9442d9fbe2e60f3c6f3e'; + break; + case interface_1.NetworkOption.MainNet: + this.options.node = 'https://mainnet1.neo.coz.io:443'; + this.options.scriptHash = '0xf05651bc505fd5c7d36593f6e8409932342f9085'; + break; + default: + this.options.node = 'http://127.0.0.1:50012'; + this.options.scriptHash = '0xacf2aa5d0899e860eebd8b8a5454aa3017543848'; + break; + } + this.options = (0, lodash_1.merge)({}, this.options, options); + } + /** + * Gets the magic number for the network and configures the class instance. + */ + async init() { + const getVersionRes = await this.node.getVersion(); + this.networkMagic = getVersionRes.protocol.network; + } + /** + * The the node that the instance is connected to. + */ + get node() { + if (this.options.node) { + return new neon_core_1.rpc.RPCClient(this.options.node); + } + throw new Error('no node selected!'); + } + /** + * The contract script hash that is being interfaced with. + */ + get scriptHash() { + if (this.options.scriptHash) { + return this.options.scriptHash; + } + throw new Error('scripthash defined'); + } + /** + * Publishes an array of immutable data to the smart contract along with some useful metadata. + * + * @param description A useful description of the collection. + * @param collectionType The type of the data being store. This is an unregulated field. Standard NVM datatypes should + * adhere to existing naming conventions. + * @param extra An unregulated field for unplanned feature development. + * @param values An array of values that represent the body of the collection. + * @param signer The signer of the transaction. + * + * @returns A transaction ID. Refer to {@link helpers.txDidComplete} for parsing. + */ + async createCollection(description, collectionType, extra, values, signer) { + return api_1.CollectionAPI.createCollection(this.node.url, this.networkMagic, this.scriptHash, description, collectionType, extra, values, signer); + } + /** + * Loads a {@link CollectionType} formatted JSON file and pushes it to the smart contract. + * + * @param path The path to the file. + * @param signer The signer of the transaction. + * + * @returns A transaction ID. Refer to {@link helper.txDidComplete} for parsing. + */ + async createFromFile(path, signer) { + const localCollection = JSON.parse(fs_1.default.readFileSync(path).toString()); + const formattedValues = localCollection.values.map((value) => { + switch (localCollection.type) { + case 'string': + return neon_js_1.sc.ContractParam.string(value); + case 'int': + return neon_js_1.sc.ContractParam.integer(value); + } + }); + return api_1.CollectionAPI.createCollectionRaw(this.node.url, this.networkMagic, this.scriptHash, localCollection.description, localCollection.type, localCollection.extra, formattedValues, signer); + } + /** + * Gets a JSON formatting collection from the smart contract. + * + * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The requested collection **OR** a txid if the signer parameter is populated. + */ + async getCollectionJSON(collectionId, signer) { + return api_1.CollectionAPI.getCollectionJSON(this.node.url, this.networkMagic, this.scriptHash, collectionId, signer); + } + /** + * Gets the bytestring representation of the collection. This is primarilly used for inter-contract interfacing, + * but we include it here for completeness. + * + * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The bytestring representation of the collection. **OR** a txid if the signer parameter is populated. + */ + async getCollection(collectionId, signer) { + return api_1.CollectionAPI.getCollection(this.node.url, this.networkMagic, this.scriptHash, collectionId, signer); + } + /** + * Returns the value of a collection from a requested index. + * + * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. + * @param index The index of the array element being requested. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The value of the collection element **OR** a txid if the signer parameter is populated. + */ + async getCollectionElement(collectionId, index, signer) { + return api_1.CollectionAPI.getCollectionElement(this.node.url, this.networkMagic, this.scriptHash, collectionId, index, signer); + } + /** + * Gets the array length of a requested collection. + * + * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The length of the collection **OR** a txid if the signer parameter is populated. + */ + async getCollectionLength(collectionId, signer) { + return api_1.CollectionAPI.getCollectionLength(this.node.url, this.networkMagic, this.scriptHash, collectionId, signer); + } + /** + * Gets the values of a collection, omitting the metadata. + * + * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The values in the collection **OR** a txid if the signer parameter is populated. + */ + async getCollectionValues(collectionId, signer) { + return api_1.CollectionAPI.getCollectionValues(this.node.url, this.networkMagic, this.scriptHash, collectionId, signer); + } + /** + * Maps byte entropy onto a collection's values and returns the index of the result. The mapping is made as follows: + * + * [0 -> MAX(entropyBytes.length)][entropy] -> [0 -> collection.length][index] + * + * This method is primarily useful for computationally efficient contract interfacing. For random sampling, or + * sampling from a distribution, use {@link getCollectionLength} in combination with {@link getCollectionElement} or + * {@link sampleFromCollection}. + * + * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. + * @param entropy Bytes to use for the mapping. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The element from the mapping **OR** a txid if the signer parameter is populated. + */ + async mapBytesOntoCollection(collectionId, entropy, signer) { + return api_1.CollectionAPI.mapBytesOntoCollection(this.node.url, this.networkMagic, this.scriptHash, collectionId, entropy, signer); + } + /** + * Samples a uniform random value from the collection using a Contract.Call to the {@link Dice} contract. + * + * @param collectionId The collectionID being requested. Refer to {@link https://props.coz.io} for a formatted list. + * @param samples The number of samples to return + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns A uniform random sample from the collection. **OR** a txid if the signer parameter is populated. + * **Note:** This method will not randomly generate unless the transaction is published so use the signer field for + * testing. + */ + async sampleFromCollection(collectionId, samples, signer) { + return api_1.CollectionAPI.sampleFromCollection(this.node.url, this.networkMagic, this.scriptHash, collectionId, samples, signer); + } + /** + * Samples uniformly from a collection provided at the time of invocation. Users have the option to 'pick', which + * prevents a value from being selected multiple times. The results are published as outputs on the transaction. + * @param values an array of values to sample from + * @param samples the number of samples to fairly select from the values + * @param pick Are selected values removed from the list of options for future samples? + * @param signer The signer of the transaction. + */ + async sampleFromRuntimeCollection(values, samples, pick, signer) { + return api_1.CollectionAPI.sampleFromRuntimeCollection(this.node.url, this.networkMagic, this.scriptHash, values, samples, pick, signer); + } + /** + * Gets the total collections. Collection IDs are autogenerated on range [1 -> totalCollections] inclusive if you are + * planning to iterate of their collection IDs. + * + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The total number of collections stored in the contract. **OR** a txid if the signer parameter is populated. + */ + async totalCollections(signer) { + return api_1.CollectionAPI.totalCollections(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async update(script, manifest, signer) { + return api_1.CollectionAPI.update(this.node.url, this.networkMagic, this.scriptHash, script, manifest, '', signer); + } +} +exports.Collection = Collection; +//# sourceMappingURL=Collection.js.map \ No newline at end of file diff --git a/sdk/dist/Collection.js.map b/sdk/dist/Collection.js.map new file mode 100644 index 0000000..6022819 --- /dev/null +++ b/sdk/dist/Collection.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Collection.js","sourceRoot":"","sources":["../src/Collection.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA4B;AAC5B,qDAAiD;AACjD,iDAAuC;AACvC,2CAAkF;AAClF,+BAAoC;AACpC,4CAAmB;AAGnB,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH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/dist/Dice.d.ts b/sdk/dist/Dice.d.ts new file mode 100644 index 0000000..f142fa2 --- /dev/null +++ b/sdk/dist/Dice.d.ts @@ -0,0 +1,98 @@ +import { rpc, wallet } from '@cityofzion/neon-core'; +import { PropConstructorOptions } from "./interface"; +/** + * The dice prop normalizes a lot of behaviors associated with random number generation to improve usability within + * projects. + * + * All of the prop helper classes will auto-configure your network settings. The default configuration will interface with + * the contract compiled with this project and deployed locally at http://localhost:50012. For more information on deploying + * contract packages, refer to the quickstart. + * + * All methods support a signer. If the method can be run as a test-invoke, optionally populating the signer parameter + * will publish the invocation and return the txid instead of the method response. + * + * To use this class: + * ```typescript + * import {Dice} from "../../dist" //import {Dice} from "@cityofzion/props + * + * const dice: Dice = new Dice() + * await dice.init() // interfaces with the node to resolve network magic + * + * const randomNumber = await dice.randBetween(0, 100) + * console.log(randomNumber) // outputs the random number. You should include a signer to the method above + * for a truly random number. + * ``` + */ +export declare class Dice { + private options; + private networkMagic; + constructor(options?: PropConstructorOptions); + /** + * Gets the magic number for the network and configures the class instance. + */ + init(): Promise; + /** + * The the node that the instance is connected to. + */ + get node(): rpc.RPCClient; + /** + * The contract script hash that is being interfaced with. + */ + get scriptHash(): string; + /** + * Gets a random number of range [start -> end] inclusive. This method supports negative integer ranges. + * + * **Note:** + * This method must include a signer to produce truly random numbers. + * + * @param start the minimum value for the selection range. + * @param end the maximum value for the selection range. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The pseudo-random number. **OR** a txid if the signer parameter is populated. + */ + randBetween(start: number, end: number, signer?: wallet.Account): Promise; + /** + * Maps bytes onto a range of numbers: + * + * [0 -> Max(entropy.length)][entropy] --> [start, end] + * + * @param start the minimum value for the selection range. + * @param end the maximum value for the selection range. + * @param entropy the bytes used in the sampling. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The resulting number from the mapping. **OR** a txid if the signer parameter is populated. + */ + mapBytesOntoRange(start: number, end: number, entropy: string, signer?: wallet.Account): Promise; + /** + * Rolls for a `dX` formatted random number. + * + * **Note:** + * This method must include a signer to produce truly random numbers. + * + * @param die The die to roll. The input format can support arbitarilly large dice which are effectively spherical.. + * or more traditional ones. e.g. 'd6' + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The result of the die roll **OR** a txid if the signer parameter is populated. + */ + rollDie(die: string, signer?: wallet.Account): Promise; + /** + * Calculates dice rolls using provided entropy. This method will return and array of length `entropy.length / precision`. + * + * @param die The die to roll. The input format can support arbitarilly large dice which are effectively spherical.. + * or more traditional ones. e.g. 'd6' + * @param precision The number of bytes to use for each sample. Sampling at a precision below the fidelity of your range + * will succeed, but your results will be overly-discrete. + * @param entropy The bytes of data used to seed the sampling. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns An array of dice rolls. **OR** a txid if the signer parameter is populated. + */ + rollDiceWithEntropy(die: string, precision: number, entropy: string, signer?: wallet.Account): Promise; +} diff --git a/sdk/dist/Dice.js b/sdk/dist/Dice.js new file mode 100644 index 0000000..1b579f0 --- /dev/null +++ b/sdk/dist/Dice.js @@ -0,0 +1,145 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Dice = void 0; +const lodash_1 = require("lodash"); +const neon_core_1 = require("@cityofzion/neon-core"); +const api_1 = require("./api"); +const interface_1 = require("./interface"); +const DEFAULT_OPTIONS = { + network: interface_1.NetworkOption.LocalNet +}; +/** + * The dice prop normalizes a lot of behaviors associated with random number generation to improve usability within + * projects. + * + * All of the prop helper classes will auto-configure your network settings. The default configuration will interface with + * the contract compiled with this project and deployed locally at http://localhost:50012. For more information on deploying + * contract packages, refer to the quickstart. + * + * All methods support a signer. If the method can be run as a test-invoke, optionally populating the signer parameter + * will publish the invocation and return the txid instead of the method response. + * + * To use this class: + * ```typescript + * import {Dice} from "../../dist" //import {Dice} from "@cityofzion/props + * + * const dice: Dice = new Dice() + * await dice.init() // interfaces with the node to resolve network magic + * + * const randomNumber = await dice.randBetween(0, 100) + * console.log(randomNumber) // outputs the random number. You should include a signer to the method above + * for a truly random number. + * ``` + */ +class Dice { + constructor(options = {}) { + this.options = DEFAULT_OPTIONS; + this.networkMagic = -1; + switch (options.network) { + case interface_1.NetworkOption.TestNet: + this.options.node = 'https://testnet1.neo.coz.io:443'; + this.options.scriptHash = '0x4380f2c1de98bb267d3ea821897ec571a04fe3e0'; + break; + case interface_1.NetworkOption.MainNet: + this.options.node = 'https://mainnet1.neo.coz.io:443'; + this.options.scriptHash = '0x4380f2c1de98bb267d3ea821897ec571a04fe3e0'; + break; + case interface_1.NetworkOption.LocalNet: + this.options.node = 'http://127.0.0.1:50012'; + this.options.scriptHash = '0x16d6a0be0506b26e0826dd352724cda0defa7131'; + break; + } + this.options = (0, lodash_1.merge)({}, this.options, options); + } + /** + * Gets the magic number for the network and configures the class instance. + */ + async init() { + const getVersionRes = await this.node.getVersion(); + this.networkMagic = getVersionRes.protocol.network; + } + /** + * The the node that the instance is connected to. + */ + get node() { + if (this.options.node) { + return new neon_core_1.rpc.RPCClient(this.options.node); + } + throw new Error('no node selected!'); + } + /** + * The contract script hash that is being interfaced with. + */ + get scriptHash() { + if (this.options.scriptHash) { + return this.options.scriptHash; + } + throw new Error('node scripthash defined'); + } + /** + * Gets a random number of range [start -> end] inclusive. This method supports negative integer ranges. + * + * **Note:** + * This method must include a signer to produce truly random numbers. + * + * @param start the minimum value for the selection range. + * @param end the maximum value for the selection range. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The pseudo-random number. **OR** a txid if the signer parameter is populated. + */ + async randBetween(start, end, signer) { + return api_1.DiceAPI.randBetween(this.node.url, this.networkMagic, this.scriptHash, start, end, signer); + } + /** + * Maps bytes onto a range of numbers: + * + * [0 -> Max(entropy.length)][entropy] --> [start, end] + * + * @param start the minimum value for the selection range. + * @param end the maximum value for the selection range. + * @param entropy the bytes used in the sampling. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The resulting number from the mapping. **OR** a txid if the signer parameter is populated. + */ + async mapBytesOntoRange(start, end, entropy, signer) { + return api_1.DiceAPI.mapBytesOntoRange(this.node.url, this.networkMagic, this.scriptHash, start, end, entropy, signer); + } + /** + * Rolls for a `dX` formatted random number. + * + * **Note:** + * This method must include a signer to produce truly random numbers. + * + * @param die The die to roll. The input format can support arbitarilly large dice which are effectively spherical.. + * or more traditional ones. e.g. 'd6' + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns The result of the die roll **OR** a txid if the signer parameter is populated. + */ + async rollDie(die, signer) { + return api_1.DiceAPI.rollDie(this.node.url, this.networkMagic, this.scriptHash, die, signer); + } + /** + * Calculates dice rolls using provided entropy. This method will return and array of length `entropy.length / precision`. + * + * @param die The die to roll. The input format can support arbitarilly large dice which are effectively spherical.. + * or more traditional ones. e.g. 'd6' + * @param precision The number of bytes to use for each sample. Sampling at a precision below the fidelity of your range + * will succeed, but your results will be overly-discrete. + * @param entropy The bytes of data used to seed the sampling. + * @param signer An optional signer. Populating this field will publish the transaction and return a txid instead of + * running the invocation as a test invoke. + * + * @returns An array of dice rolls. **OR** a txid if the signer parameter is populated. + */ + async rollDiceWithEntropy(die, precision, entropy, signer) { + return api_1.DiceAPI.rollDiceWithEntropy(this.node.url, this.networkMagic, this.scriptHash, die, precision, entropy, signer); + } +} +exports.Dice = Dice; +//# sourceMappingURL=Dice.js.map \ No newline at end of file diff --git a/sdk/dist/Dice.js.map b/sdk/dist/Dice.js.map new file mode 100644 index 0000000..fb0c68a --- /dev/null +++ b/sdk/dist/Dice.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Dice.js","sourceRoot":"","sources":["../src/Dice.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,qDAAiD;AACjD,+BAA6B;AAC7B,2CAAkE;A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UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IACxH,CAAC;CAEF;AAtHD,oBAsHC"} \ No newline at end of file diff --git a/sdk/dist/Generator.d.ts b/sdk/dist/Generator.d.ts new file mode 100644 index 0000000..0fe23f7 --- /dev/null +++ b/sdk/dist/Generator.d.ts @@ -0,0 +1,23 @@ +import { rpc, wallet } from '@cityofzion/neon-core'; +import { GeneratorType, InstanceAccessMode, InstanceAuthorizedContracts, PropConstructorOptions, TraitType } from "./interface"; +export declare class Generator { + private options; + private networkMagic; + constructor(options?: PropConstructorOptions); + init(): Promise; + get node(): rpc.RPCClient; + get scriptHash(): string; + createGenerator(generator: GeneratorType, signer: wallet.Account, timeConstantMS: number): Promise; + createGeneratorFromFile(path: string, signer: wallet.Account, timeConstantMS: number): Promise; + createTrait(generatorId: number, trait: TraitType, signer: wallet.Account): Promise; + getGeneratorJSON(generatorId: number, signer?: wallet.Account): Promise; + getGeneratorInstanceJSON(instanceId: number, signer?: wallet.Account): Promise; + createInstance(generatorId: number, signer: wallet.Account): Promise; + mintFromInstance(instanceId: number, signer: wallet.Account): Promise; + setInstanceAccessMode(instanceId: number, accessMode: InstanceAccessMode, signer: wallet.Account): Promise; + setInstanceAuthorizedUsers(instanceId: number, authorizedUsers: string[], signer: wallet.Account): Promise; + setInstanceAuthorizedContracts(instanceId: number, authorizedContracts: InstanceAuthorizedContracts[], signer: wallet.Account): Promise; + setInstanceFee(instanceId: number, fee: number, signer: wallet.Account): Promise; + totalGenerators(signer?: wallet.Account): Promise; + totalGeneratorInstances(signer?: wallet.Account): Promise; +} diff --git a/sdk/dist/Generator.js b/sdk/dist/Generator.js new file mode 100644 index 0000000..2105279 --- /dev/null +++ b/sdk/dist/Generator.js @@ -0,0 +1,113 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Generator = void 0; +const lodash_1 = require("lodash"); +const neon_core_1 = require("@cityofzion/neon-core"); +const api_1 = require("./api"); +const interface_1 = require("./interface"); +const helpers_1 = require("./helpers"); +const fs_1 = __importDefault(require("fs")); +const DEFAULT_OPTIONS = { + network: interface_1.NetworkOption.LocalNet +}; +class Generator { + constructor(options = {}) { + this.options = DEFAULT_OPTIONS; + this.networkMagic = -1; + switch (options.network) { + case interface_1.NetworkOption.TestNet: + this.options.node = 'https://testnet1.neo.coz.io:443'; + this.options.scriptHash = '0xdda8055789f0eb3c1d092c714a68ba3e631586c7'; + break; + case interface_1.NetworkOption.MainNet: + this.options.node = 'https://mainnet1.neo.coz.io:443'; + this.options.scriptHash = '0x0e312c70ce6ed18d5702c6c5794c493d9ef46dc9'; + break; + default: + this.options.node = 'http://127.0.0.1:50012'; + this.options.scriptHash = '0xa3e59ddc61b2d8ac42c519cee5ddaac83c7df276'; + break; + } + this.options = (0, lodash_1.merge)({}, this.options, options); + } + async init() { + const getVersionRes = await this.node.getVersion(); + this.networkMagic = getVersionRes.protocol.network; + } + get node() { + if (this.options.node) { + return new neon_core_1.rpc.RPCClient(this.options.node); + } + throw new Error('no node selected!'); + } + get scriptHash() { + if (this.options.scriptHash) { + return this.options.scriptHash; + } + throw new Error('node scripthash defined'); + } + async createGenerator(generator, signer, timeConstantMS) { + const txids = []; + let txid = await api_1.GeneratorAPI.createGenerator(this.node.url, this.networkMagic, this.scriptHash, generator.label, generator.baseGeneratorFee, signer); + txids.push(txid); + await (0, helpers_1.sleep)(timeConstantMS); + const res = await (0, helpers_1.txDidComplete)(this.node.url, txid, false); + for await (let trait of generator.traits) { + trait = trait; + txid = await api_1.GeneratorAPI.createTrait(this.node.url, this.networkMagic, this.scriptHash, res[0], trait.label, trait.slots, trait.traitLevels, signer); + txids.push(txid); + await (0, helpers_1.sleep)(timeConstantMS); + } + return txids; + } + async createGeneratorFromFile(path, signer, timeConstantMS) { + const localGenerator = JSON.parse(fs_1.default.readFileSync(path).toString()); + return this.createGenerator(localGenerator, signer, timeConstantMS); + } + async createTrait(generatorId, trait, signer) { + return api_1.GeneratorAPI.createTrait(this.node.url, this.networkMagic, this.scriptHash, generatorId, trait.label, trait.slots, trait.traitLevels, signer); + } + async getGeneratorJSON(generatorId, signer) { + const generator = await api_1.GeneratorAPI.getGeneratorJSON(this.node.url, this.networkMagic, this.scriptHash, generatorId, signer); + const gType = generator; + const traits = []; + for (let i = 0; i < gType.traits.length; i++) { + let trait = await api_1.GeneratorAPI.getTraitJSON(this.node.url, this.networkMagic, this.scriptHash, gType.traits[i]); + traits.push(trait); + } + gType.traits = traits; + return gType; + } + async getGeneratorInstanceJSON(instanceId, signer) { + return api_1.GeneratorAPI.getGeneratorInstanceJSON(this.node.url, this.networkMagic, this.scriptHash, instanceId, signer); + } + async createInstance(generatorId, signer) { + return api_1.GeneratorAPI.createInstance(this.node.url, this.networkMagic, this.scriptHash, generatorId, signer); + } + async mintFromInstance(instanceId, signer) { + return api_1.GeneratorAPI.mintFromInstance(this.node.url, this.networkMagic, this.scriptHash, instanceId, signer); + } + async setInstanceAccessMode(instanceId, accessMode, signer) { + return api_1.GeneratorAPI.setInstanceAccessMode(this.node.url, this.networkMagic, this.scriptHash, instanceId, accessMode, signer); + } + async setInstanceAuthorizedUsers(instanceId, authorizedUsers, signer) { + return api_1.GeneratorAPI.setInstanceAuthorizedUsers(this.node.url, this.networkMagic, this.scriptHash, instanceId, authorizedUsers, signer); + } + async setInstanceAuthorizedContracts(instanceId, authorizedContracts, signer) { + return api_1.GeneratorAPI.setInstanceAuthorizedContracts(this.node.url, this.networkMagic, this.scriptHash, instanceId, authorizedContracts, signer); + } + async setInstanceFee(instanceId, fee, signer) { + return api_1.GeneratorAPI.setInstanceFee(this.node.url, this.networkMagic, this.scriptHash, instanceId, fee, signer); + } + async totalGenerators(signer) { + return api_1.GeneratorAPI.totalGenerators(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async totalGeneratorInstances(signer) { + return api_1.GeneratorAPI.totalGeneratorInstances(this.node.url, this.networkMagic, this.scriptHash, signer); + } +} +exports.Generator = Generator; +//# sourceMappingURL=Generator.js.map \ No newline at end of file diff --git a/sdk/dist/Generator.js.map b/sdk/dist/Generator.js.map new file mode 100644 index 0000000..e90c1b2 --- /dev/null +++ b/sdk/dist/Generator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Generator.js","sourceRoot":"","sources":["../src/Generator.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA8B;AAC9B,qDAAiD;AACjD,+BAAkC;AAClC,2CAMqB;AACrB,uCAA+C;AAC/C,4CAAoB;AAEpB,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED,MAAa,SAAS;IAIpB,YAAY,UAAkC,EAAE;QAHxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAG/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP;gBACE,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,wBAAwB,CAAA;gBAC5C,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;SACR;QACD,IAAI,CAAC,OAAO,GAAG,IAAA,cAAK,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,IAAI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c1 --- /dev/null +++ b/sdk/dist/Gift.d.ts @@ -0,0 +1,30 @@ +import { rpc, wallet } from '@cityofzion/neon-core'; +import { EpochType, PropConstructorOptions, GiftType } from "./interface"; +export declare class Gift { + private options; + private networkMagic; + constructor(options?: PropConstructorOptions); + init(): Promise; + get node(): rpc.RPCClient; + get scriptHash(): string; + balanceOf(address: string, signer?: wallet.Account): Promise; + createEpoch(label: string, generatorInstanceId: number, initialRollCollectionId: number, mintFee: number, sysFee: number, maxSupply: number, signer: wallet.Account): Promise; + decimals(signer?: wallet.Account): Promise; + deploy(signer: wallet.Account): Promise; + getEpochJSON(epochId: number, signer?: wallet.Account): Promise; + getTokenJSON(tokenId: string, signer?: wallet.Account): Promise; + getTokenRaw(tokenId: string, signer?: wallet.Account): Promise; + ownerOf(tokenId: string, signer?: wallet.Account): Promise; + offlineMint(epochId: number, owner: string, signer: wallet.Account): Promise; + properties(tokenId: string, signer?: wallet.Account): Promise; + purchase(epochId: number, signer: wallet.Account): Promise; + setMintFee(epochId: number, fee: number, signer: wallet.Account): Promise; + symbol(signer?: wallet.Account): Promise; + tokens(signer?: wallet.Account): Promise; + tokensOf(address: string, signer?: wallet.Account): Promise; + totalAccounts(signer?: wallet.Account): Promise; + totalEpochs(signer?: wallet.Account): Promise; + totalSupply(signer?: wallet.Account): Promise; + transfer(to: string, tokenId: string, signer: wallet.Account, data: any): Promise; + update(script: string, manifest: string, signer: wallet.Account): Promise; +} diff --git a/sdk/dist/Gift.js b/sdk/dist/Gift.js new file mode 100644 index 0000000..aad34a7 --- /dev/null +++ b/sdk/dist/Gift.js @@ -0,0 +1,129 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Gift = void 0; +const lodash_1 = require("lodash"); +const neon_core_1 = require("@cityofzion/neon-core"); +const api_1 = require("./api"); +const neon_js_1 = require("@cityofzion/neon-js"); +const interface_1 = require("./interface"); +const DEFAULT_OPTIONS = { + network: interface_1.NetworkOption.LocalNet +}; +class Gift { + constructor(options = {}) { + this.options = DEFAULT_OPTIONS; + this.networkMagic = -1; + switch (options.network) { + case interface_1.NetworkOption.TestNet: + this.options.node = 'https://testnet1.neo.coz.io:443'; + this.options.scriptHash = '0x97857c01d64f846b5fe2eca2d09d2d73928b3f43'; + break; + case interface_1.NetworkOption.MainNet: + this.options.node = 'https://mainnet1.neo.coz.io:443'; + this.options.scriptHash = '0x76a8f8a7a901b29a33013b469949f4b08db15756'; + break; + default: + this.options.node = 'http://127.0.0.1:50012'; + this.options.scriptHash = '0x374fc3ca866761a01082186c71a6301d4ba2a363'; + break; + } + this.options = (0, lodash_1.merge)({}, this.options, options); + } + async init() { + const getVersionRes = await this.node.getVersion(); + this.networkMagic = getVersionRes.protocol.network; + } + get node() { + if (this.options.node) { + return new neon_core_1.rpc.RPCClient(this.options.node); + } + throw new Error('no node selected!'); + } + get scriptHash() { + if (this.options.scriptHash) { + return this.options.scriptHash; + } + throw new Error('node scripthash defined'); + } + async balanceOf(address, signer) { + return api_1.GiftAPI.balanceOf(this.node.url, this.networkMagic, this.scriptHash, address, signer); + } + async createEpoch(label, generatorInstanceId, initialRollCollectionId, mintFee, sysFee, maxSupply, signer) { + return api_1.GiftAPI.createEpoch(this.node.url, this.networkMagic, this.scriptHash, label, generatorInstanceId, initialRollCollectionId, mintFee, sysFee, maxSupply, signer); + } + async decimals(signer) { + return api_1.GiftAPI.decimals(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async deploy(signer) { + return api_1.GiftAPI.deploy(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async getEpochJSON(epochId, signer) { + return api_1.GiftAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId, signer); + } + async getTokenJSON(tokenId, signer) { + return api_1.GiftAPI.getTokenJSON(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer); + } + async getTokenRaw(tokenId, signer) { + return api_1.GiftAPI.getTokenRaw(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer); + } + async ownerOf(tokenId, signer) { + return api_1.GiftAPI.ownerOf(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer); + } + async offlineMint(epochId, owner, signer) { + return api_1.GiftAPI.offlineMint(this.node.url, this.networkMagic, this.scriptHash, epochId, owner, signer); + } + async properties(tokenId, signer) { + return api_1.GiftAPI.properties(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer); + } + async purchase(epochId, signer) { + const method = "transfer"; + const GASScriptHash = "0xd2a4cff31913016155e38e474a2c06d08be276cf"; + const epoch = await api_1.GiftAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId); + const EpochTyped = epoch; + if (EpochTyped.totalSupply === EpochTyped.maxSupply) { + throw new Error(`Epoch is out of Tokens: ${EpochTyped.totalSupply} / ${EpochTyped.maxSupply}`); + } + const purchasePrice = EpochTyped.mintFee; + const params = [ + neon_js_1.sc.ContractParam.hash160(signer.address), + neon_js_1.sc.ContractParam.hash160(this.scriptHash), + neon_js_1.sc.ContractParam.integer(purchasePrice), + neon_js_1.sc.ContractParam.integer(epochId) + ]; + try { + return await api_1.NeoInterface.publishInvoke(this.node.url, this.networkMagic, GASScriptHash, method, params, signer); + } + catch (e) { + throw new Error("Something went wrong: " + e.message); + } + } + async setMintFee(epochId, fee, signer) { + return api_1.GiftAPI.setMintFee(this.node.url, this.networkMagic, this.scriptHash, epochId, fee, signer); + } + async symbol(signer) { + return api_1.GiftAPI.symbol(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async tokens(signer) { + return api_1.GiftAPI.tokens(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async tokensOf(address, signer) { + return api_1.GiftAPI.tokensOf(this.node.url, this.networkMagic, this.scriptHash, address, signer); + } + async totalAccounts(signer) { + return api_1.GiftAPI.totalAccounts(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async totalEpochs(signer) { + return api_1.GiftAPI.totalEpochs(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async totalSupply(signer) { + return api_1.GiftAPI.totalSupply(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async transfer(to, tokenId, signer, data) { + return api_1.GiftAPI.transfer(this.node.url, this.networkMagic, this.scriptHash, to, tokenId, signer, data); + } + async update(script, manifest, signer) { + return api_1.GiftAPI.update(this.node.url, this.networkMagic, this.scriptHash, script, manifest, '', signer); + } +} +exports.Gift = Gift; +//# sourceMappingURL=Gift.js.map \ No newline at end of file diff --git a/sdk/dist/Gift.js.map b/sdk/dist/Gift.js.map new file mode 100644 index 0000000..52d7bbf --- /dev/null +++ b/sdk/dist/Gift.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Gift.js","sourceRoot":"","sources":["../src/Gift.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,qDAAiD;AACjD,+BAA2C;AAC3C,iDAAuC;AACvC,2CAAuF;AAEvF,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED,MAAa,IAAI;IAIf,YAAY,UAAkC,EAAE;QAHxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAG/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP;gBACE,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,wBAAwB,CAAA;gBAC5C,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;SACR;QACD,IAAI,CAAC,OAAO,GAAG,IAAA,cAAK,EAAC,EAAE,EAAE,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A;IACzF,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,MAAuB;QACvC,OAAO,aAAO,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACvF,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,MAAuB;QACvC,OAAO,aAAO,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACvF,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,OAAe,EAAE,MAAsB,EAAE,IAAS;QAC3E,OAAO,aAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;IACtG,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,QAAgB,EAAE,MAAsB;QACnE,OAAO,aAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;IACxG,CAAC;CAEF;AApJD,oBAoJC"} \ No newline at end of file diff --git a/sdk/dist/Puppet.d.ts b/sdk/dist/Puppet.d.ts new file mode 100644 index 0000000..632f84d --- /dev/null +++ b/sdk/dist/Puppet.d.ts @@ -0,0 +1,31 @@ +import { rpc, wallet } from '@cityofzion/neon-core'; +import { EpochType, PropConstructorOptions, PuppetType } from "./interface"; +export declare class Puppet { + private options; + private networkMagic; + constructor(options?: PropConstructorOptions); + init(): Promise; + get node(): rpc.RPCClient; + get scriptHash(): string; + balanceOf(address: string, signer?: wallet.Account): Promise; + createEpoch(label: string, generatorInstanceId: number, initialRollCollectionId: number, mintFee: number, sysFee: number, maxSupply: number, signer: wallet.Account): Promise; + decimals(signer?: wallet.Account): Promise; + deploy(signer: wallet.Account): Promise; + getAttributeMod(attributeValue: number, signer?: wallet.Account): Promise; + getEpochJSON(epochId: number, signer?: wallet.Account): Promise; + getPuppetJSON(tokenId: string, signer?: wallet.Account): Promise; + getPuppetRaw(tokenId: string, signer?: wallet.Account): Promise; + ownerOf(tokenId: string, signer?: wallet.Account): Promise; + offlineMint(epochId: number, owner: string, signer: wallet.Account): Promise; + properties(tokenId: string, signer?: wallet.Account): Promise; + purchase(epochId: number, signer: wallet.Account): Promise; + setMintFee(epochId: number, fee: number, signer: wallet.Account): Promise; + symbol(signer?: wallet.Account): Promise; + tokens(signer?: wallet.Account): Promise; + tokensOf(address: string, signer?: wallet.Account): Promise; + totalAccounts(signer?: wallet.Account): Promise; + totalEpochs(signer?: wallet.Account): Promise; + totalSupply(signer?: wallet.Account): Promise; + transfer(to: string, tokenId: string, signer: wallet.Account, data: any): Promise; + update(script: string, manifest: string, signer: wallet.Account): Promise; +} diff --git a/sdk/dist/Puppet.js b/sdk/dist/Puppet.js new file mode 100644 index 0000000..7c5a866 --- /dev/null +++ b/sdk/dist/Puppet.js @@ -0,0 +1,132 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Puppet = void 0; +const lodash_1 = require("lodash"); +const neon_core_1 = require("@cityofzion/neon-core"); +const api_1 = require("./api"); +const neon_js_1 = require("@cityofzion/neon-js"); +const interface_1 = require("./interface"); +const DEFAULT_OPTIONS = { + network: interface_1.NetworkOption.LocalNet +}; +class Puppet { + constructor(options = {}) { + this.options = DEFAULT_OPTIONS; + this.networkMagic = -1; + switch (options.network) { + case interface_1.NetworkOption.TestNet: + this.options.node = 'https://testnet1.neo.coz.io:443'; + this.options.scriptHash = '0x97857c01d64f846b5fe2eca2d09d2d73928b3f43'; + break; + case interface_1.NetworkOption.MainNet: + this.options.node = 'https://mainnet1.neo.coz.io:443'; + this.options.scriptHash = '0x76a8f8a7a901b29a33013b469949f4b08db15756'; + break; + default: + this.options.node = 'http://127.0.0.1:50012'; + this.options.scriptHash = '0xfefe63f07478394fbe514fda386ad8c7e2a485a0'; + break; + } + this.options = (0, lodash_1.merge)({}, this.options, options); + } + async init() { + const getVersionRes = await this.node.getVersion(); + this.networkMagic = getVersionRes.protocol.network; + } + get node() { + if (this.options.node) { + return new neon_core_1.rpc.RPCClient(this.options.node); + } + throw new Error('no node selected!'); + } + get scriptHash() { + if (this.options.scriptHash) { + return this.options.scriptHash; + } + throw new Error('node scripthash defined'); + } + async balanceOf(address, signer) { + return api_1.PuppetAPI.balanceOf(this.node.url, this.networkMagic, this.scriptHash, address, signer); + } + async createEpoch(label, generatorInstanceId, initialRollCollectionId, mintFee, sysFee, maxSupply, signer) { + return api_1.PuppetAPI.createEpoch(this.node.url, this.networkMagic, this.scriptHash, label, generatorInstanceId, initialRollCollectionId, mintFee, sysFee, maxSupply, signer); + } + async decimals(signer) { + return api_1.PuppetAPI.decimals(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async deploy(signer) { + return api_1.PuppetAPI.deploy(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async getAttributeMod(attributeValue, signer) { + return api_1.PuppetAPI.getAttributeMod(this.node.url, this.networkMagic, this.scriptHash, attributeValue, signer); + } + async getEpochJSON(epochId, signer) { + return api_1.PuppetAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId, signer); + } + async getPuppetJSON(tokenId, signer) { + return api_1.PuppetAPI.getPuppetJSON(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer); + } + async getPuppetRaw(tokenId, signer) { + return api_1.PuppetAPI.getPuppetRaw(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer); + } + async ownerOf(tokenId, signer) { + return api_1.PuppetAPI.ownerOf(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer); + } + async offlineMint(epochId, owner, signer) { + return api_1.PuppetAPI.offlineMint(this.node.url, this.networkMagic, this.scriptHash, epochId, owner, signer); + } + async properties(tokenId, signer) { + return api_1.PuppetAPI.properties(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer); + } + async purchase(epochId, signer) { + const method = "transfer"; + const GASScriptHash = "0xd2a4cff31913016155e38e474a2c06d08be276cf"; + const epoch = await api_1.PuppetAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId); + const EpochTyped = epoch; + if (EpochTyped.totalSupply === EpochTyped.maxSupply) { + throw new Error(`Epoch is out of Puppets: ${EpochTyped.totalSupply} / ${EpochTyped.maxSupply}`); + } + const purchasePrice = EpochTyped.mintFee; + const params = [ + neon_js_1.sc.ContractParam.hash160(signer.address), + neon_js_1.sc.ContractParam.hash160(this.scriptHash), + neon_js_1.sc.ContractParam.integer(purchasePrice), + neon_js_1.sc.ContractParam.integer(epochId) + ]; + try { + return await api_1.NeoInterface.publishInvoke(this.node.url, this.networkMagic, GASScriptHash, method, params, signer); + } + catch (e) { + throw new Error("Something went wrong: " + e.message); + } + } + async setMintFee(epochId, fee, signer) { + return api_1.PuppetAPI.setMintFee(this.node.url, this.networkMagic, this.scriptHash, epochId, fee, signer); + } + async symbol(signer) { + return api_1.PuppetAPI.symbol(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async tokens(signer) { + return api_1.PuppetAPI.tokens(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async tokensOf(address, signer) { + return api_1.PuppetAPI.tokensOf(this.node.url, this.networkMagic, this.scriptHash, address, signer); + } + async totalAccounts(signer) { + return api_1.PuppetAPI.totalAccounts(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async totalEpochs(signer) { + return api_1.PuppetAPI.totalEpochs(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async totalSupply(signer) { + return api_1.PuppetAPI.totalSupply(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async transfer(to, tokenId, signer, data) { + return api_1.PuppetAPI.transfer(this.node.url, this.networkMagic, this.scriptHash, to, tokenId, signer, data); + } + async update(script, manifest, signer) { + return api_1.PuppetAPI.update(this.node.url, this.networkMagic, this.scriptHash, script, manifest, '', signer); + } +} +exports.Puppet = Puppet; +//# sourceMappingURL=Puppet.js.map \ No newline at end of file diff --git a/sdk/dist/Puppet.js.map b/sdk/dist/Puppet.js.map new file mode 100644 index 0000000..1f3ba4d --- /dev/null +++ b/sdk/dist/Puppet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Puppet.js","sourceRoot":"","sources":["../src/Puppet.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,qDAAiD;AACjD,+BAA6C;AAC7C,iDAAuC;AACvC,2CAAyF;AAEzF,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED,MAAa,MAAM;IAIjB,YAAY,UAAkC,EAAE;QAHxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAG/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP;gBACE,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,wBAAwB,CAAA;gBAC5C,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;SACR;QACD,IAAI,CAAC,OAAO,GAAG,IAAA,cAAK,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACjD,CA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CAAC,aAAa,CAAC,MAAuB;QACzC,OAAO,eAAS,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IAC3F,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,MAAuB;QACvC,OAAO,eAAS,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACzF,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,MAAuB;QACvC,OAAO,eAAS,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACzF,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,OAAe,EAAE,MAAsB,EAAE,IAAS;QAC3E,OAAO,eAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;IACxG,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,QAAgB,EAAE,MAAsB;QACnE,OAAO,eAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;IAC1G,CAAC;CAEF;AAxJD,wBAwJC"} \ No newline at end of file diff --git a/sdk/dist/Template.d.ts b/sdk/dist/Template.d.ts new file mode 100644 index 0000000..16dae7d --- /dev/null +++ b/sdk/dist/Template.d.ts @@ -0,0 +1,37 @@ +import { rpc, wallet } from '@cityofzion/neon-core'; +import { PropConstructorOptions } from "./interface"; +/** + TEMPLATE CONTRACT CLASS + Use this class template to build out the typescript interface for your smart contract. If you rename this or the + `api` equivalent, make sure to update the respective `index.ts` and rebuild. + */ +export declare class Template { + private options; + private networkMagic; + constructor(options?: PropConstructorOptions); + /** + * DO NOT EDIT ME + * Gets the magic number for the network and configures the class instance. + */ + init(): Promise; + /** + * DO NOT EDIT ME + * The the node that the instance is connected to. + */ + get node(): rpc.RPCClient; + /** + * DO NOT EDIT ME + * The contract script hash that is being interfaced with. + */ + get scriptHash(): string; + /** + * + * EDIT ME!!! + * + * This template method is designed to be a passthough so you should really only be changing the name and parameter types. + * All the magic happens in the TemplateAPI.templateMethod. Check there to align your sdk with your smart contract. + * Create one of these pass throughs for each method you expose in your smart contract. The goal of this entire class is to + * simplify the network configuration steps which can be complicated. + */ + templateMethod(paramA: string, paramB: number, paramC: string, paramD: boolean, paramE: string[], signer?: wallet.Account): Promise; +} diff --git a/sdk/dist/Template.js b/sdk/dist/Template.js new file mode 100644 index 0000000..e8f3e27 --- /dev/null +++ b/sdk/dist/Template.js @@ -0,0 +1,81 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Template = void 0; +const lodash_1 = require("lodash"); +const neon_core_1 = require("@cityofzion/neon-core"); +const api_1 = require("./api"); +const interface_1 = require("./interface"); +const DEFAULT_OPTIONS = { + network: interface_1.NetworkOption.LocalNet +}; +/** + TEMPLATE CONTRACT CLASS + Use this class template to build out the typescript interface for your smart contract. If you rename this or the + `api` equivalent, make sure to update the respective `index.ts` and rebuild. + */ +class Template { + // Once you get a scriptHash from deploying your smart contract via `npm run deploy`, update the `this.options.scriptHash` value. + // The default is analogous to localnet (neo-express) so you will most likely want to be updating that value. Remember to + // compile the sdk before use or your change wont take effect. Do that by running `tsc` in the sdk directory. + constructor(options = {}) { + this.options = DEFAULT_OPTIONS; + this.networkMagic = -1; + switch (options.network) { + case interface_1.NetworkOption.TestNet: + this.options.node = 'https://testnet1.neo.coz.io:443'; + this.options.scriptHash = '0x4380f2c1de98bb267d3ea821897ec571a04fe3e0'; + break; + case interface_1.NetworkOption.MainNet: + this.options.node = 'https://mainnet1.neo.coz.io:443'; + this.options.scriptHash = '0x4380f2c1de98bb267d3ea821897ec571a04fe3e0'; + break; + default: + this.options.node = 'http://127.0.0.1:50012'; + this.options.scriptHash = '0x16d6a0be0506b26e0826dd352724cda0defa7131'; + break; + } + this.options = (0, lodash_1.merge)({}, this.options, options); + } + /** + * DO NOT EDIT ME + * Gets the magic number for the network and configures the class instance. + */ + async init() { + const getVersionRes = await this.node.getVersion(); + this.networkMagic = getVersionRes.protocol.network; + } + /** + * DO NOT EDIT ME + * The the node that the instance is connected to. + */ + get node() { + if (this.options.node) { + return new neon_core_1.rpc.RPCClient(this.options.node); + } + throw new Error('no node selected!'); + } + /** + * DO NOT EDIT ME + * The contract script hash that is being interfaced with. + */ + get scriptHash() { + if (this.options.scriptHash) { + return this.options.scriptHash; + } + throw new Error('node scripthash defined'); + } + /** + * + * EDIT ME!!! + * + * This template method is designed to be a passthough so you should really only be changing the name and parameter types. + * All the magic happens in the TemplateAPI.templateMethod. Check there to align your sdk with your smart contract. + * Create one of these pass throughs for each method you expose in your smart contract. The goal of this entire class is to + * simplify the network configuration steps which can be complicated. + */ + async templateMethod(paramA, paramB, paramC, paramD, paramE, signer) { + return api_1.TemplateAPI.templateMethod(this.node.url, this.networkMagic, this.scriptHash, paramA, paramB, paramC, paramD, paramE, signer); + } +} +exports.Template = Template; +//# sourceMappingURL=Template.js.map \ No newline at end of file diff --git a/sdk/dist/Template.js.map b/sdk/dist/Template.js.map new file mode 100644 index 0000000..405a20d --- /dev/null +++ b/sdk/dist/Template.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Template.js","sourceRoot":"","sources":["../src/Template.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,qDAAiD;AACjD,+BAAiC;AACjC,2CAAkE;AAElE,MAAM,eAAe,GAA2B;IAC9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IACtC,CAAC;IAED;;;OAGG;IACH,IAAI,UAAU;QACZ,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAA;SAC/B;QACD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC5C,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,cAAc,CAAC,MAAc,EAAE,MAAc,EAAE,MAAc,EAAE,MAAe,EAAE,MAAgB,EAAE,MAAuB;QAC7H,OAAO,iBAAW,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACtI,CAAC;CAIF;AAvED,4BAuEC"} \ No newline at end of file diff --git a/sdk/dist/api/chest.d.ts b/sdk/dist/api/chest.d.ts new file mode 100644 index 0000000..cda519c --- /dev/null +++ b/sdk/dist/api/chest.d.ts @@ -0,0 +1,10 @@ +import { wallet } from "@cityofzion/neon-core"; +import { EligibilityCase } from "../interface"; +export declare class ChestAPI { + static createChest(node: string, networkMagic: number, contractHash: string, name: string, chestType: number, eligibilityCases: [EligibilityCase], signer: wallet.Account): Promise; + static isEligible(node: string, networkMagic: number, contractHash: string, chestId: number, nftSriptHash: string, tokenId: string, signer?: wallet.Account): Promise; + static lootChest(node: string, networkMagic: number, contractHash: string, chestId: number, nftScriptHash: string, tokenId: string, signer: wallet.Account): Promise; + static lootChestAsOwner(node: string, networkMagic: number, contractHash: string, chestId: number, signer: wallet.Account): Promise; + static getChestJSON(node: string, networkMagic: number, contractHash: string, chestId: number, signer?: wallet.Account): Promise; + static totalChests(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; +} diff --git a/sdk/dist/api/chest.js b/sdk/dist/api/chest.js new file mode 100644 index 0000000..15ef8d4 --- /dev/null +++ b/sdk/dist/api/chest.js @@ -0,0 +1,90 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ChestAPI = void 0; +const neon_js_1 = require("@cityofzion/neon-js"); +const neon_core_1 = require("@cityofzion/neon-core"); +const helpers_1 = require("../helpers"); +class ChestAPI { + static async createChest(node, networkMagic, contractHash, name, chestType, eligibilityCases, signer) { + const method = "create_chest"; + const cases = eligibilityCases.map((eligibilityCase) => { + const attributes = eligibilityCase.attributes.map((attr) => { + return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.string(attr.logic), neon_js_1.sc.ContractParam.string(attr.key), neon_js_1.sc.ContractParam.string(attr.value)); + }); + return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.hash160(eligibilityCase.scriptHash), neon_js_1.sc.ContractParam.array(...attributes)); + }); + const param = [ + neon_js_1.sc.ContractParam.string(name), + neon_js_1.sc.ContractParam.integer(chestType), + neon_js_1.sc.ContractParam.array(...cases), + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } + static async isEligible(node, networkMagic, contractHash, chestId, nftSriptHash, tokenId, signer) { + const method = "is_eligible"; + const param = [ + neon_js_1.sc.ContractParam.integer(chestId), + neon_js_1.sc.ContractParam.hash160(nftSriptHash), + neon_js_1.sc.ContractParam.string(tokenId) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } + //TODO - Verify + static async lootChest(node, networkMagic, contractHash, chestId, nftScriptHash, tokenId, signer) { + const method = "loot_chest"; + const param = [ + neon_js_1.sc.ContractParam.integer(chestId), + neon_js_1.sc.ContractParam.hash160(nftScriptHash), + neon_js_1.sc.ContractParam.string(tokenId) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } + //TODO - Verify + static async lootChestAsOwner(node, networkMagic, contractHash, chestId, signer) { + const method = "loot_chest_as_owner"; + const param = [ + neon_js_1.sc.ContractParam.integer(chestId), + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } + static async getChestJSON(node, networkMagic, contractHash, chestId, signer) { + const method = "get_chest_json"; + const param = [ + neon_js_1.sc.ContractParam.integer(chestId), + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + let formattedRes = (0, helpers_1.formatter)(res[0]); + const author = neon_core_1.u.reverseHex(neon_core_1.u.str2hexstring(formattedRes.author)); + formattedRes.author = new neon_core_1.wallet.Account(author); + return formattedRes; + } + static async totalChests(node, networkMagic, contractHash, signer) { + const method = "total_chests"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } +} +exports.ChestAPI = ChestAPI; +//# sourceMappingURL=chest.js.map \ No newline at end of file diff --git a/sdk/dist/api/chest.js.map b/sdk/dist/api/chest.js.map new file mode 100644 index 0000000..8e7e88e --- /dev/null +++ b/sdk/dist/api/chest.js.map @@ -0,0 +1 @@ +{"version":3,"file":"chest.js","sourceRoot":"","sources":["../../src/api/chest.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AACvC,qDAAgD;AAChD,wCAAqD;AAGrD,MAAa,QAAQ;IAEnB,MAAM,CAAC,KAAK,CAAC,WAAW,CACtB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,IAAY,EACZ,SAAiB,EACjB,gBAAmC,EACnC,MAAsB;QAEtB,MAAM,MAAM,GAAG,cAAc,CAAC;QAE9B,MAAM,KAAK,GAAG,gBAAgB,CAAC,GAAG,CAAE,CAAC,eAAgC,EAAE,EAAE;YAEvE,MAAM,UAAU,GAAG,eAAe,CAA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,CAAA;QACtF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;CAEF;AArJD,4BAqJC"} \ No newline at end of file diff --git a/sdk/dist/api/collection.d.ts b/sdk/dist/api/collection.d.ts new file mode 100644 index 0000000..f463b7d --- /dev/null +++ b/sdk/dist/api/collection.d.ts @@ -0,0 +1,17 @@ +import { wallet } from "@cityofzion/neon-core"; +import { CollectionType } from "../interface"; +import { ContractParamLike } from "@cityofzion/neon-core/lib/sc"; +export declare class CollectionAPI { + static createCollection(node: string, networkMagic: number, contractHash: string, description: string, collection_type: string, extra: any, values: string[], signer: wallet.Account): Promise; + static createCollectionRaw(node: string, networkMagic: number, contractHash: string, description: string, collection_type: string, extra: any, values: ContractParamLike[], signer: wallet.Account): Promise; + static getCollectionJSON(node: string, networkMagic: number, contractHash: string, collectionId: number, signer?: wallet.Account): Promise; + static getCollection(node: string, networkMagic: number, contractHash: string, collectionId: number, signer?: wallet.Account): Promise; + static getCollectionElement(node: string, networkMagic: number, contractHash: string, collectionId: number, index: number, signer?: wallet.Account): Promise; + static getCollectionLength(node: string, networkMagic: number, contractHash: string, collectionId: number, signer?: wallet.Account): Promise; + static getCollectionValues(node: string, networkMagic: number, contractHash: string, collectionId: number, signer?: wallet.Account): Promise; + static mapBytesOntoCollection(node: string, networkMagic: number, contractHash: string, collectionId: number, entropy: string, signer?: wallet.Account): Promise; + static sampleFromCollection(node: string, networkMagic: number, contractHash: string, collectionId: number, samples: number, signer?: wallet.Account): Promise; + static sampleFromRuntimeCollection(node: string, networkMagic: number, contractHash: string, values: string[], samples: number, pick: boolean, signer: wallet.Account): Promise; + static totalCollections(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + static update(node: string, networkMagic: number, contractHash: string, script: string, manifest: string, data: any, signer: wallet.Account): Promise; +} diff --git a/sdk/dist/api/collection.js b/sdk/dist/api/collection.js new file mode 100644 index 0000000..8111970 --- /dev/null +++ b/sdk/dist/api/collection.js @@ -0,0 +1,202 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CollectionAPI = void 0; +const neon_js_1 = require("@cityofzion/neon-js"); +const neon_core_1 = require("@cityofzion/neon-core"); +const helpers_1 = require("../helpers"); +class CollectionAPI { + static async createCollection(node, networkMagic, contractHash, description, collection_type, extra, values, signer) { + const method = "create_collection"; + const raw_traits = values.map((value) => { + return neon_js_1.sc.ContractParam.string(value); + }); + const param = [ + neon_js_1.sc.ContractParam.string(description), + neon_js_1.sc.ContractParam.string(collection_type), + neon_js_1.sc.ContractParam.string(extra), + neon_js_1.sc.ContractParam.array(...raw_traits) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return neon_js_1.u.base642hex(res[0].value); + } + static async createCollectionRaw(node, networkMagic, contractHash, description, collection_type, extra, values, signer) { + const method = "create_collection"; + const param = [ + neon_js_1.sc.ContractParam.string(description), + neon_js_1.sc.ContractParam.string(collection_type), + neon_js_1.sc.ContractParam.string(extra), + neon_js_1.sc.ContractParam.array(...values) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return neon_js_1.u.base642hex(res[0].value); + } + static async getCollectionJSON(node, networkMagic, contractHash, collectionId, signer) { + const method = "get_collection_json"; + const param = [ + neon_js_1.sc.ContractParam.integer(collectionId) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + const result = {}; + if (res[0] && res[0].value) { + res[0].value.forEach((entry) => { + let key = neon_js_1.u.hexstring2str(neon_js_1.u.base642hex(entry.key.value)); + let bytes; + switch (key) { + case "id": + bytes = neon_js_1.u.base642hex(entry.value.value); + result.id = parseInt(bytes, 16); + break; + case "author": + bytes = neon_js_1.u.base642hex(entry.value.value); + result.author = new neon_core_1.wallet.Account(bytes); + break; + case "type": + result.type = neon_js_1.u.hexstring2str(neon_js_1.u.base642hex(entry.value.value)); + break; + case "description": + result.description = neon_js_1.u.hexstring2str(neon_js_1.u.base642hex(entry.value.value)); + break; + case "values": + result.valuesRaw = entry.value.value; + break; + } + }); + } + switch (result.type) { + case "string": + result.values = result.valuesRaw.map((value) => { + return (0, helpers_1.formatter)(value); + }); + break; + case "int": + result.values = result.valuesRaw.map((value) => { + let bytes = (0, helpers_1.formatter)(value); + return parseInt(bytes, 16); + }); + break; + } + return result; + } + static async getCollection(node, networkMagic, contractHash, collectionId, signer) { + const method = "get_collection"; + const param = [ + neon_js_1.sc.ContractParam.integer(collectionId) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return neon_js_1.u.base642hex(res[0].value); + } + static async getCollectionElement(node, networkMagic, contractHash, collectionId, index, signer) { + const method = "get_collection_element"; + const param = [ + neon_js_1.sc.ContractParam.integer(collectionId), + neon_js_1.sc.ContractParam.integer(index) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return neon_js_1.u.base642hex(res[0].value); + } + static async getCollectionLength(node, networkMagic, contractHash, collectionId, signer) { + const method = "get_collection_length"; + const param = [ + neon_js_1.sc.ContractParam.integer(collectionId) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + static async getCollectionValues(node, networkMagic, contractHash, collectionId, signer) { + const method = "get_collection_values"; + const param = [ + neon_js_1.sc.ContractParam.integer(collectionId) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return res[0].value.map((value) => { + return neon_js_1.u.base642hex(value.value); + }); + } + static async mapBytesOntoCollection(node, networkMagic, contractHash, collectionId, entropy, signer) { + const method = "map_bytes_onto_collection"; + const param = [ + neon_js_1.sc.ContractParam.integer(collectionId), + neon_js_1.sc.ContractParam.string(entropy) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return neon_js_1.u.base642hex(res[0].value); + } + static async sampleFromCollection(node, networkMagic, contractHash, collectionId, samples, signer) { + const method = "sample_from_collection"; + const param = [ + neon_js_1.sc.ContractParam.integer(collectionId), + neon_js_1.sc.ContractParam.integer(samples) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return neon_js_1.u.base642hex(res[0].value); + } + static async sampleFromRuntimeCollection(node, networkMagic, contractHash, values, samples, pick, signer) { + const method = "sample_from_runtime_collection"; + const raw_values = values.map((value) => { + return neon_js_1.sc.ContractParam.string(value); + }); + const param = [ + neon_js_1.sc.ContractParam.array(...raw_values), + neon_js_1.sc.ContractParam.integer(samples), + neon_js_1.sc.ContractParam.boolean(pick) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return neon_js_1.u.base642hex(res[0].value); + } + static async totalCollections(node, networkMagic, contractHash, signer) { + const method = "total_collections"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + if (res === undefined || res.length === 0) { + throw new Error("unrecognized response"); + } + return parseInt(res[0].value); + } + static async update(node, networkMagic, contractHash, script, manifest, data, signer) { + const method = "update"; + const params = [ + neon_js_1.sc.ContractParam.byteArray(script), + neon_js_1.sc.ContractParam.string(manifest), + neon_js_1.sc.ContractParam.any(data) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res); + } +} +exports.CollectionAPI = CollectionAPI; +//# sourceMappingURL=collection.js.map \ No newline at end of file diff --git a/sdk/dist/api/collection.js.map b/sdk/dist/api/collection.js.map new file mode 100644 index 0000000..b9caff8 --- /dev/null +++ b/sdk/dist/api/collection.js.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ACZ,YAAoB,EACpB,YAAoB,EACpB,MAAc,EACd,QAAgB,EAChB,IAAS,EACT,MAAsB;QAEtB,MAAM,MAAM,GAAG,QAAQ,CAAC;QACxB,MAAM,MAAM,GAAG;YACb,YAAE,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC;YAClC,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC;YACjC,YAAE,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC;SAC3B,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QAC1F,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC;IACxB,CAAC;CAEF;AA/SD,sCA+SC"} \ No newline at end of file diff --git a/sdk/dist/api/dice.d.ts b/sdk/dist/api/dice.d.ts new file mode 100644 index 0000000..8b17c4e --- /dev/null +++ b/sdk/dist/api/dice.d.ts @@ -0,0 +1,7 @@ +import { wallet } from "@cityofzion/neon-core"; +export declare class DiceAPI { + static rollDie(node: string, networkMagic: number, contractHash: string, die: string, signer?: wallet.Account): Promise; + static rollDiceWithEntropy(node: string, networkMagic: number, contractHash: string, die: string, precision: number, entropy: string, signer?: wallet.Account): Promise; + static randBetween(node: string, networkMagic: number, contractHash: string, start: number, end: number, signer?: wallet.Account): Promise; + static mapBytesOntoRange(node: string, networkMagic: number, contractHash: string, start: number, end: number, entropy: string, signer?: wallet.Account): Promise; +} diff --git a/sdk/dist/api/dice.js b/sdk/dist/api/dice.js new file mode 100644 index 0000000..85612f7 --- /dev/null +++ b/sdk/dist/api/dice.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DiceAPI = void 0; +const neon_js_1 = require("@cityofzion/neon-js"); +const helpers_1 = require("../helpers"); +class DiceAPI { + static async rollDie(node, networkMagic, contractHash, die, signer) { + const method = "roll_die"; + const param = [ + neon_js_1.sc.ContractParam.string(die) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + static async rollDiceWithEntropy(node, networkMagic, contractHash, die, precision, entropy, signer) { + const method = "roll_dice_with_entropy"; + const param = [ + neon_js_1.sc.ContractParam.string(die), + neon_js_1.sc.ContractParam.integer(precision), + neon_js_1.sc.ContractParam.string(entropy) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return [parseInt(res[0].value)]; + } + static async randBetween(node, networkMagic, contractHash, start, end, signer) { + const method = "rand_between"; + const param = [ + neon_js_1.sc.ContractParam.integer(start), + neon_js_1.sc.ContractParam.integer(end) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + static async mapBytesOntoRange(node, networkMagic, contractHash, start, end, entropy, signer) { + const method = "map_bytes_onto_range"; + const param = [ + neon_js_1.sc.ContractParam.integer(start), + neon_js_1.sc.ContractParam.integer(end), + neon_js_1.sc.ContractParam.string(entropy) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } +} +exports.DiceAPI = DiceAPI; +//# sourceMappingURL=dice.js.map \ No newline at end of file diff --git a/sdk/dist/api/dice.js.map b/sdk/dist/api/dice.js.map new file mode 100644 index 0000000..7fcbc3b --- /dev/null +++ b/sdk/dist/api/dice.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dice.js","sourceRoot":"","sources":["../../src/api/dice.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AAGvC,wCAA0C;AAE1C,MAAa,OAAO;IAElB,MAAM,CAAC,KAAK,CAAC,OAAO,CAClB,IAAY,EACZ,YAAoB,EAC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,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC;YAC/B,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC;SAC9B,CAAA;QACD,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAC5B,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,KAAa,EACb,GAAW,EACX,OAAe,EACf,MAAuB;QAEvB,MAAM,MAAM,GAAG,sBAAsB,CAAC;QACtC,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC;YAC/B,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC;YAC7B,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC;SACjC,CAAA;QACD,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC;IAC1C,CAAC;CACF;AAnFD,0BAmFC"} \ No newline at end of file diff --git a/sdk/dist/api/generator.d.ts b/sdk/dist/api/generator.d.ts new file mode 100644 index 0000000..ce41e81 --- /dev/null +++ b/sdk/dist/api/generator.d.ts @@ -0,0 +1,17 @@ +import { wallet } from "@cityofzion/neon-core"; +import { GeneratorType, InstanceAccessMode, InstanceAuthorizedContracts, TraitLevel, TraitType } from "../interface"; +export declare class GeneratorAPI { + static createGenerator(node: string, networkMagic: number, contractHash: string, label: string, baseGeneratorFee: number, signer: wallet.Account): Promise; + static createInstance(node: string, networkMagic: number, contractHash: string, generatorId: number, signer: wallet.Account): Promise; + static createTrait(node: string, networkMagic: number, contractHash: string, generatorId: number, label: string, slots: number, levels: TraitLevel[], signer: wallet.Account): Promise; + static getGeneratorJSON(node: string, networkMagic: number, contractHash: string, generatorId: number, signer?: wallet.Account): Promise; + static getTraitJSON(node: string, networkMagic: number, contractHash: string, traitId: string, signer?: wallet.Account): Promise; + static getGeneratorInstanceJSON(node: string, networkMagic: number, contractHash: string, instanceId: number, signer?: wallet.Account): Promise; + static mintFromInstance(node: string, networkMagic: number, contractHash: string, instanceId: number, signer: wallet.Account): Promise; + static setInstanceAccessMode(node: string, networkMagic: number, contractHash: string, instanceId: number, accessMode: InstanceAccessMode, signer: wallet.Account): Promise; + static setInstanceAuthorizedUsers(node: string, networkMagic: number, contractHash: string, instanceId: number, authorizedUsers: string[], signer: wallet.Account): Promise; + static setInstanceAuthorizedContracts(node: string, networkMagic: number, contractHash: string, instanceId: number, authorizedContracts: InstanceAuthorizedContracts[], signer: wallet.Account): Promise; + static setInstanceFee(node: string, networkMagic: number, contractHash: string, instanceId: number, fee: number, signer: wallet.Account): Promise; + static totalGenerators(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + static totalGeneratorInstances(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; +} diff --git a/sdk/dist/api/generator.js b/sdk/dist/api/generator.js new file mode 100644 index 0000000..f7f41de --- /dev/null +++ b/sdk/dist/api/generator.js @@ -0,0 +1,153 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.GeneratorAPI = void 0; +const neon_js_1 = require("@cityofzion/neon-js"); +const interface_1 = require("../interface"); +const helpers_1 = require("../helpers"); +class GeneratorAPI { + static async createGenerator(node, networkMagic, contractHash, label, baseGeneratorFee, signer) { + const method = "create_generator"; + const param = [ + neon_js_1.sc.ContractParam.string(label), + neon_js_1.sc.ContractParam.integer(baseGeneratorFee) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + } + static async createInstance(node, networkMagic, contractHash, generatorId, signer) { + const method = "create_instance"; + const param = [ + neon_js_1.sc.ContractParam.integer(generatorId) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + } + static async createTrait(node, networkMagic, contractHash, generatorId, label, slots, levels, signer) { + const method = "create_trait"; + const traitLevelsFormatted = levels.map((traitLevel) => { + const traitPointers = traitLevel.traits.map((traitEvent) => { + switch (traitEvent.type) { + case interface_1.EventTypeEnum.CollectionPointer: + const collectionPointer = traitEvent.args; + return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.integer(traitEvent.type), neon_js_1.sc.ContractParam.integer(traitEvent.maxMint), neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.integer(collectionPointer.collectionId), neon_js_1.sc.ContractParam.integer(collectionPointer.index))); + case interface_1.EventTypeEnum.InstanceCall: + const instanceCall = traitEvent.args; + return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.integer(traitEvent.type), neon_js_1.sc.ContractParam.integer(traitEvent.maxMint), neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.hash160(instanceCall.scriptHash), neon_js_1.sc.ContractParam.string(instanceCall.method), neon_js_1.sc.ContractParam.array(...instanceCall.param))); + case interface_1.EventTypeEnum.Value: + const valueCall = traitEvent.args; + return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.integer(traitEvent.type), neon_js_1.sc.ContractParam.integer(traitEvent.maxMint), neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.byteArray(valueCall.value))); + case interface_1.EventTypeEnum.CollectionSampleFrom: + const collectionPtr = traitEvent.args; + return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.integer(traitEvent.type), neon_js_1.sc.ContractParam.integer(traitEvent.maxMint), neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.integer(collectionPtr.collectionId))); + default: + throw new Error("unrecognized trait event type"); + } + }); + return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.integer(traitLevel.dropScore), neon_js_1.sc.ContractParam.integer(traitLevel.mintMode), neon_js_1.sc.ContractParam.array(...traitPointers)); + }); + const param = [ + neon_js_1.sc.ContractParam.integer(generatorId), + neon_js_1.sc.ContractParam.string(label), + neon_js_1.sc.ContractParam.integer(slots), + neon_js_1.sc.ContractParam.array(...traitLevelsFormatted) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + } + //getGenerator + static async getGeneratorJSON(node, networkMagic, contractHash, generatorId, signer) { + const method = "get_generator_json"; + const param = [ + neon_js_1.sc.ContractParam.integer(generatorId) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } + static async getTraitJSON(node, networkMagic, contractHash, traitId, signer) { + const method = "get_trait_json"; + const param = [ + neon_js_1.sc.ContractParam.string(traitId) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } + //getGeneratorInstance + static async getGeneratorInstanceJSON(node, networkMagic, contractHash, instanceId, signer) { + const method = "get_generator_instance_json"; + const param = [ + neon_js_1.sc.ContractParam.integer(instanceId) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } + static async mintFromInstance(node, networkMagic, contractHash, instanceId, signer) { + const method = "mint_from_instance"; + const param = [ + neon_js_1.sc.ContractParam.string(''), + neon_js_1.sc.ContractParam.integer(instanceId) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + } + static async setInstanceAccessMode(node, networkMagic, contractHash, instanceId, accessMode, signer) { + const method = "set_instance_access_mode"; + const param = [ + neon_js_1.sc.ContractParam.integer(instanceId), + neon_js_1.sc.ContractParam.integer(accessMode) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + } + static async setInstanceAuthorizedUsers(node, networkMagic, contractHash, instanceId, authorizedUsers, signer) { + const method = "set_instance_authorized_users"; + const usersFormatted = authorizedUsers.map((user) => { + return neon_js_1.sc.ContractParam.hash160(user); + }); + const param = [ + neon_js_1.sc.ContractParam.integer(instanceId), + neon_js_1.sc.ContractParam.array(...usersFormatted) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + } + static async setInstanceAuthorizedContracts(node, networkMagic, contractHash, instanceId, authorizedContracts, signer) { + const method = "set_instance_authorized_contracts"; + const contractsFormatted = authorizedContracts.map((contract) => { + return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.hash160(contract.scriptHash), neon_js_1.sc.ContractParam.integer(contract.code)); + }); + const param = [ + neon_js_1.sc.ContractParam.integer(instanceId), + neon_js_1.sc.ContractParam.array(...contractsFormatted) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + } + static async setInstanceFee(node, networkMagic, contractHash, instanceId, fee, signer) { + const method = "set_instance_fee"; + const param = [ + neon_js_1.sc.ContractParam.integer(instanceId), + neon_js_1.sc.ContractParam.integer(fee) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + } + static async totalGenerators(node, networkMagic, contractHash, signer) { + const method = "total_generators"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + static async totalGeneratorInstances(node, networkMagic, contractHash, signer) { + const method = "total_generator_instances"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } +} +exports.GeneratorAPI = GeneratorAPI; +//# sourceMappingURL=generator.js.map \ No newline at end of file diff --git a/sdk/dist/api/generator.js.map b/sdk/dist/api/generator.js.map new file mode 100644 index 0000000..0b42252 --- /dev/null +++ b/sdk/dist/api/generator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/api/generator.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AAEvC,4CAWsB;AACtB,wCAAqD;AAErD,MAAa,YAAY;IAEvB,MAAM,CAAC,KAAK,CAAC,eAAe,CAC1B,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,KAAa,EACb,gBAAwB,EACxB,MAAsB;QAEtB,MAAM,MAAM,GAAG,kBAAkB,CAAC;QAElC,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;YAC9B,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,gBAAgB,CAAC;SAC3C,CAAA;QAED,OAAO,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IACtF,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,cAAc,CACzB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,WAAmB,EACnB,MAAsB;QAEtB,MAAM,MAAM,GAAG,iBAAiB,CAAC;QAEjC,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC;SACtC,CAAA;QAED,OAAO,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IACtF,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,WAAW,CACtB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,WAAmB,EACnB,KAAa,EACb,KAAa,EACb,MAAoB,EACpB,MAAsB;QAEtB,MA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AC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;QACtF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC;IAC1C,CAAC;CACF;AAjTD,oCAiTC"} \ No newline at end of file diff --git a/sdk/dist/api/gift.d.ts b/sdk/dist/api/gift.d.ts new file mode 100644 index 0000000..769f4de --- /dev/null +++ b/sdk/dist/api/gift.d.ts @@ -0,0 +1,108 @@ +import { wallet } from "@cityofzion/neon-core"; +import { EpochType, GiftType } from "../interface"; +export declare class GiftAPI { + /** + * Returns the balance of an account + * @param node + * @param networkMagic + * @param contractHash + * @param address + * @param signer + */ + static balanceOf(node: string, networkMagic: number, contractHash: string, address: string, signer?: wallet.Account): Promise; + static createEpoch(node: string, networkMagic: number, contractHash: string, label: string, generatorInstanceId: number, initialRollCollectionId: number, mintFee: number, sysFee: number, maxSupply: number, signer: wallet.Account): Promise; + /** + * Returns the decimals of the token + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static decimals(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + /** + * Initializes the smart contract on first deployment (REQUIRED) + * @param node + * @param networkMagic + * @param contractHash + * @param signer The signing account, which will become the first admin if upgrade == false + */ + static deploy(node: string, networkMagic: number, contractHash: string, signer: wallet.Account): Promise; + static getTokenJSON(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; + static getTokenJSONFlat(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; + static getTokenRaw(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; + /** + * Gets the owner account of a tokenId + * @param node + * @param networkMagic + * @param contractHash + * @param tokenId The tokenId to return the owner of + * @param signer + */ + static ownerOf(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; + static offlineMint(node: string, networkMagic: number, contractHash: string, epochId: number, owner: string, signer: wallet.Account): Promise; + /** + * Gets the properties of a token + * @param node + * @param networkMagic + * @param contractHash + * @param tokenId The tokenId of the token being requested + * @param signer An optional signer. Populating this value will publish a transaction and return a txid + */ + static properties(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; + static setMintFee(node: string, networkMagic: number, contractHash: string, epochId: number, fee: number, signer: wallet.Account): Promise; + /** + * Returns the token symbol + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static symbol(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + /** + * Gets and array of strings(tokenIds) representing all the tokens associated with the contract + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static tokens(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + /** + * Gets an array of strings(tokenId) owned by an address + * @param node + * @param networkMagic + * @param contractHash + * @param address The string formatted address of an account + * @param signer + */ + static tokensOf(node: string, networkMagic: number, contractHash: string, address: string, signer?: wallet.Account): Promise; + /** + * Gets the total number of accounts stored in the contract + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static totalAccounts(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + static totalEpochs(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + /** + * Returns the total supply of the token + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static totalSupply(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + /** + * Transfers a token to another account + * @param node + * @param networkMagic + * @param contractHash + * @param toAddress + * @param tokenId + * @param signer + * @param data + */ + static transfer(node: string, networkMagic: number, contractHash: string, toAddress: string, tokenId: string, signer: wallet.Account, data?: any): Promise; + static update(node: string, networkMagic: number, contractHash: string, script: string, manifest: string, data: any, signer: wallet.Account): Promise; + static getEpochJSON(node: string, networkMagic: number, contractHash: string, epochId: number, signer?: wallet.Account): Promise; +} diff --git a/sdk/dist/api/gift.js b/sdk/dist/api/gift.js new file mode 100644 index 0000000..e1afe1e --- /dev/null +++ b/sdk/dist/api/gift.js @@ -0,0 +1,316 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.GiftAPI = void 0; +const neon_js_1 = __importStar(require("@cityofzion/neon-js")); +const neon_core_1 = require("@cityofzion/neon-core"); +const helpers_1 = require("../helpers"); +class GiftAPI { + /** + * Returns the balance of an account + * @param node + * @param networkMagic + * @param contractHash + * @param address + * @param signer + */ + static async balanceOf(node, networkMagic, contractHash, address, signer) { + const method = "balanceOf"; + const params = [neon_js_1.sc.ContractParam.hash160(address)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + static async createEpoch(node, networkMagic, contractHash, label, generatorInstanceId, initialRollCollectionId, mintFee, sysFee, maxSupply, signer) { + const method = "create_epoch"; + const params = [ + neon_js_1.sc.ContractParam.string(label), + neon_js_1.sc.ContractParam.integer(generatorInstanceId), + neon_js_1.sc.ContractParam.integer(initialRollCollectionId), + neon_js_1.sc.ContractParam.integer(mintFee), + neon_js_1.sc.ContractParam.integer(sysFee), + neon_js_1.sc.ContractParam.integer(maxSupply) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + } + /** + * Returns the decimals of the token + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async decimals(node, networkMagic, contractHash, signer) { + const method = "decimals"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + /** + * Initializes the smart contract on first deployment (REQUIRED) + * @param node + * @param networkMagic + * @param contractHash + * @param signer The signing account, which will become the first admin if upgrade == false + */ + static async deploy(node, networkMagic, contractHash, signer) { + const method = "deploy"; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + } + static async getTokenJSON(node, networkMagic, contractHash, tokenId, signer) { + const method = "get_token_json"; + const param = [neon_js_1.sc.ContractParam.string(tokenId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } + static async getTokenJSONFlat(node, networkMagic, contractHash, tokenId, signer) { + const method = "get_token_json_flat"; + const params = [neon_js_1.sc.ContractParam.string(tokenId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } + static async getTokenRaw(node, networkMagic, contractHash, tokenId, signer) { + const method = "get_token_raw"; + const params = [neon_js_1.sc.ContractParam.string(tokenId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return res[0].value; + } + /** + * Gets the owner account of a tokenId + * @param node + * @param networkMagic + * @param contractHash + * @param tokenId The tokenId to return the owner of + * @param signer + */ + static async ownerOf(node, networkMagic, contractHash, tokenId, signer) { + const method = "ownerOf"; + const params = [neon_js_1.sc.ContractParam.string(tokenId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + const rawValue = neon_js_1.u.base642hex(res[0].value); + return new neon_core_1.wallet.Account(neon_js_1.u.reverseHex(rawValue)); + } + static async offlineMint(node, networkMagic, contractHash, epochId, owner, signer) { + const method = "offline_mint"; + const params = [ + neon_js_1.sc.ContractParam.integer(epochId), + neon_js_1.sc.ContractParam.hash160(owner) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + } + /** + * Gets the properties of a token + * @param node + * @param networkMagic + * @param contractHash + * @param tokenId The tokenId of the token being requested + * @param signer An optional signer. Populating this value will publish a transaction and return a txid + */ + static async properties(node, networkMagic, contractHash, tokenId, signer) { + const method = "properties"; + const params = [neon_js_1.sc.ContractParam.string(tokenId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } + static async setMintFee(node, networkMagic, contractHash, epochId, fee, signer) { + const method = "set_mint_fee"; + const params = [ + neon_js_1.sc.ContractParam.integer(epochId), + neon_js_1.sc.ContractParam.integer(fee) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + } + /** + * Returns the token symbol + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async symbol(node, networkMagic, contractHash, signer) { + const method = "symbol"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return neon_js_1.default.u.HexString.fromBase64(res[0].value).toAscii(); + } + /** + * Gets and array of strings(tokenIds) representing all the tokens associated with the contract + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async tokens(node, networkMagic, contractHash, signer) { + const method = "tokens"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + if (res === undefined || res.length === 0) { + throw new Error("unrecognized response"); + } + const iterator = res[0]; + if (iterator.iterator && iterator.iterator.length > 0 && iterator.iterator[0].value) { + return iterator.iterator.map((token) => { + const attrs = token.value; + return (0, helpers_1.formatter)(attrs[0]); + }); + } + if (iterator.iterator && iterator.iterator.length === 0) { + return []; + } + throw new Error("unable to resolve respond format"); + } + /** + * Gets an array of strings(tokenId) owned by an address + * @param node + * @param networkMagic + * @param contractHash + * @param address The string formatted address of an account + * @param signer + */ + static async tokensOf(node, networkMagic, contractHash, address, signer) { + const method = "tokensOf"; + const params = [neon_js_1.sc.ContractParam.hash160(address)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + // @ts-ignore + const tokens = []; + res.forEach((token) => { + if (token.value.length === 2) { + tokens.push((0, helpers_1.formatter)(token.value[1])); + } + else { + tokens.push((0, helpers_1.formatter)(token)); + } + }); + return tokens; + } + /** + * Gets the total number of accounts stored in the contract + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async totalAccounts(node, networkMagic, contractHash, signer) { + const method = "total_accounts"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + static async totalEpochs(node, networkMagic, contractHash, signer) { + const method = "total_epochs"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + /** + * Returns the total supply of the token + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async totalSupply(node, networkMagic, contractHash, signer) { + const method = "totalSupply"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + /** + * Transfers a token to another account + * @param node + * @param networkMagic + * @param contractHash + * @param toAddress + * @param tokenId + * @param signer + * @param data + */ + static async transfer(node, networkMagic, contractHash, toAddress, tokenId, signer, data) { + const method = "transfer"; + const params = [ + neon_js_1.sc.ContractParam.hash160(toAddress), + neon_js_1.sc.ContractParam.string(tokenId), + data, + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + } + static async update(node, networkMagic, contractHash, script, manifest, data, signer) { + const method = "update"; + const params = [ + neon_js_1.sc.ContractParam.byteArray(script), + neon_js_1.sc.ContractParam.string(manifest), + neon_js_1.sc.ContractParam.any(data) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res); + } + //setUserPermissions + static async getEpochJSON(node, networkMagic, contractHash, epochId, signer) { + const method = "get_epoch_json"; + const param = [neon_js_1.sc.ContractParam.integer(epochId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res); + } +} +exports.GiftAPI = GiftAPI; +//# sourceMappingURL=gift.js.map \ No newline at end of file diff --git a/sdk/dist/api/gift.js.map b/sdk/dist/api/gift.js.map new file mode 100644 index 0000000..b602354 --- /dev/null +++ b/sdk/dist/api/gift.js.map @@ -0,0 +1 @@ +{"version":3,"file":"gift.js","sourceRoot":"","sources":["../../src/api/gift.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+DAAkD;AAClD,qDAA+C;AAG/C,wCAAqD;AAErD,MAAa,OAAO;IAElB;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,SAAS,CACpB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,OAAe,EACf,MAAuB;QAEvB,MAAM,MAAM,GAAG,WAAW,CAAC;QAE3B,MAAM,MAAM,GAAG,CAAC,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACnD,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QAC1F,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAA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OAAO,GAAG,CAAA;SACX;QAED,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAc,CAAA;IACpC,CAAC;CAEF;AApcD,0BAocC"} \ No newline at end of file diff --git a/sdk/dist/api/index.d.ts b/sdk/dist/api/index.d.ts new file mode 100644 index 0000000..b6885b6 --- /dev/null +++ b/sdk/dist/api/index.d.ts @@ -0,0 +1,8 @@ +export * from "./dice"; +export * from "./chest"; +export * from "./puppet"; +export * from "./interface"; +export * from "./collection"; +export * from "./generator"; +export * from "./gift"; +export * from "./template"; diff --git a/sdk/dist/api/index.js b/sdk/dist/api/index.js new file mode 100644 index 0000000..c5ee344 --- /dev/null +++ b/sdk/dist/api/index.js @@ -0,0 +1,25 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./dice"), exports); +__exportStar(require("./chest"), exports); +__exportStar(require("./puppet"), exports); +__exportStar(require("./interface"), exports); +__exportStar(require("./collection"), exports); +__exportStar(require("./generator"), exports); +__exportStar(require("./gift"), exports); +__exportStar(require("./template"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/sdk/dist/api/index.js.map b/sdk/dist/api/index.js.map new file mode 100644 index 0000000..bc7e5dd --- /dev/null +++ b/sdk/dist/api/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,0CAAuB;AACvB,2CAAyB;AACzB,8CAA2B;AAC3B,+CAA4B;AAC5B,8CAA2B;AAC3B,yCAAsB;AACtB,6CAA0B"} \ No newline at end of file diff --git a/sdk/dist/api/interface.d.ts b/sdk/dist/api/interface.d.ts new file mode 100644 index 0000000..2e4ab63 --- /dev/null +++ b/sdk/dist/api/interface.d.ts @@ -0,0 +1,29 @@ +import StackItemJson, { wallet } from "@cityofzion/neon-core"; +export interface InteropInterface { + type: string; + iterator?: StackItemJson.sc.StackItemJson[]; + truncated: boolean; + value?: StackItemJson.sc.StackItemJson[]; +} +export declare class NeoInterface { + /** + * A method for executing test invocations on the Neo blockchain + * @param rpcAddress the rpc endpoint for a neo full node + * @param networkMagic the network magic for the target network. Query + * @param scriptHash + * @param operation + * @param args + * @constructor + */ + static testInvoke(rpcAddress: string, networkMagic: number, scriptHash: string, operation: string, args: any[]): Promise; + /** + * A method for publishing contract invocations on the Neo Blockchain. + * @param rpcAddress + * @param networkMagic + * @param scriptHash + * @param operation + * @param args + * @param account + */ + static publishInvoke(rpcAddress: string, networkMagic: number, scriptHash: string, operation: string, args: any[], account: wallet.Account): Promise; +} diff --git a/sdk/dist/api/interface.js b/sdk/dist/api/interface.js new file mode 100644 index 0000000..5701354 --- /dev/null +++ b/sdk/dist/api/interface.js @@ -0,0 +1,99 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NeoInterface = void 0; +const neon_js_1 = __importStar(require("@cityofzion/neon-js")); +const axios_1 = __importDefault(require("axios")); +class NeoInterface { + /** + * A method for executing test invocations on the Neo blockchain + * @param rpcAddress the rpc endpoint for a neo full node + * @param networkMagic the network magic for the target network. Query + * @param scriptHash + * @param operation + * @param args + * @constructor + */ + static async testInvoke(rpcAddress, networkMagic, scriptHash, operation, args) { + const res = await new neon_js_1.rpc.RPCClient(rpcAddress).invokeFunction(scriptHash, operation, args); + if (res.exception) { + throw new Error("Invocation Error: " + res.exception); + } + if (res.stack[0].type === 'InteropInterface') { + // @ts-ignore + // @ts-ignore + const ijson = { + // @ts-ignore + "jsonrpc": "2.0", + "id": 1, + "method": "traverseiterator", + "params": [ + // @ts-ignore + res.session, + // @ts-ignore + res.stack[0].id, + 100 + ] + }; + const { data } = await (0, axios_1.default)({ + method: 'post', + url: rpcAddress, + data: ijson, + }); + return data.result; + } + return res.stack; + } + /** + * A method for publishing contract invocations on the Neo Blockchain. + * @param rpcAddress + * @param networkMagic + * @param scriptHash + * @param operation + * @param args + * @param account + */ + static async publishInvoke(rpcAddress, networkMagic, scriptHash, operation, args, account) { + const contract = new neon_js_1.default.experimental.SmartContract(neon_js_1.default.u.HexString.fromHex(scriptHash), { + networkMagic, + rpcAddress, + account + }); + let result; + try { + result = await contract.invoke(operation, args); + } + catch (e) { + console.log("errored here"); + console.log(e); + } + return result; + } +} +exports.NeoInterface = NeoInterface; +//# sourceMappingURL=interface.js.map \ No newline at end of file diff --git a/sdk/dist/api/interface.js.map b/sdk/dist/api/interface.js.map new file mode 100644 index 0000000..3506c3e --- /dev/null +++ b/sdk/dist/api/interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/api/interface.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAAiD;AAGjD,kDAAyB;AAUzB,MAAa,YAAY;IACvB;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,UAAU,CACrB,UAAkB,EAClB,YAAoB,EACpB,UAAkB,EAClB,SAAiB,EACjB,IAAW;QAGX,MAAM,GAAG,GAAG,MAAM,IAAI,aAAG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,cAAc,CAC5D,UAAU,EACV,SAAS,EACT,IAAI,CACL,CAAA;QACD,IAAI,GAAG,CAAC,SAAS,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;SACtD;QACD,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,kBAAkB,EAAC;YAC3C,aAAa;YACb,aAAa;YACb,MAAM,KAAK,GAAG;gBACZ,aAAa;gBACb,SAAS,EAAE,KAAK;gBAChB,IAAI,EAAE,CAAC;gBACP,QAAQ,EAAE,kBAAkB;gBAC5B,QAAQ,EAAE;oBACR,aAAa;oBACb,GAAG,CAAC,OAAO;oBACX,aAAa;oBACb,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;oBACf,GAAG;iBACJ;aACF,CAAA;YACD,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAA,eAAK,EAAC;gBACzB,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,UAAU;gBACf,IAAI,EAAE,KAAK;aACZ,CAAC,CAAA;YACF,OAAO,IAAI,CAAC,MAAM,CAAA;SACnB;QACD,OAAO,GAAG,CAAC,KAAK,CAAC;IACnB,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,aAAa,CACxB,UAAkB,EAClB,YAAoB,EACpB,UAAkB,EAClB,SAAiB,EACjB,IAAW,EACX,OAAuB;QAGvB,MAAM,QAAQ,GAAG,IAAI,iBAAI,CAAC,YAAY,CAAC,aAAa,CAClD,iBAAI,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EACpC;YACE,YAAY;YACZ,UAAU;YACV,OAAO;SACR,CACF,CAAC;QAEF,IAAI,MAAM,CAAC;QACX,IAAI;YACF,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SACjD;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SAChB;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAzFD,oCAyFC"} \ No newline at end of file diff --git a/sdk/dist/api/puppet.d.ts b/sdk/dist/api/puppet.d.ts new file mode 100644 index 0000000..ce2a23c --- /dev/null +++ b/sdk/dist/api/puppet.d.ts @@ -0,0 +1,109 @@ +import { wallet } from "@cityofzion/neon-core"; +import { EpochType, PuppetType } from "../interface"; +export declare class PuppetAPI { + /** + * Returns the balance of an account + * @param node + * @param networkMagic + * @param contractHash + * @param address + * @param signer + */ + static balanceOf(node: string, networkMagic: number, contractHash: string, address: string, signer?: wallet.Account): Promise; + static createEpoch(node: string, networkMagic: number, contractHash: string, label: string, generatorInstanceId: number, initialRollCollectionId: number, mintFee: number, sysFee: number, maxSupply: number, signer: wallet.Account): Promise; + /** + * Returns the decimals of the token + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static decimals(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + /** + * Initializes the smart contract on first deployment (REQUIRED) + * @param node + * @param networkMagic + * @param contractHash + * @param signer The signing account, which will become the first admin if upgrade == false + */ + static deploy(node: string, networkMagic: number, contractHash: string, signer: wallet.Account): Promise; + static getAttributeMod(node: string, networkMagic: number, contractHash: string, attributeValue: number, signer?: wallet.Account): Promise; + static getPuppetJSON(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; + static getPuppetJSONFlat(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; + static getPuppetRaw(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; + /** + * Gets the owner account of a tokenId + * @param node + * @param networkMagic + * @param contractHash + * @param tokenId The tokenId to return the owner of + * @param signer + */ + static ownerOf(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; + static offlineMint(node: string, networkMagic: number, contractHash: string, epochId: number, owner: string, signer: wallet.Account): Promise; + /** + * Gets the properties of a token + * @param node + * @param networkMagic + * @param contractHash + * @param tokenId The tokenId of the token being requested + * @param signer An optional signer. Populating this value will publish a transaction and return a txid + */ + static properties(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; + static setMintFee(node: string, networkMagic: number, contractHash: string, epochId: number, fee: number, signer: wallet.Account): Promise; + /** + * Returns the token symbol + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static symbol(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + /** + * Gets and array of strings(tokenIds) representing all the tokens associated with the contract + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static tokens(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + /** + * Gets an array of strings(tokenId) owned by an address + * @param node + * @param networkMagic + * @param contractHash + * @param address The string formatted address of an account + * @param signer + */ + static tokensOf(node: string, networkMagic: number, contractHash: string, address: string, signer?: wallet.Account): Promise; + /** + * Gets the total number of accounts stored in the contract + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static totalAccounts(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + static totalEpochs(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + /** + * Returns the total supply of the token + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static totalSupply(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + /** + * Transfers a token to another account + * @param node + * @param networkMagic + * @param contractHash + * @param toAddress + * @param tokenId + * @param signer + * @param data + */ + static transfer(node: string, networkMagic: number, contractHash: string, toAddress: string, tokenId: string, signer: wallet.Account, data?: any): Promise; + static update(node: string, networkMagic: number, contractHash: string, script: string, manifest: string, data: any, signer: wallet.Account): Promise; + static getEpochJSON(node: string, networkMagic: number, contractHash: string, epochId: number, signer?: wallet.Account): Promise; +} diff --git a/sdk/dist/api/puppet.js b/sdk/dist/api/puppet.js new file mode 100644 index 0000000..9bd5af5 --- /dev/null +++ b/sdk/dist/api/puppet.js @@ -0,0 +1,327 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PuppetAPI = void 0; +const neon_js_1 = __importStar(require("@cityofzion/neon-js")); +const neon_core_1 = require("@cityofzion/neon-core"); +const helpers_1 = require("../helpers"); +class PuppetAPI { + /** + * Returns the balance of an account + * @param node + * @param networkMagic + * @param contractHash + * @param address + * @param signer + */ + static async balanceOf(node, networkMagic, contractHash, address, signer) { + const method = "balanceOf"; + const params = [neon_js_1.sc.ContractParam.hash160(address)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + static async createEpoch(node, networkMagic, contractHash, label, generatorInstanceId, initialRollCollectionId, mintFee, sysFee, maxSupply, signer) { + const method = "create_epoch"; + const params = [ + neon_js_1.sc.ContractParam.string(label), + neon_js_1.sc.ContractParam.integer(generatorInstanceId), + neon_js_1.sc.ContractParam.integer(initialRollCollectionId), + neon_js_1.sc.ContractParam.integer(mintFee), + neon_js_1.sc.ContractParam.integer(sysFee), + neon_js_1.sc.ContractParam.integer(maxSupply) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + } + /** + * Returns the decimals of the token + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async decimals(node, networkMagic, contractHash, signer) { + const method = "decimals"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + /** + * Initializes the smart contract on first deployment (REQUIRED) + * @param node + * @param networkMagic + * @param contractHash + * @param signer The signing account, which will become the first admin if upgrade == false + */ + static async deploy(node, networkMagic, contractHash, signer) { + const method = "deploy"; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + } + static async getAttributeMod(node, networkMagic, contractHash, attributeValue, signer) { + const method = "roll_initial_stat"; + const params = [ + neon_js_1.sc.ContractParam.integer(attributeValue) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + static async getPuppetJSON(node, networkMagic, contractHash, tokenId, signer) { + const method = "get_puppet_json"; + const param = [neon_js_1.sc.ContractParam.string(tokenId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } + static async getPuppetJSONFlat(node, networkMagic, contractHash, tokenId, signer) { + const method = "get_puppet_json_flat"; + const params = [neon_js_1.sc.ContractParam.string(tokenId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } + static async getPuppetRaw(node, networkMagic, contractHash, tokenId, signer) { + const method = "get_puppet_raw"; + const params = [neon_js_1.sc.ContractParam.string(tokenId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return res[0].value; + } + /** + * Gets the owner account of a tokenId + * @param node + * @param networkMagic + * @param contractHash + * @param tokenId The tokenId to return the owner of + * @param signer + */ + static async ownerOf(node, networkMagic, contractHash, tokenId, signer) { + const method = "ownerOf"; + const params = [neon_js_1.sc.ContractParam.string(tokenId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + const rawValue = neon_js_1.u.base642hex(res[0].value); + return new neon_core_1.wallet.Account(neon_js_1.u.reverseHex(rawValue)); + } + static async offlineMint(node, networkMagic, contractHash, epochId, owner, signer) { + const method = "offline_mint"; + const params = [ + neon_js_1.sc.ContractParam.integer(epochId), + neon_js_1.sc.ContractParam.hash160(owner) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + } + /** + * Gets the properties of a token + * @param node + * @param networkMagic + * @param contractHash + * @param tokenId The tokenId of the token being requested + * @param signer An optional signer. Populating this value will publish a transaction and return a txid + */ + static async properties(node, networkMagic, contractHash, tokenId, signer) { + const method = "properties"; + const params = [neon_js_1.sc.ContractParam.string(tokenId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } + static async setMintFee(node, networkMagic, contractHash, epochId, fee, signer) { + const method = "set_mint_fee"; + const params = [ + neon_js_1.sc.ContractParam.integer(epochId), + neon_js_1.sc.ContractParam.integer(fee) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + } + /** + * Returns the token symbol + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async symbol(node, networkMagic, contractHash, signer) { + const method = "symbol"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return neon_js_1.default.u.HexString.fromBase64(res[0].value).toAscii(); + } + /** + * Gets and array of strings(tokenIds) representing all the tokens associated with the contract + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async tokens(node, networkMagic, contractHash, signer) { + const method = "tokens"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + if (res === undefined || res.length === 0) { + throw new Error("unrecognized response"); + } + const iterator = res[0]; + if (iterator.iterator && iterator.iterator.length > 0 && iterator.iterator[0].value) { + return iterator.iterator.map((token) => { + const attrs = token.value; + return (0, helpers_1.formatter)(attrs[0]); + }); + } + if (iterator.iterator && iterator.iterator.length === 0) { + return []; + } + throw new Error("unable to resolve respond format"); + } + /** + * Gets an array of strings(tokenId) owned by an address + * @param node + * @param networkMagic + * @param contractHash + * @param address The string formatted address of an account + * @param signer + */ + static async tokensOf(node, networkMagic, contractHash, address, signer) { + const method = "tokensOf"; + const params = [neon_js_1.sc.ContractParam.hash160(address)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + // @ts-ignore + const tokens = []; + res.forEach((token) => { + if (token.value.length === 2) { + tokens.push((0, helpers_1.formatter)(token.value[1])); + } + else { + tokens.push((0, helpers_1.formatter)(token)); + } + }); + return tokens; + } + /** + * Gets the total number of accounts stored in the contract + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async totalAccounts(node, networkMagic, contractHash, signer) { + const method = "total_accounts"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + static async totalEpochs(node, networkMagic, contractHash, signer) { + const method = "total_epochs"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + /** + * Returns the total supply of the token + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async totalSupply(node, networkMagic, contractHash, signer) { + const method = "totalSupply"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + /** + * Transfers a token to another account + * @param node + * @param networkMagic + * @param contractHash + * @param toAddress + * @param tokenId + * @param signer + * @param data + */ + static async transfer(node, networkMagic, contractHash, toAddress, tokenId, signer, data) { + const method = "transfer"; + const params = [ + neon_js_1.sc.ContractParam.hash160(toAddress), + neon_js_1.sc.ContractParam.string(tokenId), + data, + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + } + static async update(node, networkMagic, contractHash, script, manifest, data, signer) { + const method = "update"; + const params = [ + neon_js_1.sc.ContractParam.byteArray(script), + neon_js_1.sc.ContractParam.string(manifest), + neon_js_1.sc.ContractParam.any(data) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res); + } + //setUserPermissions + static async getEpochJSON(node, networkMagic, contractHash, epochId, signer) { + const method = "get_epoch_json"; + const param = [neon_js_1.sc.ContractParam.integer(epochId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res); + } +} +exports.PuppetAPI = PuppetAPI; +//# sourceMappingURL=puppet.js.map \ No newline at end of file diff --git a/sdk/dist/api/puppet.js.map b/sdk/dist/api/puppet.js.map new file mode 100644 index 0000000..b8ebbb6 --- /dev/null +++ b/sdk/dist/api/puppet.js.map @@ -0,0 +1 @@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} \ No newline at end of file diff --git a/sdk/dist/api/template.d.ts b/sdk/dist/api/template.d.ts new file mode 100644 index 0000000..9cf7cea --- /dev/null +++ b/sdk/dist/api/template.d.ts @@ -0,0 +1,4 @@ +import { wallet } from "@cityofzion/neon-core"; +export declare class TemplateAPI { + static templateMethod(node: string, networkMagic: number, contractHash: string, paramA: string, paramB: number, paramC: string, paramD: boolean, paramE: string[], signer?: wallet.Account): Promise; +} diff --git a/sdk/dist/api/template.js b/sdk/dist/api/template.js new file mode 100644 index 0000000..1206be2 --- /dev/null +++ b/sdk/dist/api/template.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TemplateAPI = void 0; +const neon_js_1 = require("@cityofzion/neon-js"); +const helpers_1 = require("../helpers"); +class TemplateAPI { + static async templateMethod(node, networkMagic, contractHash, paramA, paramB, paramC, paramD, paramE, signer) { + const method = "{{YOUR_METHOD_NAME_HERE}}"; + const paramEFormatted = paramE.map((param) => { + return neon_js_1.sc.ContractParam.string(param); + }); + const param = [ + neon_js_1.sc.ContractParam.string(paramA), + neon_js_1.sc.ContractParam.integer(paramB), + neon_js_1.sc.ContractParam.byteArray(paramC), + neon_js_1.sc.ContractParam.boolean(paramD), + neon_js_1.sc.ContractParam.array(...paramEFormatted) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } +} +exports.TemplateAPI = TemplateAPI; +//# sourceMappingURL=template.js.map \ No newline at end of file diff --git a/sdk/dist/api/template.js.map b/sdk/dist/api/template.js.map new file mode 100644 index 0000000..cf7f971 --- /dev/null +++ b/sdk/dist/api/template.js.map @@ -0,0 +1 @@ +{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/api/template.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AAEvC,wCAAqD;AAErD,MAAa,WAAW;IAEtB,MAAM,CAAC,KAAK,CAAC,cAAc,CACzB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,MAAc,EACd,MAAc,EACd,MAAc,EACd,MAAe,EACf,MAAgB,EAChB,MAAuB;QAEvB,MAAM,MAAM,GAAG,2BAA2B,CAAC;QAE3C,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAE,CAAC,KAAK,EAAE,EAAE;YAC5C,OAAO,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACvC,CAAC,CAAC,CAAA;QAEF,MAAM,KAAK,GAAG;YACZ,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;YAC/B,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;YAChC,YAAE,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC;YAClC,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;YAChC,YAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,eAAe,CAAC;SAC3C,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;CAEF;AAlCD,kCAkCC"} \ No newline at end of file diff --git a/sdk/dist/helpers/helpers.d.ts b/sdk/dist/helpers/helpers.d.ts new file mode 100644 index 0000000..abad750 --- /dev/null +++ b/sdk/dist/helpers/helpers.d.ts @@ -0,0 +1,8 @@ +import { wallet } from '@cityofzion/neon-core'; +export declare function formatter(field: any, num?: boolean): any; +export declare function sleep(ms: number): Promise; +export declare function variableInvoke(node: string, networkMagic: number, contractHash: string, method: string, param?: any[], signer?: wallet.Account): Promise; +export declare function deployContract(node: string, networkMagic: number, pathToNEF: string, signer: wallet.Account): Promise; +export declare function getEvents(node: string, txid: string): Promise; +export declare function txDidComplete(node: string, txid: string, showStats?: boolean): Promise; +export declare function chiSquared(samples: string[]): number; diff --git a/sdk/dist/helpers/helpers.js b/sdk/dist/helpers/helpers.js new file mode 100644 index 0000000..22511ce --- /dev/null +++ b/sdk/dist/helpers/helpers.js @@ -0,0 +1,143 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.chiSquared = exports.txDidComplete = exports.getEvents = exports.deployContract = exports.variableInvoke = exports.sleep = exports.formatter = void 0; +const neon_core_1 = require("@cityofzion/neon-core"); +const api_1 = require("../api"); +const fs_1 = __importDefault(require("fs")); +const neon_js_1 = require("@cityofzion/neon-js"); +function formatter(field, num = false) { + switch (field.type) { + case "ByteString": + const rawValue = neon_core_1.u.base642hex(field.value); + if (num) { + return parseInt(neon_core_1.u.reverseHex(rawValue), 16); + } + return neon_core_1.u.hexstring2str(rawValue); + case "Integer": + return parseInt(field.value); + case "Array": + return field.value.map((f) => { + return formatter(f); + }); + case "Map": + const object = {}; + field.value.forEach((f) => { + let key = formatter(f.key); + object[key] = formatter(f.value); + }); + return object; + default: + return field.value; + } +} +exports.formatter = formatter; +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} +exports.sleep = sleep; +async function variableInvoke(node, networkMagic, contractHash, method, param = [], signer) { + try { + let res; + if (signer) { + res = await api_1.NeoInterface.publishInvoke(node, networkMagic, contractHash, method, param, signer); + } + else { + res = await api_1.NeoInterface.testInvoke(node, networkMagic, contractHash, method, param); + } + if (res === undefined || res.length === 0) { + throw new Error("unrecognized response"); + } + return res; + } + catch (e) { + throw new Error("Something went wrong: " + e.message); + } +} +exports.variableInvoke = variableInvoke; +async function deployContract(node, networkMagic, pathToNEF, signer) { + const config = { + networkMagic, + rpcAddress: node, + account: signer + }; + const nef = neon_core_1.sc.NEF.fromBuffer(fs_1.default.readFileSync(pathToNEF)); + const rawManifest = fs_1.default.readFileSync(pathToNEF.replace('.nef', '.manifest.json')); + const manifest = neon_core_1.sc.ContractManifest.fromJson(JSON.parse(rawManifest.toString())); + const assembledScript = new neon_core_1.sc.ScriptBuilder() + .emit(neon_core_1.sc.OpCode.ABORT) + .emitPush(neon_core_1.u.HexString.fromHex(signer.scriptHash)) + .emitPush(nef.checksum) + .emitPush(manifest.name) + .build(); + const scriptHash = neon_core_1.u.reverseHex(neon_core_1.u.hash160(assembledScript)); + console.log(`deploying ${manifest.name} to 0x${scriptHash} ...`); + return neon_js_1.experimental.deployContract(nef, manifest, config); +} +exports.deployContract = deployContract; +async function getEvents(node, txid) { + const client = new neon_core_1.rpc.RPCClient(node); + const tx = await client.getApplicationLog(txid); + return parseNotifications(tx); +} +exports.getEvents = getEvents; +async function txDidComplete(node, txid, showStats = false) { + const client = new neon_core_1.rpc.RPCClient(node); + const tx = await client.getApplicationLog(txid); + if (showStats) { + console.log('gas consumed: ', parseInt(tx.executions[0].gasconsumed) / 10 ** 8); + parseNotifications(tx, true); + } + if (tx.executions[0].vmstate !== "HALT") { + throw new Error(tx.executions[0].exception); + } + if (tx.executions[0]) { + const result = tx.executions[0].stack.map((item) => { + return formatter(item); + }); + return result; + } + return true; +} +exports.txDidComplete = txDidComplete; +function parseNotifications(tx, verbose = false) { + return tx.executions[0].notifications.map((n) => { + const notification = formatter(n.state); + const res = { + 'eventName': n.eventname, + 'value': notification + }; + if (verbose) { + console.log(`event: ${n.eventname}`); + console.log(` payload: ${JSON.stringify(notification)}`); + } + return res; + }); +} +function chiSquared(samples) { + const bins = {}; + for (let sample of samples) { + // @ts-ignore + if (bins[sample]) { + // @ts-ignore + bins[sample] += 1; + } + else { + // @ts-ignore + bins[sample] = 1; + } + } + // chi-squared test for uniformity + let chiSquared = 0; + const expected = samples.length / Object.keys(bins).length; + const keys = Object.keys(bins); + for (let i = 0; i < keys.length; i++) { + // @ts-ignore + chiSquared += ((bins[keys[i]] - expected) ** 2) / expected; + } + return chiSquared; +} +exports.chiSquared = chiSquared; +//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/sdk/dist/helpers/helpers.js.map b/sdk/dist/helpers/helpers.js.map new file mode 100644 index 0000000..8da294f --- /dev/null +++ b/sdk/dist/helpers/helpers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,qDAAwD;AACxD,gCAAoC;AACpC,4CAAoB;AACpB,iDAAiD;AAEjD,SAAgB,SAAS,CAAC,KAAU,EAAE,MAAe,KAAK;IACxD,QAAQ,KAAK,CAAC,IAAI,EAAE;QAClB,KAAK,YAAY;YACf,MAAM,QAAQ,GAAG,aAAC,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YAC1C,IAAI,GAAG,EAAE;gBACP,OAAO,QAAQ,CAAC,aAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAC,EAAE,CAAC,CAAA;aAC3C;YACD,OAAO,aAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;QAClC,KAAK,SAAS;YACZ,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAC9B,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAE,CAAC,CAAM,EAAE,EAAE;gBACjC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAA;YACrB,CAAC,CAAC,CAAA;QACJ,KAAK,KAAK;YACR,MAAM,MAAM,GAER,EAAE,CAAA;YACN,KAAK,CAAC,KAAK,CAAC,OAAO,CAAE,CAAC,CAAM,EAAE,EAAE;gBAC9B,IAAI,GAAG,GAAW,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;gBAClC,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;YAClC,CAAC,CAAC,CAAA;YACF,OAA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CAAC,cAAc,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;SAC1D;QACD,OAAO,GAAG,CAAA;IACZ,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,SAAgB,UAAU,CAAC,OAAiB;IAC1C,MAAM,IAAI,GAAG,EAAE,CAAA;IAEf,KAAK,IAAI,MAAM,IAAI,OAAO,EAAE;QAC1B,aAAa;QACb,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE;YAChB,aAAa;YACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;SAClB;aAAM;YACL,aAAa;YACb,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;SACjB;KACF;IAED,kCAAkC;IAClC,IAAI,UAAU,GAAG,CAAC,CAAA;IAClB,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,GAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAA;IACxD,MAAM,IAAI,GAAU,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAE,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,aAAa;QACb,UAAU,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAA;KAC3D;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AAvBD,gCAuBC"} \ No newline at end of file diff --git a/sdk/dist/helpers/index.d.ts b/sdk/dist/helpers/index.d.ts new file mode 100644 index 0000000..d4e09d7 --- /dev/null +++ b/sdk/dist/helpers/index.d.ts @@ -0,0 +1 @@ +export * from "./helpers"; diff --git a/sdk/dist/helpers/index.js b/sdk/dist/helpers/index.js new file mode 100644 index 0000000..5e4bcc5 --- /dev/null +++ b/sdk/dist/helpers/index.js @@ -0,0 +1,18 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./helpers"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/sdk/dist/helpers/index.js.map b/sdk/dist/helpers/index.js.map new file mode 100644 index 0000000..289d134 --- /dev/null +++ b/sdk/dist/helpers/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB"} \ No newline at end of file diff --git a/sdk/dist/index.d.ts b/sdk/dist/index.d.ts new file mode 100644 index 0000000..7041791 --- /dev/null +++ b/sdk/dist/index.d.ts @@ -0,0 +1,9 @@ +export * as api from "./api"; +export * as helpers from "./helpers"; +export * as types from "./interface"; +export * from "./Chest"; +export * from "./Collection"; +export * from "./Dice"; +export * from "./Puppet"; +export * from "./Generator"; +export * from "./Template"; diff --git a/sdk/dist/index.js b/sdk/dist/index.js new file mode 100644 index 0000000..bb8c2e8 --- /dev/null +++ b/sdk/dist/index.js @@ -0,0 +1,39 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.types = exports.helpers = exports.api = void 0; +exports.api = __importStar(require("./api")); +exports.helpers = __importStar(require("./helpers")); +exports.types = __importStar(require("./interface")); +__exportStar(require("./Chest"), exports); +__exportStar(require("./Collection"), exports); +__exportStar(require("./Dice"), exports); +__exportStar(require("./Puppet"), exports); +__exportStar(require("./Generator"), exports); +__exportStar(require("./Template"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/sdk/dist/index.js.map b/sdk/dist/index.js.map new file mode 100644 index 0000000..b16d158 --- /dev/null +++ b/sdk/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA6B;AAC7B,qDAAoC;AACpC,qDAAoC;AACpC,0CAAuB;AACvB,+CAA4B;AAC5B,yCAAsB;AACtB,2CAAwB;AACxB,8CAA2B;AAC3B,6CAA0B"} \ No newline at end of file diff --git a/sdk/dist/interface/index.d.ts b/sdk/dist/interface/index.d.ts new file mode 100644 index 0000000..fc141f7 --- /dev/null +++ b/sdk/dist/interface/index.d.ts @@ -0,0 +1 @@ +export * from './interface'; diff --git a/sdk/dist/interface/index.js b/sdk/dist/interface/index.js new file mode 100644 index 0000000..68c10c5 --- /dev/null +++ b/sdk/dist/interface/index.js @@ -0,0 +1,18 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./interface"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/sdk/dist/interface/index.js.map b/sdk/dist/interface/index.js.map new file mode 100644 index 0000000..66d7688 --- /dev/null +++ b/sdk/dist/interface/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interface/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B"} \ No newline at end of file diff --git a/sdk/dist/interface/interface.d.ts b/sdk/dist/interface/interface.d.ts new file mode 100644 index 0000000..68d5226 --- /dev/null +++ b/sdk/dist/interface/interface.d.ts @@ -0,0 +1,126 @@ +import { wallet } from "@cityofzion/neon-core"; +import { ContractParamLike } from "@cityofzion/neon-core/lib/sc"; +export declare enum EventTypeEnum { + CollectionPointer = 0, + InstanceCall = 1, + Value = 2, + CollectionSampleFrom = 3 +} +export declare enum InstanceAccessMode { + ContractWhitelist = 0, + ContractWhiteListRestricted = 1, + Global = 2 +} +export declare enum NetworkOption { + LocalNet = 0, + TestNet = 1, + MainNet = 2 +} +export interface BaseStats { + charisma: number; + constitution: number; + dexterity: number; + intelligence: number; + strength: number; + wisdom: number; +} +export interface PuppetType { + armorClass: number; + attributes: BaseStats; + description: string; + epoch: number; + hitDie: string; + image: string; + name: string; + owner: wallet.Account; + seed: string; + traits: {}; + tokenId: number; + tokenURI: string; +} +export interface CollectionType { + id: number; + author: wallet.Account; + description: string; + type: string; + values: string[] | number[]; + extra: any; + valuesRaw?: any[]; +} +export interface EpochType { + author: string; + label: string; + epochId: number; + generatorInstanceId: number; + initialRollCollectionId: number; + mintFee: number; + sysFee: number; + maxSupply: number; + totalSupply: number; +} +export interface GeneratorType { + id?: number; + author?: string; + label: string; + baseGeneratorFee: number; + traits: TraitType[] | string[]; +} +export interface GiftType { + description: string; + epoch: number; + image: string; + name: string; + owner: wallet.Account; + seed: string; + traits: {}; + tokenId: number; + tokenURI: string; +} +export interface InstanceAuthorizedContracts { + scriptHash: string; + code: number; +} +export interface TraitType { + label: string; + slots: number; + traitLevels: TraitLevel[]; +} +export interface TraitLevel { + dropScore: number; + mintMode: number; + traits: EventTypeWrapper[]; +} +export interface EventTypeWrapper { + type: EventTypeEnum; + maxMint: number; + args: EventCollectionPointer | EventInstanceCall | EventValue | EventCollectionSampleFrom; +} +export interface EventCollectionPointer { + collectionId: number; + index: number; +} +export interface EventCollectionSampleFrom { + collectionId: number; +} +export interface EventInstanceCall { + scriptHash: string; + method: string; + param: ContractParamLike[]; +} +export interface EventValue { + value: string; +} +export interface PropConstructorOptions { + network?: NetworkOption; + node?: string; + scriptHash?: string; +} +export interface EligibilityAttribute { + logic: string; + key: string; + value: any; +} +export interface EligibilityCase { + scriptHash: string; + attributes: [EligibilityAttribute]; +} diff --git a/sdk/dist/interface/interface.js b/sdk/dist/interface/interface.js new file mode 100644 index 0000000..c09c024 --- /dev/null +++ b/sdk/dist/interface/interface.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NetworkOption = exports.InstanceAccessMode = exports.EventTypeEnum = void 0; +var EventTypeEnum; +(function (EventTypeEnum) { + EventTypeEnum[EventTypeEnum["CollectionPointer"] = 0] = "CollectionPointer"; + EventTypeEnum[EventTypeEnum["InstanceCall"] = 1] = "InstanceCall"; + EventTypeEnum[EventTypeEnum["Value"] = 2] = "Value"; + EventTypeEnum[EventTypeEnum["CollectionSampleFrom"] = 3] = "CollectionSampleFrom"; +})(EventTypeEnum = exports.EventTypeEnum || (exports.EventTypeEnum = {})); +var InstanceAccessMode; +(function (InstanceAccessMode) { + InstanceAccessMode[InstanceAccessMode["ContractWhitelist"] = 0] = "ContractWhitelist"; + InstanceAccessMode[InstanceAccessMode["ContractWhiteListRestricted"] = 1] = "ContractWhiteListRestricted"; + InstanceAccessMode[InstanceAccessMode["Global"] = 2] = "Global"; +})(InstanceAccessMode = exports.InstanceAccessMode || (exports.InstanceAccessMode = {})); +var NetworkOption; +(function (NetworkOption) { + NetworkOption[NetworkOption["LocalNet"] = 0] = "LocalNet"; + NetworkOption[NetworkOption["TestNet"] = 1] = "TestNet"; + NetworkOption[NetworkOption["MainNet"] = 2] = "MainNet"; +})(NetworkOption = exports.NetworkOption || (exports.NetworkOption = {})); +//# sourceMappingURL=interface.js.map \ No newline at end of file diff --git a/sdk/dist/interface/interface.js.map b/sdk/dist/interface/interface.js.map new file mode 100644 index 0000000..00631a3 --- /dev/null +++ b/sdk/dist/interface/interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/interface/interface.ts"],"names":[],"mappings":";;;AAGA,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,2EAAqB,CAAA;IACrB,iEAAgB,CAAA;IAChB,mDAAS,CAAA;IACT,iFAAwB,CAAA;AAC1B,CAAC,EALW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAKxB;AAED,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,qFAAqB,CAAA;IACrB,yGAA+B,CAAA;IAC/B,+DAAU,CAAA;AACZ,CAAC,EAJW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAI7B;AAED,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,yDAAY,CAAA;IACZ,uDAAW,CAAA;IACX,uDAAW,CAAA;AACb,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB"} \ No newline at end of file diff --git a/sdk/package-lock.json b/sdk/package-lock.json index d1af0e4..cf2e191 100644 --- a/sdk/package-lock.json +++ b/sdk/package-lock.json @@ -1,8 +1,2017 @@ { "name": "@cityofzion/props", "version": "0.1.9", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "@cityofzion/props", + "version": "0.1.9", + "license": "ISC", + "dependencies": { + "@cityofzion/neon-core": "^5.0.0-next.16", + "@cityofzion/neon-js": "^5.0.0-next.16", + "@types/lodash": "^4.14.176", + "@types/node": "^16.11.11", + "axios": "^0.27.2", + "lodash": "^4.17.21" + }, + "devDependencies": { + "assert": "^2.0.0", + "fs": "0.0.1-security", + "mocha": "^9.1.3", + "prettier": "^2.4.1", + "typedoc": "^0.22.10", + "typescript": "^4.4.4" + } + }, + "node_modules/@cityofzion/neon-api": { + "version": "5.0.0-next.16", + "resolved": "https://registry.npmjs.org/@cityofzion/neon-api/-/neon-api-5.0.0-next.16.tgz", + "integrity": "sha512-wn7skR+gPvMGUS2GTP9xAW6TP0kwigtLC9+tV7xbl2idaRk3SVGzpI6TrPzCAtZ+mTCqznUjzT/R2jQTSxsCPg==", + "dependencies": { + "isomorphic-ws": "4.0.1", + "ws": "7.4.4" + }, + "peerDependencies": { + "@cityofzion/neon-core": "~5.0.0-next.7" + } + }, + "node_modules/@cityofzion/neon-core": { + "version": "5.0.0-next.16", + "resolved": "https://registry.npmjs.org/@cityofzion/neon-core/-/neon-core-5.0.0-next.16.tgz", + "integrity": "sha512-C9YoomPA5JuOh2HpYY99OYicJBRg+LncPbtTQ4WZ8ujQ4w9DA8DIdLJ0cfWCWFPvGxAt3dW2sxYMzWn+5oNWxg==", + "dependencies": { + "abort-controller": "3.0.0", + "bignumber.js": "7.2.1", + "bn.js": "5.2.0", + "bs58": "4.0.1", + "buffer": "6.0.3", + "cross-fetch": "^3.1.4", + "crypto-js": "4.1.1", + "elliptic": "6.5.4", + "loglevel": "1.7.1", + "loglevel-plugin-prefix": "0.8.4", + "scrypt-js": "3.0.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@cityofzion/neon-js": { + "version": "5.0.0-next.16", + "resolved": "https://registry.npmjs.org/@cityofzion/neon-js/-/neon-js-5.0.0-next.16.tgz", + "integrity": "sha512-mN/0OHzsCPFJqN1WC/cjHBEoSEvURWRkiQdCQBLAbD71Mo12SXEWOd10858c9MQbfTPovT/pSy+eZdGSCANZwg==", + "dependencies": { + "@cityofzion/neon-api": "^5.0.0-next.16", + "@cityofzion/neon-core": "^5.0.0-next.16" + } + }, + "node_modules/@types/lodash": { + "version": "4.14.176", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.176.tgz", + "integrity": "sha512-xZmuPTa3rlZoIbtDUyJKZQimJV3bxCmzMIO2c9Pz9afyDro6kr7R79GwcB6mRhuoPmV2p1Vb66WOJH7F886WKQ==" + }, + "node_modules/@types/node": { + "version": "16.11.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.11.tgz", + "integrity": "sha512-KB0sixD67CeecHC33MYn+eYARkqTheIRNuu97y2XMjR7Wu3XibO1vaY6VBV6O/a89SPI81cEUIYT87UqUWlZNw==" + }, + "node_modules/@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/assert": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", + "integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==", + "dev": true, + "dependencies": { + "es6-object-assign": "^1.1.0", + "is-nan": "^1.2.1", + "object-is": "^1.0.1", + "util": "^0.12.0" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "dependencies": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bignumber.js": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-7.2.1.tgz", + "integrity": "sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ==", + "engines": { + "node": "*" + } + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/bn.js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", + "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/camelcase": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz", + "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==", + "dev": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "node_modules/cross-fetch": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.4.tgz", + "integrity": "sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ==", + "dependencies": { + "node-fetch": "2.6.1" + } + }, + "node_modules/crypto-js": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", + "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" + }, + "node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "dependencies": { + "object-keys": "^1.0.12" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/es-abstract": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", + "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", + "has": "^1.0.3", + "has-symbols": "^1.0.2", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.1", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.1", + "is-string": "^1.0.7", + "is-weakref": "^1.0.1", + "object-inspect": "^1.11.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es6-object-assign": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", + "integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=", + "dev": true + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "bin": { + "flat": "cli.js" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/foreach": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", + "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", + "dev": true + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fs": { + "version": "0.0.1-security", + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==", + "dev": true + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true, + "engines": { + "node": ">=4.x" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-bigints": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", + "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/internal-slot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", + "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-nan": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", + "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", + "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-number-object": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", + "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", + "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.8.tgz", + "integrity": "sha512-HqH41TNZq2fgtGT8WHVFVJhBVGuY3AnP3Q36K8JKXUxSxRgk/d+7NjmwG2vo2mYmXK8UYZKu0qH8bVP5gEisjA==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-abstract": "^1.18.5", + "foreach": "^2.0.5", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-weakref": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.1.tgz", + "integrity": "sha512-b2jKc2pQZjaeFYWEf7ScFj+Be1I+PXmlu572Q8coTXZ+LD/QQZ7ShPMst8h16riVgyXTQwUsFEl74mDvc/3MHQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "node_modules/isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "peerDependencies": { + "ws": "*" + } + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsonc-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", + "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==", + "dev": true + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/loglevel": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.7.1.tgz", + "integrity": "sha512-Hesni4s5UkWkwCGJMQGAh71PaLUmKFM60dHvq0zi/vDhhrzuk+4GgNbTXJ12YYQJn6ZKBDNIjYcuQGKudvqrIw==", + "engines": { + "node": ">= 0.6.0" + }, + "funding": { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/loglevel" + } + }, + "node_modules/loglevel-plugin-prefix": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/loglevel-plugin-prefix/-/loglevel-plugin-prefix-0.8.4.tgz", + "integrity": "sha512-WpG9CcFAOjz/FtNht+QJeGpvVl/cdR6P0z6OcXSkr8wFJOsV2GRj2j10JLfjuA4aYkcKCNIEqRGCyTife9R8/g==" + }, + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "dev": true + }, + "node_modules/marked": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/marked/-/marked-3.0.8.tgz", + "integrity": "sha512-0gVrAjo5m0VZSJb4rpL59K1unJAMb/hm8HRXqasD8VeC8m91ytDPMritgFSlKonfdt+rRYYpP/JfLxgIX8yoSw==", + "dev": true, + "bin": { + "marked": "bin/marked" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mocha": { + "version": "9.1.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.3.tgz", + "integrity": "sha512-Xcpl9FqXOAYqI3j79pEtHBBnQgVXIhpULjGQa7DVb0Po+VzmSIK9kanAiWLHoRR/dbZ2qpdPshuXr8l1VaHCzw==", + "dev": true, + "dependencies": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.2", + "debug": "4.3.2", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.7", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.1.25", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "workerpool": "6.1.5", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mochajs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/nanoid": { + "version": "3.1.25", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", + "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==", + "dev": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", + "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-is": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prettier": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz", + "integrity": "sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" + }, + "node_modules/serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/shiki": { + "version": "0.9.15", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.9.15.tgz", + "integrity": "sha512-/Y0z9IzhJ8nD9nbceORCqu6NgT9X6I8Fk8c3SICHI5NbZRLdZYFaB233gwct9sU0vvSypyaL/qaKvzyQGJBZSw==", + "dev": true, + "dependencies": { + "jsonc-parser": "^3.0.0", + "vscode-oniguruma": "^1.6.1", + "vscode-textmate": "5.2.0" + } + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", + "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", + "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/typedoc": { + "version": "0.22.10", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.10.tgz", + "integrity": "sha512-hQYZ4WtoMZ61wDC6w10kxA42+jclWngdmztNZsDvIz7BMJg7F2xnT+uYsUa7OluyKossdFj9E9Ye4QOZKTy8SA==", + "dev": true, + "dependencies": { + "glob": "^7.2.0", + "lunr": "^2.3.9", + "marked": "^3.0.8", + "minimatch": "^3.0.4", + "shiki": "^0.9.12" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 12.10.0" + }, + "peerDependencies": { + "typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x || 4.5.x" + } + }, + "node_modules/typedoc/node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/typescript": { + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.3.tgz", + "integrity": "sha512-eVYaEHALSt+s9LbvgEv4Ef+Tdq7hBiIZgii12xXJnukryt3pMgJf6aKhoCZ3FWQsu6sydEnkg11fYXLzhLBjeQ==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/unbox-primitive": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", + "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "has-bigints": "^1.0.1", + "has-symbols": "^1.0.2", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/util": { + "version": "0.12.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.4.tgz", + "integrity": "sha512-bxZ9qtSlGUWSOy9Qa9Xgk11kSslpuZwaxCg4sNIDj6FLucDab2JxnHwyNTCpHMtK1MjoQiWQ6DiUMZYbSrO+Sw==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "safe-buffer": "^5.1.2", + "which-typed-array": "^1.1.2" + } + }, + "node_modules/vscode-oniguruma": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.6.1.tgz", + "integrity": "sha512-vc4WhSIaVpgJ0jJIejjYxPvURJavX6QG41vu0mGhqywMkQqulezEqEQ3cO3gc8GvcOpX6ycmKGqRoROEMBNXTQ==", + "dev": true + }, + "node_modules/vscode-textmate": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz", + "integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==", + "dev": true + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.7.tgz", + "integrity": "sha512-vjxaB4nfDqwKI0ws7wZpxIlde1XrLX5uB0ZjpfshgmapJMD7jJWhZI+yToJTqaFByF0eNBcYxbjmCzoRP7CfEw==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-abstract": "^1.18.5", + "foreach": "^2.0.5", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/workerpool": { + "version": "6.1.5", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.5.tgz", + "integrity": "sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw==", + "dev": true + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "node_modules/ws": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz", + "integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + }, "dependencies": { "@cityofzion/neon-api": { "version": "5.0.0-next.16", @@ -863,7 +2872,8 @@ "isomorphic-ws": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", - "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==" + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "requires": {} }, "js-yaml": { "version": "4.1.0", @@ -1362,7 +3372,8 @@ "ws": { "version": "7.4.4", "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz", - "integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==" + "integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==", + "requires": {} }, "y18n": { "version": "5.0.8", diff --git a/sdk/src/Chest.ts b/sdk/src/Chest.ts index 221e1c4..83242da 100644 --- a/sdk/src/Chest.ts +++ b/sdk/src/Chest.ts @@ -1,7 +1,7 @@ import {merge} from 'lodash' import {rpc, u, wallet} from '@cityofzion/neon-core' import {ChestAPI, TemplateAPI} from './api' -import {NetworkOption, PropConstructorOptions} from "./interface"; +import {EligibilityCase, NetworkOption, PropConstructorOptions} from "./interface"; import {formatter, sleep, txDidComplete} from "./helpers"; const DEFAULT_OPTIONS: PropConstructorOptions = { @@ -32,8 +32,8 @@ export class Chest { this.options.scriptHash = '0xb94e721f5425ba1d8830ad752e50e0474f989da5' break default: - this.options.node = 'http://localhost:50012' - this.options.scriptHash = '0x3fb4df29c0c200eff40f465cd028647b8a82f002' + this.options.node = 'http://127.0.0.1:50012' + this.options.scriptHash = '0x343a49b4e39fc826f5ad6bdc64cc198a973511d3' break } this.options = merge({}, this.options, options) @@ -79,25 +79,25 @@ export class Chest { * Create one of these pass throughs for each method you expose in your smart contract. The goal of this entire class is to * simplify the network configuration steps which can be complicated. */ - async createChest(name: string, type: number, eligibleEpochs: [number], puppetTraits: any, signer: wallet.Account): Promise { - return ChestAPI.createChest(this.node.url, this.networkMagic, this.scriptHash, name, type, eligibleEpochs, puppetTraits, signer) + async createChest(name: string, type: number, eligibilityCases: [EligibilityCase], signer: wallet.Account): Promise { + return ChestAPI.createChest(this.node.url, this.networkMagic, this.scriptHash, name, type, eligibilityCases, signer) } - async isPuppetEligible(chestId: string, puppetId: string, signer?: wallet.Account): Promise { - return ChestAPI.isPuppetEligible(this.node.url, this.networkMagic, this.scriptHash, chestId, puppetId, signer) + async isEligible(chestId: number, nftScriptHash: string, tokenId: string, signer?: wallet.Account): Promise { + return ChestAPI.isEligible(this.node.url, this.networkMagic, this.scriptHash, chestId, nftScriptHash, tokenId, signer) } - async lootChestWithPuppet(chestId: string, puppetId: string, signer: wallet.Account): Promise { - return ChestAPI.lootChestWithPuppet(this.node.url, this.networkMagic, this.scriptHash, chestId, puppetId, signer) + async lootChest(chestId: number, nftScriptHash: string, tokenId: string, signer: wallet.Account): Promise { + return ChestAPI.lootChest(this.node.url, this.networkMagic, this.scriptHash, chestId, nftScriptHash, tokenId, signer) } - async lootChestWithPuppetVerified(chestId: string, puppetId: string, signer: wallet.Account): Promise { + async lootChestVerified(chestId: number, nftScriptHash: string, tokenId: string, signer: wallet.Account): Promise { const timeout = 60000 let age = 0 - const txid = await ChestAPI.lootChestWithPuppet(this.node.url, this.networkMagic, this.scriptHash, chestId, puppetId, signer) + const txid = await ChestAPI.lootChest(this.node.url, this.networkMagic, this.scriptHash, chestId, nftScriptHash, tokenId, signer) while (timeout >= age) { try { - let res = await txDidComplete(this.node.url, txid, true) + let res = await txDidComplete(this.node.url, txid, false) res[0].scriptHash = u.reverseHex(u.str2hexstring(res[0].scriptHash)) return res } catch (e) { @@ -108,11 +108,11 @@ export class Chest { throw new Error("timeout exceeded") } - async lootChestAsOwner(chestId: string, signer: wallet.Account): Promise { + async lootChestAsOwner(chestId: number, signer: wallet.Account): Promise { return ChestAPI.lootChestAsOwner(this.node.url, this.networkMagic, this.scriptHash, chestId, signer) } - async getChestJSON(chestId: string, signer?: wallet.Account): Promise { + async getChestJSON(chestId: number, signer?: wallet.Account): Promise { return ChestAPI.getChestJSON(this.node.url, this.networkMagic, this.scriptHash, chestId, signer) } diff --git a/sdk/src/Collection.ts b/sdk/src/Collection.ts index a72b5bb..32e7e2d 100644 --- a/sdk/src/Collection.ts +++ b/sdk/src/Collection.ts @@ -49,7 +49,7 @@ export class Collection { this.options.scriptHash = '0xf05651bc505fd5c7d36593f6e8409932342f9085' break default: - this.options.node = 'http://localhost:50012' + this.options.node = 'http://127.0.0.1:50012' this.options.scriptHash = '0xacf2aa5d0899e860eebd8b8a5454aa3017543848' break } diff --git a/sdk/src/Dice.ts b/sdk/src/Dice.ts index 701dc95..c032a98 100644 --- a/sdk/src/Dice.ts +++ b/sdk/src/Dice.ts @@ -46,7 +46,7 @@ export class Dice { this.options.scriptHash = '0x4380f2c1de98bb267d3ea821897ec571a04fe3e0' break case NetworkOption.LocalNet: - this.options.node = 'http://localhost:50012' + this.options.node = 'http://127.0.0.1:50012' this.options.scriptHash = '0x16d6a0be0506b26e0826dd352724cda0defa7131' break } diff --git a/sdk/src/Generator.ts b/sdk/src/Generator.ts index 1b2eaf7..d5c2f8b 100644 --- a/sdk/src/Generator.ts +++ b/sdk/src/Generator.ts @@ -30,7 +30,7 @@ export class Generator { this.options.scriptHash = '0x0e312c70ce6ed18d5702c6c5794c493d9ef46dc9' break default: - this.options.node = 'http://localhost:50012' + this.options.node = 'http://127.0.0.1:50012' this.options.scriptHash = '0xa3e59ddc61b2d8ac42c519cee5ddaac83c7df276' break } diff --git a/sdk/src/Gift.ts b/sdk/src/Gift.ts index d6e00bb..ff221cc 100644 --- a/sdk/src/Gift.ts +++ b/sdk/src/Gift.ts @@ -1,14 +1,14 @@ import { merge } from 'lodash' import {rpc, wallet} from '@cityofzion/neon-core' -import {PuppetAPI, NeoInterface} from './api' +import {GiftAPI, NeoInterface} from './api' import {sc} from "@cityofzion/neon-js"; -import {EpochType, NetworkOption, PropConstructorOptions, PuppetType} from "./interface"; +import {EpochType, NetworkOption, PropConstructorOptions, GiftType} from "./interface"; const DEFAULT_OPTIONS: PropConstructorOptions = { network: NetworkOption.LocalNet } -export class Puppet { +export class Gift { private options: PropConstructorOptions = DEFAULT_OPTIONS private networkMagic: number = -1 @@ -24,7 +24,7 @@ export class Puppet { break default: this.options.node = 'http://127.0.0.1:50012' - this.options.scriptHash = '0xfefe63f07478394fbe514fda386ad8c7e2a485a0' + this.options.scriptHash = '0x374fc3ca866761a01082186c71a6301d4ba2a363' break } this.options = merge({}, this.options, options) @@ -50,57 +50,53 @@ export class Puppet { } async balanceOf(address: string, signer?: wallet.Account): Promise { - return PuppetAPI.balanceOf(this.node.url, this.networkMagic, this.scriptHash, address, signer) + return GiftAPI.balanceOf(this.node.url, this.networkMagic, this.scriptHash, address, signer) } async createEpoch(label: string, generatorInstanceId: number, initialRollCollectionId: number, mintFee: number, sysFee: number, maxSupply: number, signer: wallet.Account): Promise { - return PuppetAPI.createEpoch(this.node.url, this.networkMagic, this.scriptHash, label, generatorInstanceId, initialRollCollectionId, mintFee, sysFee, maxSupply, signer) + return GiftAPI.createEpoch(this.node.url, this.networkMagic, this.scriptHash, label, generatorInstanceId, initialRollCollectionId, mintFee, sysFee, maxSupply, signer) } async decimals(signer?: wallet.Account): Promise { - return PuppetAPI.decimals(this.node.url, this.networkMagic, this.scriptHash, signer) + return GiftAPI.decimals(this.node.url, this.networkMagic, this.scriptHash, signer) } async deploy(signer: wallet.Account): Promise { - return PuppetAPI.deploy(this.node.url, this.networkMagic, this.scriptHash, signer) - } - - async getAttributeMod(attributeValue: number, signer?: wallet.Account): Promise { - return PuppetAPI.getAttributeMod(this.node.url, this.networkMagic, this.scriptHash, attributeValue, signer) + return GiftAPI.deploy(this.node.url, this.networkMagic, this.scriptHash, signer) } async getEpochJSON(epochId: number, signer?: wallet.Account): Promise { - return PuppetAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId, signer) + return GiftAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId, signer) } - async getPuppetJSON(tokenId: string, signer?: wallet.Account): Promise { - return PuppetAPI.getPuppetJSON(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) + async getTokenJSON(tokenId: string, signer?: wallet.Account): Promise { + return GiftAPI.getTokenJSON(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) } - async getPuppetRaw(tokenId: string, signer?: wallet.Account): Promise { - return PuppetAPI.getPuppetRaw(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) + async getTokenRaw(tokenId: string, signer?: wallet.Account): Promise { + return GiftAPI.getTokenRaw(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) } async ownerOf(tokenId: string, signer?: wallet.Account): Promise { - return PuppetAPI.ownerOf(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) + return GiftAPI.ownerOf(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) } async offlineMint(epochId: number, owner: string, signer: wallet.Account): Promise { - return PuppetAPI.offlineMint(this.node.url, this.networkMagic, this.scriptHash, epochId, owner, signer) + return GiftAPI.offlineMint(this.node.url, this.networkMagic, this.scriptHash, epochId, owner, signer) } - async properties(tokenId: string, signer?: wallet.Account): Promise { - return PuppetAPI.properties(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) + async properties(tokenId: string, signer?: wallet.Account): Promise { + return GiftAPI.properties(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) } async purchase(epochId: number, signer: wallet.Account): Promise { const method = "transfer"; const GASScriptHash = "0xd2a4cff31913016155e38e474a2c06d08be276cf" - const epoch = await PuppetAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId) + const epoch = await GiftAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId) const EpochTyped = epoch as unknown as EpochType if (EpochTyped.totalSupply === EpochTyped.maxSupply) { - throw new Error(`Epoch is out of Puppets: ${EpochTyped.totalSupply} / ${EpochTyped.maxSupply}`) + throw new Error(`Epoch is out of Tokens: ${EpochTyped.totalSupply} / ${EpochTyped.maxSupply}`) } const purchasePrice = EpochTyped.mintFee @@ -125,39 +121,39 @@ export class Puppet { } async setMintFee(epochId: number, fee: number, signer: wallet.Account): Promise { - return PuppetAPI.setMintFee(this.node.url, this.networkMagic, this.scriptHash, epochId, fee, signer) + return GiftAPI.setMintFee(this.node.url, this.networkMagic, this.scriptHash, epochId, fee, signer) } async symbol(signer?: wallet.Account): Promise { - return PuppetAPI.symbol(this.node.url, this.networkMagic, this.scriptHash, signer) + return GiftAPI.symbol(this.node.url, this.networkMagic, this.scriptHash, signer) } async tokens(signer?: wallet.Account): Promise { - return PuppetAPI.tokens(this.node.url, this.networkMagic, this.scriptHash, signer) + return GiftAPI.tokens(this.node.url, this.networkMagic, this.scriptHash, signer) } async tokensOf(address: string, signer?: wallet.Account): Promise { - return PuppetAPI.tokensOf(this.node.url, this.networkMagic, this.scriptHash, address, signer) + return GiftAPI.tokensOf(this.node.url, this.networkMagic, this.scriptHash, address, signer) } async totalAccounts(signer?: wallet.Account): Promise { - return PuppetAPI.totalAccounts(this.node.url, this.networkMagic, this.scriptHash, signer) + return GiftAPI.totalAccounts(this.node.url, this.networkMagic, this.scriptHash, signer) } async totalEpochs(signer?: wallet.Account): Promise { - return PuppetAPI.totalEpochs(this.node.url, this.networkMagic, this.scriptHash, signer) + return GiftAPI.totalEpochs(this.node.url, this.networkMagic, this.scriptHash, signer) } async totalSupply(signer?: wallet.Account): Promise { - return PuppetAPI.totalSupply(this.node.url, this.networkMagic, this.scriptHash, signer) + return GiftAPI.totalSupply(this.node.url, this.networkMagic, this.scriptHash, signer) } async transfer(to: string, tokenId: string, signer: wallet.Account, data: any): Promise { - return PuppetAPI.transfer(this.node.url, this.networkMagic, this.scriptHash,to, tokenId, signer, data) + return GiftAPI.transfer(this.node.url, this.networkMagic, this.scriptHash,to, tokenId, signer, data) } async update(script: string, manifest: string, signer: wallet.Account): Promise { - return PuppetAPI.update(this.node.url, this.networkMagic, this.scriptHash, script, manifest, '', signer) + return GiftAPI.update(this.node.url, this.networkMagic, this.scriptHash, script, manifest, '', signer) } } diff --git a/sdk/src/Puppet.ts b/sdk/src/Puppet.ts index 17c0724..d6e00bb 100644 --- a/sdk/src/Puppet.ts +++ b/sdk/src/Puppet.ts @@ -23,7 +23,7 @@ export class Puppet { this.options.scriptHash = '0x76a8f8a7a901b29a33013b469949f4b08db15756' break default: - this.options.node = 'http://localhost:50012' + this.options.node = 'http://127.0.0.1:50012' this.options.scriptHash = '0xfefe63f07478394fbe514fda386ad8c7e2a485a0' break } diff --git a/sdk/src/Template.ts b/sdk/src/Template.ts index 82b90cb..d232f37 100644 --- a/sdk/src/Template.ts +++ b/sdk/src/Template.ts @@ -31,7 +31,7 @@ export class Template { this.options.scriptHash = '0x4380f2c1de98bb267d3ea821897ec571a04fe3e0' break default: - this.options.node = 'http://localhost:50012' + this.options.node = 'http://127.0.0.1:50012' this.options.scriptHash = '0x16d6a0be0506b26e0826dd352724cda0defa7131' break } diff --git a/sdk/src/api/chest.ts b/sdk/src/api/chest.ts index e6e5608..960213f 100644 --- a/sdk/src/api/chest.ts +++ b/sdk/src/api/chest.ts @@ -1,6 +1,7 @@ import {sc} from "@cityofzion/neon-js"; import {u, wallet} from "@cityofzion/neon-core"; import {formatter, variableInvoke} from "../helpers"; +import {EligibilityCase, EligibilityAttribute} from "../interface"; export class ChestAPI { @@ -9,28 +10,32 @@ export class ChestAPI { networkMagic: number, contractHash: string, name: string, - type: number, - eligibleEpochs: [number], - puppetTraits: any, + chestType: number, + eligibilityCases: [EligibilityCase], signer: wallet.Account, //this field can be optional if you are doing a test invocation(you arent changing contract state and dont rely on block entropy) - ): Promise { + ): Promise { const method = "create_chest"; - const epochs = eligibleEpochs.map( (value) => { - return sc.ContractParam.integer(value) - }) + const cases = eligibilityCases.map( (eligibilityCase: EligibilityCase) => { + + const attributes = eligibilityCase.attributes.map( (attr: EligibilityAttribute) => { + return sc.ContractParam.array( + sc.ContractParam.string(attr.logic), + sc.ContractParam.string(attr.key), + sc.ContractParam.string(attr.value) + ) + }) - const traits = Object.keys(puppetTraits).map( (key) => { return sc.ContractParam.array( - sc.ContractParam.string(key), - sc.ContractParam.string(puppetTraits[key]) + sc.ContractParam.hash160(eligibilityCase.scriptHash), + sc.ContractParam.array(...attributes) ) }) + const param = [ sc.ContractParam.string(name), - sc.ContractParam.integer(type), - sc.ContractParam.array(...epochs), - sc.ContractParam.array(...traits) + sc.ContractParam.integer(chestType), + sc.ContractParam.array(...cases), ]; const res = await variableInvoke(node, networkMagic, contractHash, method, param, signer) @@ -40,19 +45,20 @@ export class ChestAPI { return formatter(res[0]) } - static async isPuppetEligible( - node: string, - networkMagic: number, - contractHash: string, - chestId: string, - puppetId: string, - signer?: wallet.Account, //this field can be optional if you are doing a test invocation(you arent changing contract state and dont rely on block entropy) - ): Promise { - const method = "is_puppet_eligible"; - + static async isEligible( + node: string, + networkMagic: number, + contractHash: string, + chestId: number, + nftSriptHash: string, + tokenId: string, + signer?: wallet.Account, //this field can be optional if you are doing a test invocation(you arent changing contract state and dont rely on block entropy) + ): Promise { + const method = "is_eligible"; const param = [ - sc.ContractParam.string(chestId), - sc.ContractParam.string(puppetId), + sc.ContractParam.integer(chestId), + sc.ContractParam.hash160(nftSriptHash), + sc.ContractParam.string(tokenId) ]; const res = await variableInvoke(node, networkMagic, contractHash, method, param, signer) @@ -62,19 +68,22 @@ export class ChestAPI { return formatter(res[0]) } - static async lootChestWithPuppet( - node: string, - networkMagic: number, - contractHash: string, - chestId: string, - puppetId: string, - signer: wallet.Account, //this field can be optional if you are doing a test invocation(you arent changing contract state and dont rely on block entropy) + //TODO - Verify + static async lootChest( + node: string, + networkMagic: number, + contractHash: string, + chestId: number, + nftScriptHash: string, + tokenId: string, + signer: wallet.Account, //this field can be optional if you are doing a test invocation(you arent changing contract state and dont rely on block entropy) ): Promise { - const method = "loot_chest_with_puppet"; + const method = "loot_chest"; const param = [ - sc.ContractParam.string(chestId), - sc.ContractParam.string(puppetId), + sc.ContractParam.integer(chestId), + sc.ContractParam.hash160(nftScriptHash), + sc.ContractParam.string(tokenId) ]; const res = await variableInvoke(node, networkMagic, contractHash, method, param, signer) @@ -84,17 +93,18 @@ export class ChestAPI { return formatter(res[0]) } + //TODO - Verify static async lootChestAsOwner( node: string, networkMagic: number, contractHash: string, - chestId: string, + chestId: number, signer: wallet.Account, //this field can be optional if you are doing a test invocation(you arent changing contract state and dont rely on block entropy) ): Promise { const method = "loot_chest_as_owner"; const param = [ - sc.ContractParam.string(chestId), + sc.ContractParam.integer(chestId), ]; const res = await variableInvoke(node, networkMagic, contractHash, method, param, signer) @@ -108,13 +118,13 @@ export class ChestAPI { node: string, networkMagic: number, contractHash: string, - chestId: string, + chestId: number, signer?: wallet.Account, //this field can be optional if you are doing a test invocation(you arent changing contract state and dont rely on block entropy) ): Promise { const method = "get_chest_json"; const param = [ - sc.ContractParam.string(chestId), + sc.ContractParam.integer(chestId), ]; const res = await variableInvoke(node, networkMagic, contractHash, method, param, signer) @@ -132,7 +142,7 @@ export class ChestAPI { networkMagic: number, contractHash: string, signer?: wallet.Account, //this field can be optional if you are doing a test invocation(you arent changing contract state and dont rely on block entropy) - ): Promise { + ): Promise { const method = "total_chests"; const res = await variableInvoke(node, networkMagic, contractHash, method, [], signer) diff --git a/sdk/src/api/gift.ts b/sdk/src/api/gift.ts index 76da3f8..b1b1a5d 100644 --- a/sdk/src/api/gift.ts +++ b/sdk/src/api/gift.ts @@ -2,10 +2,10 @@ import {InteropInterface} from "./interface"; import Neon, { sc, u } from "@cityofzion/neon-js"; import { wallet } from "@cityofzion/neon-core"; import {StackItemJson, StackItemMapLike} from "@cityofzion/neon-core/lib/sc"; -import {EpochType, PuppetType} from "../interface"; +import {EpochType, GiftType} from "../interface"; import {formatter, variableInvoke} from "../helpers"; -export class PuppetAPI { +export class GiftAPI { /** * Returns the balance of an account @@ -96,32 +96,14 @@ export class PuppetAPI { return await variableInvoke(node, networkMagic, contractHash, method, [], signer) } - static async getAttributeMod( - node: string, - networkMagic: number, - contractHash: string, - attributeValue: number, - signer?: wallet.Account - ): Promise { - const method = "roll_initial_stat"; - const params = [ - sc.ContractParam.integer(attributeValue) - ] - const res = await variableInvoke(node, networkMagic, contractHash, method, params, signer) - if (signer) { - return res - } - return parseInt(res[0].value as string); - } - - static async getPuppetJSON( + static async getTokenJSON( node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account - ): Promise { - const method = "get_puppet_json"; + ): Promise { + const method = "get_token_json"; const param = [sc.ContractParam.string(tokenId)]; const res = await variableInvoke(node, networkMagic, contractHash, method, param, signer) @@ -129,17 +111,17 @@ export class PuppetAPI { return res } - return formatter(res[0]) as PuppetType + return formatter(res[0]) as GiftType } - static async getPuppetJSONFlat( + static async getTokenJSONFlat( node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account - ): Promise { - const method = "get_puppet_json_flat"; + ): Promise { + const method = "get_token_json_flat"; const params = [sc.ContractParam.string(tokenId)]; const res = await variableInvoke(node, networkMagic, contractHash, method, params, signer) if (signer) { @@ -148,14 +130,14 @@ export class PuppetAPI { return formatter(res[0]) } - static async getPuppetRaw( + static async getTokenRaw( node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account ): Promise { - const method = "get_puppet_raw"; + const method = "get_token_raw"; const params = [sc.ContractParam.string(tokenId)]; const res = await variableInvoke(node, networkMagic, contractHash, method, params, signer) @@ -222,7 +204,7 @@ export class PuppetAPI { contractHash: string, tokenId: string, signer?: wallet.Account - ): Promise { + ): Promise { const method = "properties"; const params = [sc.ContractParam.string(tokenId)]; const res = await variableInvoke(node, networkMagic, contractHash, method, params, signer) diff --git a/sdk/src/api/index.ts b/sdk/src/api/index.ts index 60a1331..ef18fa0 100644 --- a/sdk/src/api/index.ts +++ b/sdk/src/api/index.ts @@ -4,4 +4,5 @@ export * from "./puppet"; export * from "./interface" export * from "./collection" export * from "./generator" +export * from "./gift" export * from "./template" \ No newline at end of file diff --git a/sdk/src/interface/interface.ts b/sdk/src/interface/interface.ts index 2200fc3..ab893d0 100644 --- a/sdk/src/interface/interface.ts +++ b/sdk/src/interface/interface.ts @@ -74,6 +74,18 @@ export interface GeneratorType { traits: TraitType[] | string[] } +export interface GiftType { + description: string + epoch: number + image: string + name: string + owner: wallet.Account + seed: string + traits: {} + tokenId: number + tokenURI: string +} + export interface InstanceAuthorizedContracts { scriptHash: string, code: number @@ -124,4 +136,15 @@ export interface PropConstructorOptions { network?: NetworkOption node?: string scriptHash?: string +} + +export interface EligibilityAttribute { + logic: string, + key: string, + value: any +} + +export interface EligibilityCase { + scriptHash: string, + attributes: [EligibilityAttribute] } \ No newline at end of file diff --git a/sdk/test/integration/chest.js b/sdk/test/integration/chest.js index 852987c..f81e709 100644 --- a/sdk/test/integration/chest.js +++ b/sdk/test/integration/chest.js @@ -34,7 +34,6 @@ describe("Basic Chest Test Suite", function() { }) }) - it("should get the total supply", async () => { const totalSupply = await chest.totalChests() console.log(totalSupply) @@ -48,22 +47,30 @@ describe("Basic Chest Test Suite", function() { const oldChestCount = await chest.totalChests() // create a chest and get the json + const eligibilityCases = [ + { + scriptHash: puppet.scriptHash.slice(2), + attributes: [{ + logic: 'e', + key: 'traits.color', + value: 'blue' + }] + } + ] + const txid = await chest.createChest("A test chest", 0, - [1], - { - color: 'blue' - }, + eligibilityCases, cozWallet) await sdk.helpers.sleep(TIME_CONSTANT) const res = await sdk.helpers.txDidComplete(chest.node.url, txid, true) console.log(res[0]) - assert(res[0].length > 0) const chestJSON = await chest.getChestJSON(res[0]) - console.log(chestJSON) + console.log(JSON.stringify(chestJSON, null, 2)) const newChestCount = await chest.totalChests() + console.log(oldChestCount, newChestCount) assert(newChestCount === oldChestCount + 1) }) @@ -74,15 +81,22 @@ describe("Basic Chest Test Suite", function() { const contractAddress = Neon.wallet.getAddressFromScriptHash(chest.scriptHash.slice(2)) let puppetTokens = await puppet.tokensOf(cozWallet.address) const oldBalance = await puppet.balanceOf(cozWallet.address) + const eligibilityCases = [ + { + scriptHash: puppet.scriptHash.slice(2), + attributes: [{ + logic: 'e', + key: 'traits.color', + value: 'blue' + }] + } + ] console.log("puppet balance: ", oldBalance) let txid = await chest.createChest("A test chest", 1, - [1], - { - color: 'blue' - }, + eligibilityCases, cozWallet) await sdk.helpers.sleep(TIME_CONSTANT) let res = await sdk.helpers.txDidComplete(chest.node.url, txid, true) @@ -117,15 +131,22 @@ describe("Basic Chest Test Suite", function() { const contractAddress = Neon.wallet.getAddressFromScriptHash(chest.scriptHash.slice(2)) - const transferAmount = 1000 * 10**8 + const transferAmount = 10 * 10**8 const amountPerReservoirItem = 1 * 10**8 + const eligibilityCases = [ + { + scriptHash: puppet.scriptHash.slice(2), + attributes: [{ + logic: 'e', + key: 'traits.color', + value: 'blue' + }] + } + ] let txid = await chest.createChest("A test chest", - 1, - [1], - { - color: 'blue' - }, + 0, + eligibilityCases, cozWallet) await sdk.helpers.sleep(TIME_CONSTANT) let res = await sdk.helpers.txDidComplete(chest.node.url, txid, true) @@ -133,7 +154,6 @@ describe("Basic Chest Test Suite", function() { let chestJSON = await chest.getChestJSON(res[0]) console.log(chestJSON) - //transfer some GAS const params = [ Neon.sc.ContractParam.hash160(cozWallet.address), @@ -141,7 +161,7 @@ describe("Basic Chest Test Suite", function() { Neon.sc.ContractParam.integer(transferAmount), //Neon.sc.ContractParam.any('') Neon.sc.ContractParam.array( - Neon.sc.ContractParam.string(res[0]), + Neon.sc.ContractParam.integer(res[0]), Neon.sc.ContractParam.integer(amountPerReservoirItem) ) ] @@ -160,6 +180,8 @@ describe("Basic Chest Test Suite", function() { }) + //verify eligibility + it("should attempt to loot an empty chest as the author", async () => { this.timeout(0) const cozWallet = network.wallets[0].wallet @@ -183,7 +205,6 @@ describe("Basic Chest Test Suite", function() { } catch {} }) - //attempt to loot an empty chest with a puppet it("should attempt to loot an empty chest with a puppet", async () => { this.timeout(0) const cozWallet = network.wallets[0].wallet @@ -212,11 +233,10 @@ describe("Basic Chest Test Suite", function() { } catch {} }) - //attempt to loot a full chest as owner it("should loot a chest as the owner (NEP-11)", async() => { this.timeout(0) const cozWallet = network.wallets[0].wallet - const chestId = "\u0001" + const chestId = 2 //get the original puppet balance and chest balance let puppetBalance = await puppet.balanceOf(cozWallet.address) @@ -239,7 +259,7 @@ describe("Basic Chest Test Suite", function() { it("should loot a chest as the owner (NEP-17)", async() => { this.timeout(0) const cozWallet = network.wallets[0].wallet - const chestId = "\u0002" + const chestId = 1 const rpcClient = new Neon.rpc.RPCClient(chest.node.url); @@ -265,12 +285,10 @@ describe("Basic Chest Test Suite", function() { assert(chestJSON.loot_available > newChestJSON.loot_available) }) - //attempt to loot a full chest with an eligible puppet (both owned and not owned) - it("should loot a chest using an eligible puppet", async() => { this.timeout(0) const cozWallet = network.wallets[0].wallet - const chestId = "\u0002" + const chestId = 1 const rpcClient = new Neon.rpc.RPCClient(chest.node.url); @@ -279,22 +297,25 @@ describe("Basic Chest Test Suite", function() { //test puppets with blue and green traits for (let p of puppets) { let props = await puppet.getPuppetJSON(p.toString()) - let eligibility = await chest.isPuppetEligible(chestId, p.toString()) let absoluteEligibility = props.traits.color === 'blue' - console.log(props.traits.color, eligibility, absoluteEligibility) - assert(eligibility === absoluteEligibility) - - if (eligibility) { - let res = await chest.lootChestWithPuppetVerified(chestId, p.toString(), cozWallet) - assert(res) + if (absoluteEligibility) { + console.log('found one', props) + let txid = await chest.lootChest(chestId, puppet.scriptHash.slice(2), p.toString(), cozWallet) + await sdk.helpers.sleep(TIME_CONSTANT) + let res = await sdk.helpers.txDidComplete(chest.node.url, txid, true) + break + } + else { + console.log("miss") } } }) + //verify it("should loot a chest using an ineligible puppet", async() => { this.timeout(0) const cozWallet = network.wallets[0].wallet - const chestId = '\x03' + const chestId = 1 const rpcClient = new Neon.rpc.RPCClient(chest.node.url); @@ -303,13 +324,13 @@ describe("Basic Chest Test Suite", function() { //test puppets with blue and green traits for (let p of puppets) { let props = await puppet.getPuppetJSON(p.toString()) - let eligibility = await chest.isPuppetEligible(chestId, p.toString()) + let eligibility = await chest.isEligible(chestId, p.toString()) let absoluteEligibility = props.traits.color === 'blue' console.log(props.traits.color, eligibility, absoluteEligibility) assert(eligibility === absoluteEligibility) if (!eligibility) { - let txid = await chest.lootChestWithPuppet(chestId, p.toString(), cozWallet) + let txid = await chest.lootChest(chestId, p.toString(), cozWallet) txids.push(txid) } } @@ -323,12 +344,8 @@ describe("Basic Chest Test Suite", function() { } }) - //attempt to loot a full chest with an ineligible puppet - // verify the response - // verify the chest json - - //attempt to loot a full chest as an eligible puppet who has already minted - it("should loot a chest using an eligible puppet which has already minted", async() => { + //verify + it("should loot a chest using an eligible token which has already minted", async() => { this.timeout(0) const cozWallet = network.wallets[0].wallet const chestId = "\u0001" From 9c8c2dcc2da07c5aa45e0f0cf9ed8eeeb6dc3d49 Mon Sep 17 00:00:00 2001 From: Tyler Adams Date: Wed, 4 Jan 2023 11:10:07 -0700 Subject: [PATCH 7/9] chest formalization --- contracts/chest/chest.nef | Bin 4534 -> 4534 bytes contracts/collection/collection.manifest.json | 10 +- contracts/collection/collection.nef | Bin 1585 -> 1405 bytes contracts/collection/collection.py | 2 +- contracts/generator/generator.manifest.json | 32 +- contracts/generator/generator.nef | Bin 6861 -> 5742 bytes contracts/gift/gift.nef | Bin 4164 -> 0 bytes contracts/{gift => package}/__init__.py | 0 .../package.manifest.json} | 8 +- contracts/package/package.nef | Bin 0 -> 4428 bytes .../{gift/gift.py => package/package.py} | 78 +++-- parameters/generators/4_empty.json | 6 + sdk/dist/Chest.js | 6 +- sdk/dist/Chest.js.map | 2 +- sdk/dist/Collection.js | 4 +- sdk/dist/Generator.js | 2 +- sdk/dist/Gift.d.ts | 2 +- sdk/dist/Gift.js | 8 +- sdk/dist/Gift.js.map | 2 +- sdk/dist/Package.d.ts | 30 ++ sdk/dist/Package.js | 129 +++++++ sdk/dist/Package.js.map | 1 + sdk/dist/Puppet.js | 2 +- sdk/dist/Puppet.js.map | 2 +- sdk/dist/api/chest.js | 9 +- sdk/dist/api/chest.js.map | 2 +- sdk/dist/api/gift.d.ts | 2 +- sdk/dist/api/gift.js | 4 +- sdk/dist/api/gift.js.map | 2 +- sdk/dist/api/index.d.ts | 2 +- sdk/dist/api/index.js | 2 +- sdk/dist/api/index.js.map | 2 +- sdk/dist/api/interface.js | 1 - sdk/dist/api/interface.js.map | 2 +- sdk/dist/api/package.d.ts | 108 ++++++ sdk/dist/api/package.js | 316 ++++++++++++++++++ sdk/dist/api/package.js.map | 1 + sdk/dist/api/puppet.js | 2 +- sdk/dist/api/puppet.js.map | 2 +- sdk/dist/index.d.ts | 1 + sdk/dist/index.js | 1 + sdk/dist/index.js.map | 2 +- sdk/dist/interface/interface.d.ts | 2 +- sdk/package.json | 2 +- sdk/src/Chest.ts | 4 +- sdk/src/Collection.ts | 4 +- sdk/src/Generator.ts | 2 +- sdk/src/{Gift.ts => Package.ts} | 58 ++-- sdk/src/Puppet.ts | 2 +- sdk/src/api/chest.ts | 11 +- sdk/src/api/index.ts | 2 +- sdk/src/api/interface.ts | 1 - sdk/src/api/{gift.ts => package.ts} | 16 +- sdk/src/api/puppet.ts | 2 +- sdk/src/index.ts | 1 + sdk/src/interface/interface.ts | 2 +- 56 files changed, 760 insertions(+), 136 deletions(-) delete mode 100644 contracts/gift/gift.nef rename contracts/{gift => package}/__init__.py (100%) rename contracts/{gift/gift.manifest.json => package/package.manifest.json} (98%) create mode 100644 contracts/package/package.nef rename contracts/{gift/gift.py => package/package.py} (89%) create mode 100644 parameters/generators/4_empty.json create mode 100644 sdk/dist/Package.d.ts create mode 100644 sdk/dist/Package.js create mode 100644 sdk/dist/Package.js.map create mode 100644 sdk/dist/api/package.d.ts create mode 100644 sdk/dist/api/package.js create mode 100644 sdk/dist/api/package.js.map rename sdk/src/{Gift.ts => Package.ts} (59%) rename sdk/src/api/{gift.ts => package.ts} (97%) diff --git a/contracts/chest/chest.nef b/contracts/chest/chest.nef index 032ca487ef22e9d87039d86b04df1bae4975d910..64bf754fda5b70a19de6258f312e3a235d32b602 100644 GIT binary patch delta 38 wcmV+>0NMYxBeo;3i4YXv<4>S*#eRt)s6KrryO`d=@_<9Loe&iP1mV+ZU};?vM*si- delta 38 wcmV+>0NMYxBeo;3i4YVqar)k%%_Ju^-6jZbvIYgdpwH%2= zl^LcgEFd{X#tIX*f{arR;Y>hPLLj*eQzoEPVWvYkGf??|Ca}(L!v+e>}An&K;JP{h@LCRsPvl2uf^(pY93IC zfvKVrs8#T`0)!3J1ZM*chO>bN!`VRN;p{k|1z-*%;|VVwrp%NIfpZtUc-Rt4OEU6{ zDg;3s?v&Kx4iiCJD56vM8TmmnfQgjh-NeZ*j$7ZXHB}nHww9F|8 zPo0CHplh9M59+CcAP}PeLTGkeY(4G#p68uspLa&H59)PP%%n4RENN$CI2zhpi=b=c zM1EZq1g$6lg0lPsAVG+o%qB(+$@KsrtBQ#otq9pv)b%jRGwa0AiXt0V#?qQ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D?M)>|CUedNE7AsO_>PlyoCKC3TSYssq}q11olE zpNm{Y?UFMxELqFKS_z5@EwRJ7RyBm$+OIg*Vi&lNsZ@4=on2P`TSsIOJq%1kuK8D@JQ9E(xGk64c7l`3$JIgsuvj zIfV|Lf&!e5(aQiDj%7JBgGPXsRxAU2IF{v28U1SYG62bEXrTqasrb=9tc6VbHW_F~ zoCtAwpz6>tz~&|}W+Z^~8a^CERV;VgXn-`Y@-m^I1(gl%T5M15=~=^E4mT!~eDtai z;3#xmD3jB4a$hpWhl+ewxoKf|FdXOrGVPyDbR;{HdxF>a=EL5@J?{dI2EzrqMDG&q zDwCCJ#Gy&HA|+j_<$q2rM`>50f%hwwd?r0boke$m=>@-_`0G^tuW_7Fz1muC#od6g zny|x|NJ&>=b44k*va9$zNH|kh(L9k=)KP6*$vQi9D@Tcyc8)eeD1my2E`hK+k zHy4tkTxbav7{*m-JzoYUX#+1%7+JZ%HgUGVC@l(eIC5n*AxWb^Ehw}Vl{Rz@HoZ06 zTs8H(9H+F#7_T1|0zvLQdu}h&%L)QO&`Es`1ENCMX5#) zt7=rh6Q6qhK(riHsqAp1#)8HMrSk#tHBUOvS~}ys<@0UOPo51db7C;OnL-jA%TNIv z66rOmJS|6M6ofp*H*1T*`3O7ZAT`Z~&^*UgPgnvuVZlk^lQ`@$kai{x^QBW`e46H3 zIIOI0F??ED(X|x~MhoGz+xR@6u1{5&gy###$~axwIoQL zAYngpYl1Z-<)TKgbx&)-v6RN!7j2vQm4~mo=2y9z?o+H5e&y+g){?$X!Dm>S)5*}b zV)eDiicSoMwMqpB)6JVIm=ulTZkEsz@f3(@ori@UI1SK8+rP33mSZh+mKu{}Rm2MOge;%g?1MwSAl8h|ofl m2sB@4HqnRgRw_#KzCw%A5`SgqBR|A<0aY->KDYSUmj3|VJ-d_u diff --git a/contracts/gift/gift.nef b/contracts/gift/gift.nef deleted file mode 100644 index 8bb1edab8ac9ba2c4e87bb934e0b7705441b5266..0000000000000000000000000000000000000000 GIT bin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rS^SXXM6^L0ucEgAlDDS?b7 LrR4p$zs39qfqLrh diff --git a/contracts/gift/__init__.py b/contracts/package/__init__.py similarity index 100% rename from contracts/gift/__init__.py rename to contracts/package/__init__.py diff --git a/contracts/gift/gift.manifest.json b/contracts/package/package.manifest.json similarity index 98% rename from contracts/gift/gift.manifest.json rename to contracts/package/package.manifest.json index 4f006c7..48d7caa 100644 --- a/contracts/gift/gift.manifest.json +++ b/contracts/package/package.manifest.json @@ -1,5 +1,5 @@ { - "name": "gift", + "name": "package", "groups": [], "abi": { "methods": [ @@ -271,8 +271,8 @@ "type": "ByteArray" }, { - "name": "initial_roll_collection_id", - "type": "ByteArray" + "name": "chest_id", + "type": "Integer" }, { "name": "mint_fee", @@ -402,7 +402,7 @@ ], "extra": { "Author": "COZ, Inc.", - "Description": "An NFT for giving thanks", + "Description": "A package containing something", "Email": "contact@coz.io" } } \ No newline at end of file diff --git a/contracts/package/package.nef b/contracts/package/package.nef new file mode 100644 index 0000000000000000000000000000000000000000..4d1b31dddbac76e0bbcc6aa1ff3b5ff8f841280b GIT binary patch literal 4428 zcmb_fe{2)i9X}h#cI-=XPE4Rkr4A}?Rt+av{WRz{%~pCq;x=RjnvTNE#eVUfeZF_O zyWqP}x_|n|B&a5J+PZF4U|K6}td%CgR;G1QS_*2>WKykaLGC)3rv5;i`p3Es+EVZP z-Z>#5p(We=$9wmFeSdvE-|u@K5;xzaVRF}oQ6j}goml_2T^o86eSL{!qL*9F@9L+* zgQ;()Mm*fE^iMx3RMU^|d9QEqTs$E1T&-J|&j`ojJ|QL7x?qpTKEp+i4IYhm@v8^4 z95D=>vtoNmMZ?D4n2NQ6C8y86yX8llZ1m9zj?-m?nmKNnCtq++dfCaQ6|*|m@+;@* zw8%n*4r=o=h0|e<8<){af#VD%eff^RA37TM3$<8EK{*g?+Gsa)mSX=n-d8N4w}Koe z7FF~s+LsjcG%Sj$jh>>tEu+`lpqJ5F5H3zSwvzNmK-P%IHyLs4=rkYPVMv-ehK=+O z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_iSyN2}a!HFOM5zcgXV z#Bkwkf-4%U6gL2xCB;Ak*Ny^)*R5m`V?Z-4N&r~tp!7cnR+1n>{U3KhLbR4#bC8>=WRDwHz(FF>Oy&ABj4pK8YukC>EvluaFc#eik zpyA><%Fb74ocJizibX#fJf5S`ON})7_M`P5*XvNt&cU5BuIz7z=Vm*#IXh;Ma#m@0 z$46f+e>nAxfqR`(r@bSOy{1+5FZZ>whlODm87Ne(LxoRLTV!+;1cE{7(%Zl6u63Iw zVV3GK`r!wfPi5%GuqX@&En^?b_F$hz~&hhZ{Xz`|KB%)&YSH zD`pm}N;*fJmzgO+ zHrjdrzzr;b<%JeBQwuyj(1HNh2tWKgQY@3^Q-vpdYD8E9KkeTPzaF?@0KYEi06#kV zZ}5W%hnUi=<>=slBiE__`y_P&mu4cs)=UoR9gm)csg^)1e zt23GNz44}l>zdB4^HoBPYJW@==NQy-9fL;UDqTK NeoMetadata: """ meta = NeoMetadata() meta.author = 'COZ, Inc.' - meta.description = 'An NFT for giving thanks' + meta.description = 'A package containing something' meta.email = 'contact@coz.io' meta.supported_standards = ['NEP-11'] return meta @@ -33,7 +33,7 @@ def manifest_metadata() -> NeoMetadata: # ------------------------------------------- # Symbol of the Token -TOKEN_SYMBOL = 'GIFT' +TOKEN_SYMBOL = 'PACKAGE' # Number of decimal places TOKEN_DECIMALS = 0 @@ -593,12 +593,12 @@ def set_user_permissions(user: UInt160, permissions: Dict[str, bool]) -> bool: class Epoch: - def __init__(self, label: bytes, generator_instance_id: bytes, initial_roll_collection_id: bytes, mint_fee: int, sys_fee: int, max_supply: int, author: UInt160): + def __init__(self, label: bytes, generator_instance_id: bytes, chest_id: int, mint_fee: int, sys_fee: int, max_supply: int, author: UInt160): self._author: UInt160 = author self._label: bytes = label self._epoch_id: bytes = (total_epochs() + 1).to_bytes() self._generator_instance_id: bytes = generator_instance_id - self._initial_roll_collection_id: bytes = initial_roll_collection_id + self._chest_id: int = chest_id self._mint_fee: int = mint_fee self._sys_fee: int = sys_fee self._max_supply: int = max_supply @@ -616,8 +616,8 @@ def get_author(self) -> UInt160: def get_generator_instance_id(self) -> bytes: return self._generator_instance_id - def get_initial_roll_collection_id(self) -> bytes: - return self._initial_roll_collection_id + def get_chest_id(self) -> int: + return self._chest_id def get_label(self) -> bytes: return self._label @@ -640,7 +640,7 @@ def export(self) -> Dict[str, Any]: 'label': self._label, 'epochId': self._epoch_id, 'generatorInstanceId': self._generator_instance_id, - 'initialRollCollectionId': self._initial_roll_collection_id, + 'chest_id': self._chest_id, 'mintFee': self._mint_fee, 'sysFee': self._sys_fee, 'maxSupply': self._max_supply, @@ -658,14 +658,14 @@ def set_fee(self, new_fee: int) -> bool: @public -def create_epoch(label: bytes, generator_instance_id: bytes, initial_roll_collection_id: bytes, mint_fee: int, sys_fee: int, max_supply: int) -> int: +def create_epoch(label: bytes, generator_instance_id: bytes, chest_id: int, mint_fee: int, sys_fee: int, max_supply: int) -> int: tx = cast(Transaction, script_container) author: UInt160 = tx.sender user: User = get_user(author) assert user.get_create_epoch(), 'User Permission Denied' - new_epoch: Epoch = Epoch(label, generator_instance_id, initial_roll_collection_id, mint_fee, sys_fee, max_supply, author) + new_epoch: Epoch = Epoch(label, generator_instance_id, chest_id, mint_fee, sys_fee, max_supply, author) epoch_id: bytes = new_epoch.get_id() epoch_id_int: int = epoch_id.to_int() @@ -716,7 +716,7 @@ def mk_epoch_key(epoch_id: bytes) -> bytes: # ############################# -# ########## Puppet ########### +# ########## PACKAGE ########### # ############################# # ############################# @@ -790,23 +790,29 @@ def get_state(self) -> Dict[str, Any]: epoch_id_int: int = epoch_id_bytes.to_int() epoch: Epoch = get_epoch(epoch_id_bytes) epoch_label: bytes = epoch.get_label() + epoch_chest_id: int = epoch.get_chest_id() epoch_max_supply: int = epoch.get_max_supply() network_magic: int = get_network network_magic_string: str = itoa(network_magic) - state: str = 'closed' - #TODO - if get eligibility is false, set state = `opened` + state: str = 'opened' + # prevent infinite loop by only allowing entries to call for eligibility + if entry_script_hash == calling_script_hash: + eligibility: bool = Chest.is_eligible(epoch_chest_id, executing_script_hash, self.get_token_id()) + if eligibility: + state = 'closed' exported: Dict[str, Any] = { - 'description': state + ' gift', + 'description': state + ' package', 'epochId': epoch_id_int, - 'image': 'https://props.coz.io/img/gift/neo/' + state + '.png', - 'name': 'gift', + 'image': 'https://props.coz.io/img/package/neo/' + state + '.png', + 'name': 'package', 'owner': self._owner, 'seed': self._seed, - 'tokenId': token_id_bytes, - 'tokenURI': 'https://props.coz.io/tok/gift/neo/' + network_magic_string + '/' + token_id_bytes.to_str(), + 'state': state, + 'tokenId': token_id_bytes.to_str(), + 'tokenURI': 'https://props.coz.io/tok/package/neo/' + network_magic_string + '/' + token_id_bytes.to_str(), 'traits': self._traits, } return exported @@ -823,6 +829,7 @@ def get_state_flat(self) -> Dict[str, Any]: epoch_id_int: int = epoch_id_bytes.to_int() epoch: Epoch = get_epoch(epoch_id_bytes) epoch_label: bytes = epoch.get_label() + epoch_chest_id: int = epoch.get_chest_id() epoch_max_supply: int = epoch.get_max_supply() network_magic: int = get_network @@ -844,17 +851,28 @@ def get_state_flat(self) -> Dict[str, Any]: } ) - state: str = 'closed' - # TODO - if get eligibility is false, set state = `opened` + state: str = 'opened' + # prevent infinite loop by only allowing entries to call for eligibility + if entry_script_hash == calling_script_hash: + eligibility: bool = Chest.is_eligible(epoch_chest_id, executing_script_hash, self.get_token_id()) + if eligibility: + state = 'closed' + + token_attrs.append( + { + 'trait_type': 'state', + 'value': state + }) + exported: Dict[str, Any] = { - 'name': 'gift', - 'image': 'https://props.coz.io/img/puppets/neo/' + state + '.png', - 'tokenURI': 'https://props.coz.io/tok/puppets/neo/' + network_magic_string + '/' + token_id_bytes.to_str(), + 'name': 'package', + 'image': 'https://props.coz.io/img/package/neo/' + state + '.png', + 'tokenURI': 'https://props.coz.io/tok/package/neo/' + network_magic_string + '/' + token_id_bytes.to_str(), 'owner': self._owner, 'seed': self._seed, 'tokenId': token_id_bytes.to_str(), - 'description': state + ' gift', + 'description': state + ' package', 'attributes': token_attrs } return exported @@ -944,16 +962,14 @@ def mk_token_key(token_id: bytes) -> bytes: # ############INTERFACES########### # ############INTERFACES########### - -@contract('0xacf2aa5d0899e860eebd8b8a5454aa3017543848') -class Collection: +@contract('0x9378d9f8add6e1d47e7af4d75c121a11a5e9f929') +class Chest: @staticmethod - def sample_from_collection(collection_id: int, samples: int) -> List[bytes]: + def is_eligible(chest_id: int, script_hash: UInt160, token_id: bytes) -> bool: pass - -@contract('0x16d6a0be0506b26e0826dd352724cda0defa7131') +@contract('0x4380f2c1de98bb267d3ea821897ec571a04fe3e0') class Dice: @staticmethod @@ -961,7 +977,7 @@ def rand_between(start: int, end: int) -> int: pass -@contract('0xa3e59ddc61b2d8ac42c519cee5ddaac83c7df276') +@contract('0x0e312c70ce6ed18d5702c6c5794c493d9ef46dc9') class Generator: @staticmethod diff --git a/parameters/generators/4_empty.json b/parameters/generators/4_empty.json new file mode 100644 index 0000000..4e9b34b --- /dev/null +++ b/parameters/generators/4_empty.json @@ -0,0 +1,6 @@ +{ + "label": "Empty Generator", + "baseGeneratorFee": 1953125, + "traits": [ + ] +} \ No newline at end of file diff --git a/sdk/dist/Chest.js b/sdk/dist/Chest.js index a24dcd7..f45a198 100644 --- a/sdk/dist/Chest.js +++ b/sdk/dist/Chest.js @@ -24,15 +24,15 @@ class Chest { switch (options.network) { case interface_1.NetworkOption.TestNet: this.options.node = 'https://testnet1.neo.coz.io:443'; - this.options.scriptHash = ''; + this.options.scriptHash = '0x9378d9f8add6e1d47e7af4d75c121a11a5e9f929'; break; case interface_1.NetworkOption.MainNet: this.options.node = 'https://mainnet1.neo.coz.io:443'; - this.options.scriptHash = '0xb94e721f5425ba1d8830ad752e50e0474f989da5'; + this.options.scriptHash = '0x9378d9f8add6e1d47e7af4d75c121a11a5e9f929'; break; default: this.options.node = 'http://127.0.0.1:50012'; - this.options.scriptHash = '0x56f1d90192dba1088580ed3e34685a8695934b44'; + this.options.scriptHash = '0x343a49b4e39fc826f5ad6bdc64cc198a973511d3'; break; } this.options = (0, lodash_1.merge)({}, this.options, options); diff --git a/sdk/dist/Chest.js.map b/sdk/dist/Chest.js.map index 9469ea5..27fcc7c 100644 --- a/sdk/dist/Chest.js.map +++ b/sdk/dist/Chest.js.map @@ -1 +1 @@ -{"version":3,"file":"Chest.js","sourceRoot":"","sources":["../src/Chest.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,qDAAoD;AACpD,+BAA2C;AAC3C,2CAAmF;AACnF,uCAA0D;AAE1D,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED;;;;GAIG;AAEH,MAAa,KAAK;IAIhB,iIAAiI;IACjI,0HAA0H;IAC1H,8GAA8G;IAC9G,YAAY,UAAkC,EAAE;QANxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAM/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,EAAE,CAAA;gBAC5B,MAAK;YACP,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP;gBACE,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,wBAAwB,CAAA;gBAC5C,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;SACR;QACD,IAAI,CAAC,OAAO,GAAG,IAAA,cAAK,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,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,kBAAkB,CAAC,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,OAAe,EAAE,MAAsB;QAC5D,OAAO,cAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IACtG,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAAe,EAAE,MAAuB;QACzD,OAAO,cAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IAClG,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,IAAY,EAAE,IAAY,EAAE,MAAuB;QACnE,OAAO,cAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACxF,CAAC;CAEF;AA1GD,sBA0GC"} \ No newline at end of file diff --git a/sdk/dist/Collection.js b/sdk/dist/Collection.js index 8bc99a5..d014365 100644 --- a/sdk/dist/Collection.js +++ b/sdk/dist/Collection.js @@ -44,7 +44,7 @@ class Collection { switch (options.network) { case interface_1.NetworkOption.TestNet: this.options.node = 'https://testnet1.neo.coz.io:443'; - this.options.scriptHash = '0x429ba9252c761b6119ab9442d9fbe2e60f3c6f3e'; + this.options.scriptHash = '0xe246d4c03d4d8c3fb529add124289e81a8eb6b6a'; break; case interface_1.NetworkOption.MainNet: this.options.node = 'https://mainnet1.neo.coz.io:443'; @@ -52,7 +52,7 @@ class Collection { break; default: this.options.node = 'http://127.0.0.1:50012'; - this.options.scriptHash = '0xacf2aa5d0899e860eebd8b8a5454aa3017543848'; + this.options.scriptHash = '0xffa8d18f1feec460d301bd755fabab793be4b7cb'; break; } this.options = (0, lodash_1.merge)({}, this.options, options); diff --git a/sdk/dist/Generator.js b/sdk/dist/Generator.js index 2105279..5b25939 100644 --- a/sdk/dist/Generator.js +++ b/sdk/dist/Generator.js @@ -20,7 +20,7 @@ class Generator { switch (options.network) { case interface_1.NetworkOption.TestNet: this.options.node = 'https://testnet1.neo.coz.io:443'; - this.options.scriptHash = '0xdda8055789f0eb3c1d092c714a68ba3e631586c7'; + this.options.scriptHash = '0x9e0faf9257d55dc3b5aacd5354dbed3183968561'; break; case interface_1.NetworkOption.MainNet: this.options.node = 'https://mainnet1.neo.coz.io:443'; diff --git a/sdk/dist/Gift.d.ts b/sdk/dist/Gift.d.ts index 61d8cc1..a4e762e 100644 --- a/sdk/dist/Gift.d.ts +++ b/sdk/dist/Gift.d.ts @@ -8,7 +8,7 @@ export declare class Gift { get node(): rpc.RPCClient; get scriptHash(): string; balanceOf(address: string, signer?: wallet.Account): Promise; - createEpoch(label: string, generatorInstanceId: number, initialRollCollectionId: number, mintFee: number, sysFee: number, maxSupply: number, signer: wallet.Account): Promise; + createEpoch(label: string, generatorInstanceId: number, chestId: number, mintFee: number, sysFee: number, maxSupply: number, signer: wallet.Account): Promise; decimals(signer?: wallet.Account): Promise; deploy(signer: wallet.Account): Promise; getEpochJSON(epochId: number, signer?: wallet.Account): Promise; diff --git a/sdk/dist/Gift.js b/sdk/dist/Gift.js index aad34a7..e364dcb 100644 --- a/sdk/dist/Gift.js +++ b/sdk/dist/Gift.js @@ -16,7 +16,7 @@ class Gift { switch (options.network) { case interface_1.NetworkOption.TestNet: this.options.node = 'https://testnet1.neo.coz.io:443'; - this.options.scriptHash = '0x97857c01d64f846b5fe2eca2d09d2d73928b3f43'; + this.options.scriptHash = '0x1f7bc3162ecb3fc77a508aa4f69b9d2e86b3add4'; break; case interface_1.NetworkOption.MainNet: this.options.node = 'https://mainnet1.neo.coz.io:443'; @@ -24,7 +24,7 @@ class Gift { break; default: this.options.node = 'http://127.0.0.1:50012'; - this.options.scriptHash = '0x374fc3ca866761a01082186c71a6301d4ba2a363'; + this.options.scriptHash = '0x5cd0c2173453211441095a921bf56d0b9cb09f33'; break; } this.options = (0, lodash_1.merge)({}, this.options, options); @@ -48,8 +48,8 @@ class Gift { async balanceOf(address, signer) { return api_1.GiftAPI.balanceOf(this.node.url, this.networkMagic, this.scriptHash, address, signer); } - async createEpoch(label, generatorInstanceId, initialRollCollectionId, mintFee, sysFee, maxSupply, signer) { - return api_1.GiftAPI.createEpoch(this.node.url, this.networkMagic, this.scriptHash, label, generatorInstanceId, initialRollCollectionId, mintFee, sysFee, maxSupply, signer); + async createEpoch(label, generatorInstanceId, chestId, mintFee, sysFee, maxSupply, signer) { + return api_1.GiftAPI.createEpoch(this.node.url, this.networkMagic, this.scriptHash, label, generatorInstanceId, chestId, mintFee, sysFee, maxSupply, signer); } async decimals(signer) { return api_1.GiftAPI.decimals(this.node.url, this.networkMagic, this.scriptHash, signer); diff --git a/sdk/dist/Gift.js.map b/sdk/dist/Gift.js.map index 52d7bbf..557d7ca 100644 --- a/sdk/dist/Gift.js.map +++ b/sdk/dist/Gift.js.map @@ -1 +1 @@ -{"version":3,"file":"Gift.js","sourceRoot":"","sources":["../src/Gift.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,qDAAiD;AACjD,+BAA2C;AAC3C,iDAAuC;AACvC,2CAAuF;AAEvF,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED,MAAa,IAAI;IAIf,YAAY,UAAkC,EAAE;QAHxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAG/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP,KAAK,yBAAa,CA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AAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;IACvF,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,OAAe,EAAE,MAAsB,EAAE,IAAS;QAC3E,OAAO,aAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;IACtG,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,QAAgB,EAAE,MAAsB;QACnE,OAAO,aAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;IACxG,CAAC;CAEF;AApJD,oBAoJC"} \ No newline at end of file diff --git a/sdk/dist/Package.d.ts b/sdk/dist/Package.d.ts new file mode 100644 index 0000000..ccb970f --- /dev/null +++ b/sdk/dist/Package.d.ts @@ -0,0 +1,30 @@ +import { rpc, wallet } from '@cityofzion/neon-core'; +import { EpochType, PropConstructorOptions, PackageType } from "./interface"; +export declare class Package { + private options; + private networkMagic; + constructor(options?: PropConstructorOptions); + init(): Promise; + get node(): rpc.RPCClient; + get scriptHash(): string; + balanceOf(address: string, signer?: wallet.Account): Promise; + createEpoch(label: string, generatorInstanceId: number, chestId: number, mintFee: number, sysFee: number, maxSupply: number, signer: wallet.Account): Promise; + decimals(signer?: wallet.Account): Promise; + deploy(signer: wallet.Account): Promise; + getEpochJSON(epochId: number, signer?: wallet.Account): Promise; + getTokenJSON(tokenId: string, signer?: wallet.Account): Promise; + getTokenRaw(tokenId: string, signer?: wallet.Account): Promise; + ownerOf(tokenId: string, signer?: wallet.Account): Promise; + offlineMint(epochId: number, owner: string, signer: wallet.Account): Promise; + properties(tokenId: string, signer?: wallet.Account): Promise; + purchase(epochId: number, signer: wallet.Account): Promise; + setMintFee(epochId: number, fee: number, signer: wallet.Account): Promise; + symbol(signer?: wallet.Account): Promise; + tokens(signer?: wallet.Account): Promise; + tokensOf(address: string, signer?: wallet.Account): Promise; + totalAccounts(signer?: wallet.Account): Promise; + totalEpochs(signer?: wallet.Account): Promise; + totalSupply(signer?: wallet.Account): Promise; + transfer(to: string, tokenId: string, signer: wallet.Account, data: any): Promise; + update(script: string, manifest: string, signer: wallet.Account): Promise; +} diff --git a/sdk/dist/Package.js b/sdk/dist/Package.js new file mode 100644 index 0000000..9883589 --- /dev/null +++ b/sdk/dist/Package.js @@ -0,0 +1,129 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Package = void 0; +const lodash_1 = require("lodash"); +const neon_core_1 = require("@cityofzion/neon-core"); +const api_1 = require("./api"); +const neon_js_1 = require("@cityofzion/neon-js"); +const interface_1 = require("./interface"); +const DEFAULT_OPTIONS = { + network: interface_1.NetworkOption.LocalNet +}; +class Package { + constructor(options = {}) { + this.options = DEFAULT_OPTIONS; + this.networkMagic = -1; + switch (options.network) { + case interface_1.NetworkOption.TestNet: + this.options.node = 'https://testnet1.neo.coz.io:443'; + this.options.scriptHash = '0x1f7bc3162ecb3fc77a508aa4f69b9d2e86b3add4'; + break; + case interface_1.NetworkOption.MainNet: + this.options.node = 'https://mainnet1.neo.coz.io:443'; + this.options.scriptHash = '0x5728017130c213cbc369c738f470d66628e5acf2'; + break; + default: + this.options.node = 'http://127.0.0.1:50012'; + this.options.scriptHash = '0x5cd0c2173453211441095a921bf56d0b9cb09f33'; + break; + } + this.options = (0, lodash_1.merge)({}, this.options, options); + } + async init() { + const getVersionRes = await this.node.getVersion(); + this.networkMagic = getVersionRes.protocol.network; + } + get node() { + if (this.options.node) { + return new neon_core_1.rpc.RPCClient(this.options.node); + } + throw new Error('no node selected!'); + } + get scriptHash() { + if (this.options.scriptHash) { + return this.options.scriptHash; + } + throw new Error('node scripthash defined'); + } + async balanceOf(address, signer) { + return api_1.PackageAPI.balanceOf(this.node.url, this.networkMagic, this.scriptHash, address, signer); + } + async createEpoch(label, generatorInstanceId, chestId, mintFee, sysFee, maxSupply, signer) { + return api_1.PackageAPI.createEpoch(this.node.url, this.networkMagic, this.scriptHash, label, generatorInstanceId, chestId, mintFee, sysFee, maxSupply, signer); + } + async decimals(signer) { + return api_1.PackageAPI.decimals(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async deploy(signer) { + return api_1.PackageAPI.deploy(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async getEpochJSON(epochId, signer) { + return api_1.PackageAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId, signer); + } + async getTokenJSON(tokenId, signer) { + return api_1.PackageAPI.getTokenJSON(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer); + } + async getTokenRaw(tokenId, signer) { + return api_1.PackageAPI.getTokenRaw(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer); + } + async ownerOf(tokenId, signer) { + return api_1.PackageAPI.ownerOf(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer); + } + async offlineMint(epochId, owner, signer) { + return api_1.PackageAPI.offlineMint(this.node.url, this.networkMagic, this.scriptHash, epochId, owner, signer); + } + async properties(tokenId, signer) { + return api_1.PackageAPI.properties(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer); + } + async purchase(epochId, signer) { + const method = "transfer"; + const GASScriptHash = "0xd2a4cff31913016155e38e474a2c06d08be276cf"; + const epoch = await api_1.PackageAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId); + const EpochTyped = epoch; + if (EpochTyped.totalSupply === EpochTyped.maxSupply) { + throw new Error(`Epoch is out of Tokens: ${EpochTyped.totalSupply} / ${EpochTyped.maxSupply}`); + } + const purchasePrice = EpochTyped.mintFee; + const params = [ + neon_js_1.sc.ContractParam.hash160(signer.address), + neon_js_1.sc.ContractParam.hash160(this.scriptHash), + neon_js_1.sc.ContractParam.integer(purchasePrice), + neon_js_1.sc.ContractParam.integer(epochId) + ]; + try { + return await api_1.NeoInterface.publishInvoke(this.node.url, this.networkMagic, GASScriptHash, method, params, signer); + } + catch (e) { + throw new Error("Something went wrong: " + e.message); + } + } + async setMintFee(epochId, fee, signer) { + return api_1.PackageAPI.setMintFee(this.node.url, this.networkMagic, this.scriptHash, epochId, fee, signer); + } + async symbol(signer) { + return api_1.PackageAPI.symbol(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async tokens(signer) { + return api_1.PackageAPI.tokens(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async tokensOf(address, signer) { + return api_1.PackageAPI.tokensOf(this.node.url, this.networkMagic, this.scriptHash, address, signer); + } + async totalAccounts(signer) { + return api_1.PackageAPI.totalAccounts(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async totalEpochs(signer) { + return api_1.PackageAPI.totalEpochs(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async totalSupply(signer) { + return api_1.PackageAPI.totalSupply(this.node.url, this.networkMagic, this.scriptHash, signer); + } + async transfer(to, tokenId, signer, data) { + return api_1.PackageAPI.transfer(this.node.url, this.networkMagic, this.scriptHash, to, tokenId, signer, data); + } + async update(script, manifest, signer) { + return api_1.PackageAPI.update(this.node.url, this.networkMagic, this.scriptHash, script, manifest, '', signer); + } +} +exports.Package = Package; +//# sourceMappingURL=Package.js.map \ No newline at end of file diff --git a/sdk/dist/Package.js.map b/sdk/dist/Package.js.map new file mode 100644 index 0000000..a589a3f --- /dev/null +++ b/sdk/dist/Package.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Package.js","sourceRoot":"","sources":["../src/Package.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,qDAAiD;AACjD,+BAA8C;AAC9C,iDAAuC;AACvC,2CAA0F;AAE1F,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED,MAAa,OAAO;IAIlB,YAA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UAAU,EAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;IACzG,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,QAAgB,EAAE,MAAsB;QACnE,OAAO,gBAAU,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;IAC3G,CAAC;CAEF;AApJD,0BAoJC"} \ No newline at end of file diff --git a/sdk/dist/Puppet.js b/sdk/dist/Puppet.js index 7c5a866..4d956ea 100644 --- a/sdk/dist/Puppet.js +++ b/sdk/dist/Puppet.js @@ -16,7 +16,7 @@ class Puppet { switch (options.network) { case interface_1.NetworkOption.TestNet: this.options.node = 'https://testnet1.neo.coz.io:443'; - this.options.scriptHash = '0x97857c01d64f846b5fe2eca2d09d2d73928b3f43'; + this.options.scriptHash = ''; break; case interface_1.NetworkOption.MainNet: this.options.node = 'https://mainnet1.neo.coz.io:443'; diff --git a/sdk/dist/Puppet.js.map b/sdk/dist/Puppet.js.map index 1f3ba4d..0b450dc 100644 --- a/sdk/dist/Puppet.js.map +++ b/sdk/dist/Puppet.js.map @@ -1 +1 @@ -{"version":3,"file":"Puppet.js","sourceRoot":"","sources":["../src/Puppet.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,qDAAiD;AACjD,+BAA6C;AAC7C,iDAAuC;AACvC,2CAAyF;AAEzF,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED,MAAa,MAAM;IAIjB,YAAY,UAAkC,EAAE;QAHxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAG/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,O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469d 100644 --- a/sdk/dist/api/chest.js +++ b/sdk/dist/api/chest.js @@ -9,7 +9,14 @@ class ChestAPI { const method = "create_chest"; const cases = eligibilityCases.map((eligibilityCase) => { const attributes = eligibilityCase.attributes.map((attr) => { - return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.string(attr.logic), neon_js_1.sc.ContractParam.string(attr.key), neon_js_1.sc.ContractParam.string(attr.value)); + let value = neon_js_1.sc.ContractParam.byteArray(''); + switch (typeof attr.value) { + case "string": + value = neon_js_1.sc.ContractParam.string(attr.value); + case "number": + value = neon_js_1.sc.ContractParam.integer(attr.value); + } + return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.string(attr.logic), neon_js_1.sc.ContractParam.string(attr.key), value); }); return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.hash160(eligibilityCase.scriptHash), neon_js_1.sc.ContractParam.array(...attributes)); }); diff --git a/sdk/dist/api/chest.js.map b/sdk/dist/api/chest.js.map index 8e7e88e..6244a7b 100644 --- a/sdk/dist/api/chest.js.map +++ b/sdk/dist/api/chest.js.map @@ -1 +1 @@ -{"version":3,"file":"chest.js","sourceRoot":"","sources":["../../src/api/chest.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AACvC,qDAAgD;AAChD,wCAAqD;AAGrD,MAAa,QAAQ;IAEnB,MAAM,CAAC,KAAK,CAAC,WAAW,CACtB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,IAAY,EACZ,SAAiB,EACjB,gBAAmC,EACnC,MAAsB;QAEtB,MAAM,MAAM,GAAG,cAAc,CAAC;QAE9B,MAAM,KAAK,GAAG,gBAAgB,CAAC,GAAG,CAAE,CAAC,eAAgC,EAAE,EAAE;YAEvE,MAAM,UAAU,GAAG,eAAe,CAAC,UAAU,CAAC,GAAG,CAAE,CAAC,IAA0B,EAAE,EAAE;gBAChF,OAAO,YAAE,CAAC,aAAa,CAAC,KAAK,CACzB,YAAE,CAAC,aAAa,CAAC,MAAM,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ClC,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,IAAI,YAAY,GAAG,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QACpC,MAAM,MAAM,GAAG,aAAC,CAAC,UAAU,CAAC,aAAC,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAA;QACjE,YAAY,CAAC,MAAM,GAAG,IAAI,kBAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAChD,OAAO,YAAY,CAAA;IACrB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,WAAW,CACtB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,MAAuB;QAEvB,MAAM,MAAM,GAAG,cAAc,CAAC;QAE9B,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;QACtF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;CAEF;AA9JD,4BA8JC"} \ No newline at end of file diff --git a/sdk/dist/api/gift.d.ts b/sdk/dist/api/gift.d.ts index 769f4de..3137851 100644 --- a/sdk/dist/api/gift.d.ts +++ b/sdk/dist/api/gift.d.ts @@ -10,7 +10,7 @@ export declare class GiftAPI { * @param signer */ static balanceOf(node: string, networkMagic: number, contractHash: string, address: string, signer?: wallet.Account): Promise; - static createEpoch(node: string, networkMagic: number, contractHash: string, label: string, generatorInstanceId: number, initialRollCollectionId: number, mintFee: number, sysFee: number, maxSupply: number, signer: wallet.Account): Promise; + static createEpoch(node: string, networkMagic: number, contractHash: string, label: string, generatorInstanceId: number, chestId: number, mintFee: number, sysFee: number, maxSupply: number, signer: wallet.Account): Promise; /** * Returns the decimals of the token * @param node diff --git a/sdk/dist/api/gift.js b/sdk/dist/api/gift.js index e1afe1e..6cc32d7 100644 --- a/sdk/dist/api/gift.js +++ b/sdk/dist/api/gift.js @@ -45,12 +45,12 @@ class GiftAPI { } return parseInt(res[0].value); } - static async createEpoch(node, networkMagic, contractHash, label, generatorInstanceId, initialRollCollectionId, mintFee, sysFee, maxSupply, signer) { + static async createEpoch(node, networkMagic, contractHash, label, generatorInstanceId, chestId, mintFee, sysFee, maxSupply, signer) { const method = "create_epoch"; const params = [ neon_js_1.sc.ContractParam.string(label), neon_js_1.sc.ContractParam.integer(generatorInstanceId), - neon_js_1.sc.ContractParam.integer(initialRollCollectionId), + neon_js_1.sc.ContractParam.integer(chestId), neon_js_1.sc.ContractParam.integer(mintFee), neon_js_1.sc.ContractParam.integer(sysFee), neon_js_1.sc.ContractParam.integer(maxSupply) diff --git a/sdk/dist/api/gift.js.map b/sdk/dist/api/gift.js.map index b602354..2fddcd2 100644 --- a/sdk/dist/api/gift.js.map +++ b/sdk/dist/api/gift.js.map @@ -1 +1 @@ -{"version":3,"file":"gift.js","sourceRoot":"","sources":["../../src/api/gift.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+DAAkD;AAClD,qDAA+C;AAG/C,wCAAqD;AAErD,MAAa,OAAO;IAElB;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,SAAS,CACpB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,OAAe,EACf,MAAuB;QAEvB,MAAM,MAAM,GAAG,WAAW,CAAC;QAE3B,MAAM,MAAM,GAAG,CAAC,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACnD,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY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AC;QAElD,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QAED,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAc,CAAA;IACpC,CAAC;CAEF;AApcD,0BAocC"} \ No newline at end of file +{"version":3,"file":"gift.js","sourceRoot":"","sources":["../../src/api/gift.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+DAAkD;AAClD,qDAA+C;AAG/C,wCAAqD;AAErD,MAAa,OAAO;IAElB;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,SAAS,CACpB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,OAAe,EACf,MAAuB;QAEvB,MAAM,MAAM,GAAG,WAAW,CAAC;QAE3B,MAAM,MAAM,GAAG,CAAC,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QACnD,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QAC1F,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,WAAW,CACtB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,KAAa,EACb,mBAA2B,EAC3B,OAAe,EACf,OAAe,EACf,MAAc,EACd,SAAiB,EACjB,MAAsB;QAEtB,MAAM,MAAM,GAAG,cAAc,CAAC;QAC9B,MAAM,MAAM,GAAG;YACb,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;YAC9B,YAAE,CAA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S,EACT,MAAsB;QAEtB,MAAM,MAAM,GAAG,QAAQ,CAAC;QACxB,MAAM,MAAM,GAAG;YACb,YAAE,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC;YAClC,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC;YACjC,YAAE,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC;SAC3B,CAAC;QAEF,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QAC1F,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAGD,oBAAoB;IAEpB,MAAM,CAAC,KAAK,CAAC,YAAY,CACvB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,OAAe,EACf,MAAuB;QAEvB,MAAM,MAAM,GAAG,gBAAgB,CAAC;QAChC,MAAM,KAAK,GAAG,CAAC,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAElD,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QAED,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAc,CAAA;IACpC,CAAC;CAEF;AApcD,0BAocC"} \ No newline at end of file diff --git a/sdk/dist/api/index.d.ts b/sdk/dist/api/index.d.ts index b6885b6..3b6e238 100644 --- a/sdk/dist/api/index.d.ts +++ b/sdk/dist/api/index.d.ts @@ -4,5 +4,5 @@ export * from "./puppet"; export * from "./interface"; export * from "./collection"; export * from "./generator"; -export * from "./gift"; +export * from "./package"; export * from "./template"; diff --git a/sdk/dist/api/index.js b/sdk/dist/api/index.js index c5ee344..885b69b 100644 --- a/sdk/dist/api/index.js +++ b/sdk/dist/api/index.js @@ -20,6 +20,6 @@ __exportStar(require("./puppet"), exports); __exportStar(require("./interface"), exports); __exportStar(require("./collection"), exports); __exportStar(require("./generator"), exports); -__exportStar(require("./gift"), exports); +__exportStar(require("./package"), exports); __exportStar(require("./template"), exports); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/sdk/dist/api/index.js.map b/sdk/dist/api/index.js.map index bc7e5dd..8a8b034 100644 --- a/sdk/dist/api/index.js.map +++ b/sdk/dist/api/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,0CAAuB;AACvB,2CAAyB;AACzB,8CAA2B;AAC3B,+CAA4B;AAC5B,8CAA2B;AAC3B,yCAAsB;AACtB,6CAA0B"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,0CAAuB;AACvB,2CAAyB;AACzB,8CAA2B;AAC3B,+CAA4B;AAC5B,8CAA2B;AAC3B,4CAAyB;AACzB,6CAA0B"} \ No newline at end of file diff --git a/sdk/dist/api/interface.js b/sdk/dist/api/interface.js index 5701354..82f9349 100644 --- a/sdk/dist/api/interface.js +++ b/sdk/dist/api/interface.js @@ -89,7 +89,6 @@ class NeoInterface { result = await contract.invoke(operation, args); } catch (e) { - console.log("errored here"); console.log(e); } return result; diff --git a/sdk/dist/api/interface.js.map b/sdk/dist/api/interface.js.map index 3506c3e..e82686d 100644 --- a/sdk/dist/api/interface.js.map +++ b/sdk/dist/api/interface.js.map @@ -1 +1 @@ -{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/api/interface.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAAiD;AAG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SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EACpC;YACE,YAAY;YACZ,UAAU;YACV,OAAO;SACR,CACF,CAAC;QAEF,IAAI,MAAM,CAAC;QACX,IAAI;YACF,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SACjD;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SAChB;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAzFD,oCAyFC"} \ No newline at end of file +{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/api/interface.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAAiD;AAGjD,kDAAyB;AAUzB,MAAa,YAAY;IACvB;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,UAAU,CACrB,UAAkB,EAClB,YAAoB,EACpB,UAAkB,EAClB,SAAiB,EACjB,IAAW;QAGX,MAAM,GAAG,GAAG,MAAM,IAAI,aAAG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,cAAc,CAC5D,UAAU,EACV,SAAS,EACT,IAAI,CACL,CAAA;QACD,IAAI,GAAG,CAAC,SAAS,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;SACtD;QACD,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,kBAAkB,EAAC;YAC3C,aAAa;YACb,aAAa;YACb,MAAM,KAAK,GAAG;gBACZ,aAAa;gBACb,SAAS,EAAE,KAAK;gBAChB,IAAI,EAAE,CAAC;gBACP,QAAQ,EAAE,kBAAkB;gBAC5B,QAAQ,EAAE;oBACR,aAAa;oBACb,GAAG,CAAC,OAAO;oBACX,aAAa;oBACb,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;oBACf,GAAG;iBACJ;aACF,CAAA;YACD,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAA,eAAK,EAAC;gBACzB,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,UAAU;gBACf,IAAI,EAAE,KAAK;aACZ,CAAC,CAAA;YACF,OAAO,IAAI,CAAC,MAAM,CAAA;SACnB;QACD,OAAO,GAAG,CAAC,KAAK,CAAC;IACnB,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,aAAa,CACxB,UAAkB,EAClB,YAAoB,EACpB,UAAkB,EAClB,SAAiB,EACjB,IAAW,EACX,OAAuB;QAGvB,MAAM,QAAQ,GAAG,IAAI,iBAAI,CAAC,YAAY,CAAC,aAAa,CAClD,iBAAI,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EACpC;YACE,YAAY;YACZ,UAAU;YACV,OAAO;SACR,CACF,CAAC;QAEF,IAAI,MAAM,CAAC;QACX,IAAI;YACF,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SACjD;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SAChB;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAxFD,oCAwFC"} \ No newline at end of file diff --git a/sdk/dist/api/package.d.ts b/sdk/dist/api/package.d.ts new file mode 100644 index 0000000..e25cef2 --- /dev/null +++ b/sdk/dist/api/package.d.ts @@ -0,0 +1,108 @@ +import { wallet } from "@cityofzion/neon-core"; +import { EpochType, PackageType } from "../interface"; +export declare class PackageAPI { + /** + * Returns the balance of an account + * @param node + * @param networkMagic + * @param contractHash + * @param address + * @param signer + */ + static balanceOf(node: string, networkMagic: number, contractHash: string, address: string, signer?: wallet.Account): Promise; + static createEpoch(node: string, networkMagic: number, contractHash: string, label: string, generatorInstanceId: number, chestId: number, mintFee: number, sysFee: number, maxSupply: number, signer: wallet.Account): Promise; + /** + * Returns the decimals of the token + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static decimals(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + /** + * Initializes the smart contract on first deployment (REQUIRED) + * @param node + * @param networkMagic + * @param contractHash + * @param signer The signing account, which will become the first admin if upgrade == false + */ + static deploy(node: string, networkMagic: number, contractHash: string, signer: wallet.Account): Promise; + static getTokenJSON(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; + static getTokenJSONFlat(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; + static getTokenRaw(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; + /** + * Gets the owner account of a tokenId + * @param node + * @param networkMagic + * @param contractHash + * @param tokenId The tokenId to return the owner of + * @param signer + */ + static ownerOf(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; + static offlineMint(node: string, networkMagic: number, contractHash: string, epochId: number, owner: string, signer: wallet.Account): Promise; + /** + * Gets the properties of a token + * @param node + * @param networkMagic + * @param contractHash + * @param tokenId The tokenId of the token being requested + * @param signer An optional signer. Populating this value will publish a transaction and return a txid + */ + static properties(node: string, networkMagic: number, contractHash: string, tokenId: string, signer?: wallet.Account): Promise; + static setMintFee(node: string, networkMagic: number, contractHash: string, epochId: number, fee: number, signer: wallet.Account): Promise; + /** + * Returns the token symbol + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static symbol(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + /** + * Gets and array of strings(tokenIds) representing all the tokens associated with the contract + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static tokens(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + /** + * Gets an array of strings(tokenId) owned by an address + * @param node + * @param networkMagic + * @param contractHash + * @param address The string formatted address of an account + * @param signer + */ + static tokensOf(node: string, networkMagic: number, contractHash: string, address: string, signer?: wallet.Account): Promise; + /** + * Gets the total number of accounts stored in the contract + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static totalAccounts(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + static totalEpochs(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + /** + * Returns the total supply of the token + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static totalSupply(node: string, networkMagic: number, contractHash: string, signer?: wallet.Account): Promise; + /** + * Transfers a token to another account + * @param node + * @param networkMagic + * @param contractHash + * @param toAddress + * @param tokenId + * @param signer + * @param data + */ + static transfer(node: string, networkMagic: number, contractHash: string, toAddress: string, tokenId: string, signer: wallet.Account, data?: any): Promise; + static update(node: string, networkMagic: number, contractHash: string, script: string, manifest: string, data: any, signer: wallet.Account): Promise; + static getEpochJSON(node: string, networkMagic: number, contractHash: string, epochId: number, signer?: wallet.Account): Promise; +} diff --git a/sdk/dist/api/package.js b/sdk/dist/api/package.js new file mode 100644 index 0000000..51162c9 --- /dev/null +++ b/sdk/dist/api/package.js @@ -0,0 +1,316 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PackageAPI = void 0; +const neon_js_1 = __importStar(require("@cityofzion/neon-js")); +const neon_core_1 = require("@cityofzion/neon-core"); +const helpers_1 = require("../helpers"); +class PackageAPI { + /** + * Returns the balance of an account + * @param node + * @param networkMagic + * @param contractHash + * @param address + * @param signer + */ + static async balanceOf(node, networkMagic, contractHash, address, signer) { + const method = "balanceOf"; + const params = [neon_js_1.sc.ContractParam.hash160(address)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + static async createEpoch(node, networkMagic, contractHash, label, generatorInstanceId, chestId, mintFee, sysFee, maxSupply, signer) { + const method = "create_epoch"; + const params = [ + neon_js_1.sc.ContractParam.string(label), + neon_js_1.sc.ContractParam.integer(generatorInstanceId), + neon_js_1.sc.ContractParam.integer(chestId), + neon_js_1.sc.ContractParam.integer(mintFee), + neon_js_1.sc.ContractParam.integer(sysFee), + neon_js_1.sc.ContractParam.integer(maxSupply) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + } + /** + * Returns the decimals of the token + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async decimals(node, networkMagic, contractHash, signer) { + const method = "decimals"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + /** + * Initializes the smart contract on first deployment (REQUIRED) + * @param node + * @param networkMagic + * @param contractHash + * @param signer The signing account, which will become the first admin if upgrade == false + */ + static async deploy(node, networkMagic, contractHash, signer) { + const method = "deploy"; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + } + static async getTokenJSON(node, networkMagic, contractHash, tokenId, signer) { + const method = "get_token_json"; + const param = [neon_js_1.sc.ContractParam.string(tokenId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } + static async getTokenJSONFlat(node, networkMagic, contractHash, tokenId, signer) { + const method = "get_token_json_flat"; + const params = [neon_js_1.sc.ContractParam.string(tokenId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } + static async getTokenRaw(node, networkMagic, contractHash, tokenId, signer) { + const method = "get_token_raw"; + const params = [neon_js_1.sc.ContractParam.string(tokenId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return res[0].value; + } + /** + * Gets the owner account of a tokenId + * @param node + * @param networkMagic + * @param contractHash + * @param tokenId The tokenId to return the owner of + * @param signer + */ + static async ownerOf(node, networkMagic, contractHash, tokenId, signer) { + const method = "ownerOf"; + const params = [neon_js_1.sc.ContractParam.string(tokenId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + const rawValue = neon_js_1.u.base642hex(res[0].value); + return new neon_core_1.wallet.Account(neon_js_1.u.reverseHex(rawValue)); + } + static async offlineMint(node, networkMagic, contractHash, epochId, owner, signer) { + const method = "offline_mint"; + const params = [ + neon_js_1.sc.ContractParam.integer(epochId), + neon_js_1.sc.ContractParam.hash160(owner) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + } + /** + * Gets the properties of a token + * @param node + * @param networkMagic + * @param contractHash + * @param tokenId The tokenId of the token being requested + * @param signer An optional signer. Populating this value will publish a transaction and return a txid + */ + static async properties(node, networkMagic, contractHash, tokenId, signer) { + const method = "properties"; + const params = [neon_js_1.sc.ContractParam.string(tokenId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res[0]); + } + static async setMintFee(node, networkMagic, contractHash, epochId, fee, signer) { + const method = "set_mint_fee"; + const params = [ + neon_js_1.sc.ContractParam.integer(epochId), + neon_js_1.sc.ContractParam.integer(fee) + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + } + /** + * Returns the token symbol + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async symbol(node, networkMagic, contractHash, signer) { + const method = "symbol"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return neon_js_1.default.u.HexString.fromBase64(res[0].value).toAscii(); + } + /** + * Gets and array of strings(tokenIds) representing all the tokens associated with the contract + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async tokens(node, networkMagic, contractHash, signer) { + const method = "tokens"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + if (res === undefined || res.length === 0) { + throw new Error("unrecognized response"); + } + const iterator = res[0]; + if (iterator.iterator && iterator.iterator.length > 0 && iterator.iterator[0].value) { + return iterator.iterator.map((token) => { + const attrs = token.value; + return (0, helpers_1.formatter)(attrs[0]); + }); + } + if (iterator.iterator && iterator.iterator.length === 0) { + return []; + } + throw new Error("unable to resolve respond format"); + } + /** + * Gets an array of strings(tokenId) owned by an address + * @param node + * @param networkMagic + * @param contractHash + * @param address The string formatted address of an account + * @param signer + */ + static async tokensOf(node, networkMagic, contractHash, address, signer) { + const method = "tokensOf"; + const params = [neon_js_1.sc.ContractParam.hash160(address)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + // @ts-ignore + const tokens = []; + res.forEach((token) => { + if (token.value.length === 2) { + tokens.push((0, helpers_1.formatter)(token.value[1])); + } + else { + tokens.push((0, helpers_1.formatter)(token)); + } + }); + return tokens; + } + /** + * Gets the total number of accounts stored in the contract + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async totalAccounts(node, networkMagic, contractHash, signer) { + const method = "total_accounts"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + static async totalEpochs(node, networkMagic, contractHash, signer) { + const method = "total_epochs"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + /** + * Returns the total supply of the token + * @param node + * @param networkMagic + * @param contractHash + * @param signer + */ + static async totalSupply(node, networkMagic, contractHash, signer) { + const method = "totalSupply"; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, [], signer); + if (signer) { + return res; + } + return parseInt(res[0].value); + } + /** + * Transfers a token to another account + * @param node + * @param networkMagic + * @param contractHash + * @param toAddress + * @param tokenId + * @param signer + * @param data + */ + static async transfer(node, networkMagic, contractHash, toAddress, tokenId, signer, data) { + const method = "transfer"; + const params = [ + neon_js_1.sc.ContractParam.hash160(toAddress), + neon_js_1.sc.ContractParam.string(tokenId), + data, + ]; + return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + } + static async update(node, networkMagic, contractHash, script, manifest, data, signer) { + const method = "update"; + const params = [ + neon_js_1.sc.ContractParam.byteArray(script), + neon_js_1.sc.ContractParam.string(manifest), + neon_js_1.sc.ContractParam.any(data) + ]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res); + } + //setUserPermissions + static async getEpochJSON(node, networkMagic, contractHash, epochId, signer) { + const method = "get_epoch_json"; + const param = [neon_js_1.sc.ContractParam.integer(epochId)]; + const res = await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, param, signer); + if (signer) { + return res; + } + return (0, helpers_1.formatter)(res); + } +} +exports.PackageAPI = PackageAPI; +//# sourceMappingURL=package.js.map \ No newline at end of file diff --git a/sdk/dist/api/package.js.map b/sdk/dist/api/package.js.map new file mode 100644 index 0000000..8b5d30f --- /dev/null +++ b/sdk/dist/api/package.js.map @@ -0,0 +1 @@ +{"version":3,"file":"package.js","sourceRoot":"","sources":["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AAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;QAC1F,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAGD,oBAAoB;IAEpB,MAAM,CAAC,KAAK,CAAC,YAAY,CACvB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,OAAe,EACf,MAAuB;QAEvB,MAAM,MAAM,GAAG,gBAAgB,CAAC;QAChC,MAAM,KAAK,GAAG,CAAC,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAElD,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;QACzF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QAED,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAc,CAAA;IACpC,CAAC;CAEF;AApcD,gCAocC"} \ No newline at end of file diff --git a/sdk/dist/api/puppet.js b/sdk/dist/api/puppet.js index 9bd5af5..f22c362 100644 --- a/sdk/dist/api/puppet.js +++ b/sdk/dist/api/puppet.js @@ -294,7 +294,7 @@ class PuppetAPI { const method = "transfer"; const params = [ neon_js_1.sc.ContractParam.hash160(toAddress), - neon_js_1.sc.ContractParam.string(tokenId), + neon_js_1.sc.ContractParam.byteArray(tokenId), data, ]; return await (0, helpers_1.variableInvoke)(node, networkMagic, contractHash, method, params, signer); diff --git a/sdk/dist/api/puppet.js.map b/sdk/dist/api/puppet.js.map index b8ebbb6..dbe0122 100644 --- a/sdk/dist/api/puppet.js.map +++ b/sdk/dist/api/puppet.js.map @@ -1 +1 @@ -{"version":3,"file":"puppet.js","sourceRoot":"","sources":["../../src/api/puppet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA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.ts +++ b/sdk/dist/index.d.ts @@ -6,4 +6,5 @@ export * from "./Collection"; export * from "./Dice"; export * from "./Puppet"; export * from "./Generator"; +export * from "./Package"; export * from "./Template"; diff --git a/sdk/dist/index.js b/sdk/dist/index.js index bb8c2e8..457c13b 100644 --- a/sdk/dist/index.js +++ b/sdk/dist/index.js @@ -35,5 +35,6 @@ __exportStar(require("./Collection"), exports); __exportStar(require("./Dice"), exports); __exportStar(require("./Puppet"), exports); __exportStar(require("./Generator"), exports); +__exportStar(require("./Package"), exports); __exportStar(require("./Template"), exports); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/sdk/dist/index.js.map b/sdk/dist/index.js.map index b16d158..1fd24d5 100644 --- a/sdk/dist/index.js.map +++ b/sdk/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA6B;AAC7B,qDAAoC;AACpC,qDAAoC;AACpC,0CAAuB;AACvB,+CAA4B;AAC5B,yCAAsB;AACtB,2CAAwB;AACxB,8CAA2B;AAC3B,6CAA0B"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA6B;AAC7B,qDAAoC;AACpC,qDAAoC;AACpC,0CAAuB;AACvB,+CAA4B;AAC5B,yCAAsB;AACtB,2CAAwB;AACxB,8CAA2B;AAC3B,4CAAyB;AACzB,6CAA0B"} \ No newline at end of file diff --git a/sdk/dist/interface/interface.d.ts b/sdk/dist/interface/interface.d.ts index 68d5226..18e62c1 100644 --- a/sdk/dist/interface/interface.d.ts +++ b/sdk/dist/interface/interface.d.ts @@ -65,7 +65,7 @@ export interface GeneratorType { baseGeneratorFee: number; traits: TraitType[] | string[]; } -export interface GiftType { +export interface PackageType { description: string; epoch: number; image: string; diff --git a/sdk/package.json b/sdk/package.json index 8c39aeb..ef2c543 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@cityofzion/props", - "version": "0.1.9", + "version": "0.2.0", "description": "an sdk for interfacing with props to use in decentralized applications", "main": "dist/index", "types": "dist/index", diff --git a/sdk/src/Chest.ts b/sdk/src/Chest.ts index 83242da..1af4781 100644 --- a/sdk/src/Chest.ts +++ b/sdk/src/Chest.ts @@ -25,11 +25,11 @@ export class Chest { switch(options.network) { case NetworkOption.TestNet: this.options.node = 'https://testnet1.neo.coz.io:443' - this.options.scriptHash = '' + this.options.scriptHash = '0x9378d9f8add6e1d47e7af4d75c121a11a5e9f929' break case NetworkOption.MainNet: this.options.node = 'https://mainnet1.neo.coz.io:443' - this.options.scriptHash = '0xb94e721f5425ba1d8830ad752e50e0474f989da5' + this.options.scriptHash = '0x9378d9f8add6e1d47e7af4d75c121a11a5e9f929' break default: this.options.node = 'http://127.0.0.1:50012' diff --git a/sdk/src/Collection.ts b/sdk/src/Collection.ts index 32e7e2d..16e4420 100644 --- a/sdk/src/Collection.ts +++ b/sdk/src/Collection.ts @@ -42,7 +42,7 @@ export class Collection { switch(options.network) { case NetworkOption.TestNet: this.options.node = 'https://testnet1.neo.coz.io:443' - this.options.scriptHash = '0x429ba9252c761b6119ab9442d9fbe2e60f3c6f3e' + this.options.scriptHash = '0xe246d4c03d4d8c3fb529add124289e81a8eb6b6a' break case NetworkOption.MainNet: this.options.node = 'https://mainnet1.neo.coz.io:443' @@ -50,7 +50,7 @@ export class Collection { break default: this.options.node = 'http://127.0.0.1:50012' - this.options.scriptHash = '0xacf2aa5d0899e860eebd8b8a5454aa3017543848' + this.options.scriptHash = '0xffa8d18f1feec460d301bd755fabab793be4b7cb' break } this.options = merge({}, this.options, options) diff --git a/sdk/src/Generator.ts b/sdk/src/Generator.ts index d5c2f8b..8c0c962 100644 --- a/sdk/src/Generator.ts +++ b/sdk/src/Generator.ts @@ -23,7 +23,7 @@ export class Generator { switch(options.network) { case NetworkOption.TestNet: this.options.node = 'https://testnet1.neo.coz.io:443' - this.options.scriptHash = '0xdda8055789f0eb3c1d092c714a68ba3e631586c7' + this.options.scriptHash = '0x9e0faf9257d55dc3b5aacd5354dbed3183968561' break case NetworkOption.MainNet: this.options.node = 'https://mainnet1.neo.coz.io:443' diff --git a/sdk/src/Gift.ts b/sdk/src/Package.ts similarity index 59% rename from sdk/src/Gift.ts rename to sdk/src/Package.ts index ff221cc..d9e8e75 100644 --- a/sdk/src/Gift.ts +++ b/sdk/src/Package.ts @@ -1,14 +1,14 @@ import { merge } from 'lodash' import {rpc, wallet} from '@cityofzion/neon-core' -import {GiftAPI, NeoInterface} from './api' +import {PackageAPI, NeoInterface} from './api' import {sc} from "@cityofzion/neon-js"; -import {EpochType, NetworkOption, PropConstructorOptions, GiftType} from "./interface"; +import {EpochType, NetworkOption, PropConstructorOptions, PackageType} from "./interface"; const DEFAULT_OPTIONS: PropConstructorOptions = { network: NetworkOption.LocalNet } -export class Gift { +export class Package { private options: PropConstructorOptions = DEFAULT_OPTIONS private networkMagic: number = -1 @@ -16,15 +16,15 @@ export class Gift { switch(options.network) { case NetworkOption.TestNet: this.options.node = 'https://testnet1.neo.coz.io:443' - this.options.scriptHash = '0x97857c01d64f846b5fe2eca2d09d2d73928b3f43' + this.options.scriptHash = '0x1f7bc3162ecb3fc77a508aa4f69b9d2e86b3add4' break case NetworkOption.MainNet: this.options.node = 'https://mainnet1.neo.coz.io:443' - this.options.scriptHash = '0x76a8f8a7a901b29a33013b469949f4b08db15756' + this.options.scriptHash = '0x5728017130c213cbc369c738f470d66628e5acf2' break default: this.options.node = 'http://127.0.0.1:50012' - this.options.scriptHash = '0x374fc3ca866761a01082186c71a6301d4ba2a363' + this.options.scriptHash = '0x5cd0c2173453211441095a921bf56d0b9cb09f33' break } this.options = merge({}, this.options, options) @@ -50,50 +50,50 @@ export class Gift { } async balanceOf(address: string, signer?: wallet.Account): Promise { - return GiftAPI.balanceOf(this.node.url, this.networkMagic, this.scriptHash, address, signer) + return PackageAPI.balanceOf(this.node.url, this.networkMagic, this.scriptHash, address, signer) } - async createEpoch(label: string, generatorInstanceId: number, initialRollCollectionId: number, mintFee: number, sysFee: number, maxSupply: number, signer: wallet.Account): Promise { - return GiftAPI.createEpoch(this.node.url, this.networkMagic, this.scriptHash, label, generatorInstanceId, initialRollCollectionId, mintFee, sysFee, maxSupply, signer) + async createEpoch(label: string, generatorInstanceId: number, chestId: number, mintFee: number, sysFee: number, maxSupply: number, signer: wallet.Account): Promise { + return PackageAPI.createEpoch(this.node.url, this.networkMagic, this.scriptHash, label, generatorInstanceId, chestId, mintFee, sysFee, maxSupply, signer) } async decimals(signer?: wallet.Account): Promise { - return GiftAPI.decimals(this.node.url, this.networkMagic, this.scriptHash, signer) + return PackageAPI.decimals(this.node.url, this.networkMagic, this.scriptHash, signer) } async deploy(signer: wallet.Account): Promise { - return GiftAPI.deploy(this.node.url, this.networkMagic, this.scriptHash, signer) + return PackageAPI.deploy(this.node.url, this.networkMagic, this.scriptHash, signer) } async getEpochJSON(epochId: number, signer?: wallet.Account): Promise { - return GiftAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId, signer) + return PackageAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId, signer) } - async getTokenJSON(tokenId: string, signer?: wallet.Account): Promise { - return GiftAPI.getTokenJSON(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) + async getTokenJSON(tokenId: string, signer?: wallet.Account): Promise { + return PackageAPI.getTokenJSON(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) } async getTokenRaw(tokenId: string, signer?: wallet.Account): Promise { - return GiftAPI.getTokenRaw(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) + return PackageAPI.getTokenRaw(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) } async ownerOf(tokenId: string, signer?: wallet.Account): Promise { - return GiftAPI.ownerOf(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) + return PackageAPI.ownerOf(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) } async offlineMint(epochId: number, owner: string, signer: wallet.Account): Promise { - return GiftAPI.offlineMint(this.node.url, this.networkMagic, this.scriptHash, epochId, owner, signer) + return PackageAPI.offlineMint(this.node.url, this.networkMagic, this.scriptHash, epochId, owner, signer) } - async properties(tokenId: string, signer?: wallet.Account): Promise { - return GiftAPI.properties(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) + async properties(tokenId: string, signer?: wallet.Account): Promise { + return PackageAPI.properties(this.node.url, this.networkMagic, this.scriptHash, tokenId, signer) } async purchase(epochId: number, signer: wallet.Account): Promise { const method = "transfer"; const GASScriptHash = "0xd2a4cff31913016155e38e474a2c06d08be276cf" - const epoch = await GiftAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId) + const epoch = await PackageAPI.getEpochJSON(this.node.url, this.networkMagic, this.scriptHash, epochId) const EpochTyped = epoch as unknown as EpochType if (EpochTyped.totalSupply === EpochTyped.maxSupply) { throw new Error(`Epoch is out of Tokens: ${EpochTyped.totalSupply} / ${EpochTyped.maxSupply}`) @@ -121,39 +121,39 @@ export class Gift { } async setMintFee(epochId: number, fee: number, signer: wallet.Account): Promise { - return GiftAPI.setMintFee(this.node.url, this.networkMagic, this.scriptHash, epochId, fee, signer) + return PackageAPI.setMintFee(this.node.url, this.networkMagic, this.scriptHash, epochId, fee, signer) } async symbol(signer?: wallet.Account): Promise { - return GiftAPI.symbol(this.node.url, this.networkMagic, this.scriptHash, signer) + return PackageAPI.symbol(this.node.url, this.networkMagic, this.scriptHash, signer) } async tokens(signer?: wallet.Account): Promise { - return GiftAPI.tokens(this.node.url, this.networkMagic, this.scriptHash, signer) + return PackageAPI.tokens(this.node.url, this.networkMagic, this.scriptHash, signer) } async tokensOf(address: string, signer?: wallet.Account): Promise { - return GiftAPI.tokensOf(this.node.url, this.networkMagic, this.scriptHash, address, signer) + return PackageAPI.tokensOf(this.node.url, this.networkMagic, this.scriptHash, address, signer) } async totalAccounts(signer?: wallet.Account): Promise { - return GiftAPI.totalAccounts(this.node.url, this.networkMagic, this.scriptHash, signer) + return PackageAPI.totalAccounts(this.node.url, this.networkMagic, this.scriptHash, signer) } async totalEpochs(signer?: wallet.Account): Promise { - return GiftAPI.totalEpochs(this.node.url, this.networkMagic, this.scriptHash, signer) + return PackageAPI.totalEpochs(this.node.url, this.networkMagic, this.scriptHash, signer) } async totalSupply(signer?: wallet.Account): Promise { - return GiftAPI.totalSupply(this.node.url, this.networkMagic, this.scriptHash, signer) + return PackageAPI.totalSupply(this.node.url, this.networkMagic, this.scriptHash, signer) } async transfer(to: string, tokenId: string, signer: wallet.Account, data: any): Promise { - return GiftAPI.transfer(this.node.url, this.networkMagic, this.scriptHash,to, tokenId, signer, data) + return PackageAPI.transfer(this.node.url, this.networkMagic, this.scriptHash,to, tokenId, signer, data) } async update(script: string, manifest: string, signer: wallet.Account): Promise { - return GiftAPI.update(this.node.url, this.networkMagic, this.scriptHash, script, manifest, '', signer) + return PackageAPI.update(this.node.url, this.networkMagic, this.scriptHash, script, manifest, '', signer) } } diff --git a/sdk/src/Puppet.ts b/sdk/src/Puppet.ts index d6e00bb..16d45f9 100644 --- a/sdk/src/Puppet.ts +++ b/sdk/src/Puppet.ts @@ -16,7 +16,7 @@ export class Puppet { switch(options.network) { case NetworkOption.TestNet: this.options.node = 'https://testnet1.neo.coz.io:443' - this.options.scriptHash = '0x97857c01d64f846b5fe2eca2d09d2d73928b3f43' + this.options.scriptHash = '' break case NetworkOption.MainNet: this.options.node = 'https://mainnet1.neo.coz.io:443' diff --git a/sdk/src/api/chest.ts b/sdk/src/api/chest.ts index 960213f..8f11dc0 100644 --- a/sdk/src/api/chest.ts +++ b/sdk/src/api/chest.ts @@ -19,10 +19,19 @@ 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": + value = sc.ContractParam.string(attr.value) + case "number": + value = sc.ContractParam.integer(attr.value) + } + return sc.ContractParam.array( sc.ContractParam.string(attr.logic), sc.ContractParam.string(attr.key), - sc.ContractParam.string(attr.value) + value ) }) diff --git a/sdk/src/api/index.ts b/sdk/src/api/index.ts index ef18fa0..a297c2e 100644 --- a/sdk/src/api/index.ts +++ b/sdk/src/api/index.ts @@ -4,5 +4,5 @@ export * from "./puppet"; export * from "./interface" export * from "./collection" export * from "./generator" -export * from "./gift" +export * from "./package" export * from "./template" \ No newline at end of file diff --git a/sdk/src/api/interface.ts b/sdk/src/api/interface.ts index 9caa3d2..2c76b2e 100644 --- a/sdk/src/api/interface.ts +++ b/sdk/src/api/interface.ts @@ -94,7 +94,6 @@ export class NeoInterface { try { result = await contract.invoke(operation, args); } catch (e) { - console.log("errored here"); console.log(e); } diff --git a/sdk/src/api/gift.ts b/sdk/src/api/package.ts similarity index 97% rename from sdk/src/api/gift.ts rename to sdk/src/api/package.ts index b1b1a5d..c153c51 100644 --- a/sdk/src/api/gift.ts +++ b/sdk/src/api/package.ts @@ -2,10 +2,10 @@ import {InteropInterface} from "./interface"; import Neon, { sc, u } from "@cityofzion/neon-js"; import { wallet } from "@cityofzion/neon-core"; import {StackItemJson, StackItemMapLike} from "@cityofzion/neon-core/lib/sc"; -import {EpochType, GiftType} from "../interface"; +import {EpochType, PackageType} from "../interface"; import {formatter, variableInvoke} from "../helpers"; -export class GiftAPI { +export class PackageAPI { /** * Returns the balance of an account @@ -38,7 +38,7 @@ export class GiftAPI { contractHash: string, label: string, generatorInstanceId: number, - initialRollCollectionId: number, + chestId: number, mintFee: number, sysFee: number, maxSupply: number, @@ -48,7 +48,7 @@ export class GiftAPI { const params = [ sc.ContractParam.string(label), sc.ContractParam.integer(generatorInstanceId), - sc.ContractParam.integer(initialRollCollectionId), + sc.ContractParam.integer(chestId), sc.ContractParam.integer(mintFee), sc.ContractParam.integer(sysFee), sc.ContractParam.integer(maxSupply) @@ -102,7 +102,7 @@ export class GiftAPI { contractHash: string, tokenId: string, signer?: wallet.Account - ): Promise { + ): Promise { const method = "get_token_json"; const param = [sc.ContractParam.string(tokenId)]; @@ -111,7 +111,7 @@ export class GiftAPI { return res } - return formatter(res[0]) as GiftType + return formatter(res[0]) as PackageType } static async getTokenJSONFlat( @@ -120,7 +120,7 @@ export class GiftAPI { contractHash: string, tokenId: string, signer?: wallet.Account - ): Promise { + ): Promise { const method = "get_token_json_flat"; const params = [sc.ContractParam.string(tokenId)]; const res = await variableInvoke(node, networkMagic, contractHash, method, params, signer) @@ -204,7 +204,7 @@ export class GiftAPI { contractHash: string, tokenId: string, signer?: wallet.Account - ): Promise { + ): Promise { const method = "properties"; const params = [sc.ContractParam.string(tokenId)]; const res = await variableInvoke(node, networkMagic, contractHash, method, params, signer) diff --git a/sdk/src/api/puppet.ts b/sdk/src/api/puppet.ts index 76da3f8..92b62b3 100644 --- a/sdk/src/api/puppet.ts +++ b/sdk/src/api/puppet.ts @@ -424,7 +424,7 @@ export class PuppetAPI { const method = "transfer"; const params = [ sc.ContractParam.hash160(toAddress), - sc.ContractParam.string(tokenId), + sc.ContractParam.byteArray(tokenId), data, ]; diff --git a/sdk/src/index.ts b/sdk/src/index.ts index 5fcb601..1d5865f 100644 --- a/sdk/src/index.ts +++ b/sdk/src/index.ts @@ -6,4 +6,5 @@ export * from "./Collection" export * from "./Dice" export * from "./Puppet" export * from "./Generator" +export * from "./Package" export * from "./Template" \ No newline at end of file diff --git a/sdk/src/interface/interface.ts b/sdk/src/interface/interface.ts index ab893d0..da625bc 100644 --- a/sdk/src/interface/interface.ts +++ b/sdk/src/interface/interface.ts @@ -74,7 +74,7 @@ export interface GeneratorType { traits: TraitType[] | string[] } -export interface GiftType { +export interface PackageType { description: string epoch: number image: string From 0150ea1287b3dccf8d020751bd7c77db61f4b49b Mon Sep 17 00:00:00 2001 From: lllwvlvwlll Date: Wed, 17 May 2023 08:13:02 -0600 Subject: [PATCH 8/9] 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 From b0de46d8c2fc0eaa6fc9ca16d119ebd16a532926 Mon Sep 17 00:00:00 2001 From: lllwvlvwlll Date: Wed, 17 May 2023 09:14:54 -0600 Subject: [PATCH 9/9] preflight for chest updates --- sdk/dist/Chest.d.ts | 5 +++-- sdk/dist/Chest.js | 13 ++++++++++++- sdk/dist/Chest.js.map | 2 +- sdk/dist/api/chest.d.ts | 2 +- sdk/dist/api/chest.js | 5 +++-- sdk/dist/api/chest.js.map | 2 +- sdk/dist/interface/interface.d.ts | 2 +- sdk/package-lock.json | 4 ++-- sdk/package.json | 2 +- sdk/src/Chest.ts | 29 +++++++++++++++++++++++++---- sdk/src/api/chest.ts | 2 +- sdk/test/integration/chest.js | 11 +++++++---- 12 files changed, 58 insertions(+), 21 deletions(-) diff --git a/sdk/dist/Chest.d.ts b/sdk/dist/Chest.d.ts index f7146c3..c3e41ab 100644 --- a/sdk/dist/Chest.d.ts +++ b/sdk/dist/Chest.d.ts @@ -33,11 +33,12 @@ export declare class Chest { * Create one of these pass throughs for each method you expose in your smart contract. The goal of this entire class is to * simplify the network configuration steps which can be complicated. */ - createChest(name: string, type: number, eligibilityCases: [EligibilityCase], signer: wallet.Account): Promise; + createChest(name: string, type: number, eligibilityCases: EligibilityCase[], signer: wallet.Account): Promise; isEligible(chestId: number, nftScriptHash: string, tokenId: string, signer?: wallet.Account): Promise; lootChest(chestId: number, nftScriptHash: string, tokenId: string, signer: wallet.Account): Promise; lootChestVerified(chestId: number, nftScriptHash: string, tokenId: string, signer: wallet.Account): Promise; lootChestAsOwner(chestId: number, signer: wallet.Account): Promise; getChestJSON(chestId: number, signer?: wallet.Account): Promise; - totalChests(name: string, type: number, signer?: wallet.Account): Promise; + totalChests(signer?: wallet.Account): Promise; + loadChestFungible(tokenScriptHash: string, chestId: number, transferAmount: number, amountPerReservoirItem: number, signer: wallet.Account): Promise; } diff --git a/sdk/dist/Chest.js b/sdk/dist/Chest.js index f45a198..0a9df82 100644 --- a/sdk/dist/Chest.js +++ b/sdk/dist/Chest.js @@ -106,9 +106,20 @@ class Chest { async getChestJSON(chestId, signer) { return api_1.ChestAPI.getChestJSON(this.node.url, this.networkMagic, this.scriptHash, chestId, signer); } - async totalChests(name, type, signer) { + async totalChests(signer) { return api_1.ChestAPI.totalChests(this.node.url, this.networkMagic, this.scriptHash, signer); } + async loadChestFungible(tokenScriptHash, chestId, transferAmount, amountPerReservoirItem, signer) { + const contractAddress = neon_core_1.wallet.getAddressFromScriptHash(this.scriptHash.slice(2)); + //transfer some GAS + const params = [ + neon_core_1.sc.ContractParam.hash160(signer.address), + neon_core_1.sc.ContractParam.hash160(contractAddress), + neon_core_1.sc.ContractParam.integer(transferAmount), + neon_core_1.sc.ContractParam.array(neon_core_1.sc.ContractParam.integer(chestId), neon_core_1.sc.ContractParam.integer(amountPerReservoirItem)) + ]; + return await (0, helpers_1.variableInvoke)(this.node.url, this.networkMagic, tokenScriptHash, "transfer", params, signer); + } } exports.Chest = Chest; //# sourceMappingURL=Chest.js.map \ No newline at end of file diff --git a/sdk/dist/Chest.js.map b/sdk/dist/Chest.js.map index 27fcc7c..f5d629a 100644 --- a/sdk/dist/Chest.js.map +++ b/sdk/dist/Chest.js.map @@ -1 +1 @@ -{"version":3,"file":"Chest.js","sourceRoot":"","sources":["../src/Chest.ts"],"names":[],"mappings":";;;AAAA,mCAA4B;AAC5B,qDAAoD;AACpD,+BAA2C;AAC3C,2CAAmF;AACnF,uCAA0D;AAE1D,MAAM,eAAe,GAA2B;IAC9C,OAAO,EAAE,yBAAa,CAAC,QAAQ;CAChC,CAAA;AAED;;;;GAIG;AAEH,MAAa,KAAK;IAIhB,iIAAiI;IACjI,0HAA0H;IAC1H,8GAA8G;IAC9G,YAAY,UAAkC,EAAE;QANxC,YAAO,GAA2B,eAAe,CAAA;QACjD,iBAAY,GAAW,CAAC,CAAC,CAAA;QAM/B,QAAO,OAAO,CAAC,OAAO,EAAE;YACtB,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP,KAAK,yBAAa,CAAC,OAAO;gBACxB,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,iCAAiC,CAAA;gBACrD,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,4CAA4C,CAAA;gBACtE,MAAK;YACP;gBACE,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,wBAAwB,CAAA;gBAC5C,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG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CAAC,OAAO,CAAC,cAAc,CAAC;YACxC,cAAE,CAAC,aAAa,CAAC,KAAK,CAClB,cAAE,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,EACjC,cAAE,CAAC,aAAa,CAAC,OAAO,CAAC,sBAAsB,CAAC,CACnD;SACF,CAAA;QACD,OAAO,MAAM,IAAA,wBAAc,EAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EACxD,eAAe,EACf,UAAU,EACV,MAAM,EACN,MAAM,CACT,CAAC;IACJ,CAAC;CACF;AA9HD,sBA8HC"} \ No newline at end of file diff --git a/sdk/dist/api/chest.d.ts b/sdk/dist/api/chest.d.ts index cda519c..a036f9c 100644 --- a/sdk/dist/api/chest.d.ts +++ b/sdk/dist/api/chest.d.ts @@ -1,7 +1,7 @@ import { wallet } from "@cityofzion/neon-core"; import { EligibilityCase } from "../interface"; export declare class ChestAPI { - static createChest(node: string, networkMagic: number, contractHash: string, name: string, chestType: number, eligibilityCases: [EligibilityCase], signer: wallet.Account): Promise; + static createChest(node: string, networkMagic: number, contractHash: string, name: string, chestType: number, eligibilityCases: EligibilityCase[], signer: wallet.Account): Promise; static isEligible(node: string, networkMagic: number, contractHash: string, chestId: number, nftSriptHash: string, tokenId: string, signer?: wallet.Account): Promise; static lootChest(node: string, networkMagic: number, contractHash: string, chestId: number, nftScriptHash: string, tokenId: string, signer: wallet.Account): Promise; static lootChestAsOwner(node: string, networkMagic: number, contractHash: string, chestId: number, signer: wallet.Account): Promise; diff --git a/sdk/dist/api/chest.js b/sdk/dist/api/chest.js index 397469d..0985958 100644 --- a/sdk/dist/api/chest.js +++ b/sdk/dist/api/chest.js @@ -11,9 +11,10 @@ class ChestAPI { const attributes = eligibilityCase.attributes.map((attr) => { let value = neon_js_1.sc.ContractParam.byteArray(''); switch (typeof attr.value) { - case "string": + case typeof "a": value = neon_js_1.sc.ContractParam.string(attr.value); - case "number": + break; + case typeof 1: value = neon_js_1.sc.ContractParam.integer(attr.value); } return neon_js_1.sc.ContractParam.array(neon_js_1.sc.ContractParam.string(attr.logic), neon_js_1.sc.ContractParam.string(attr.key), value); diff --git a/sdk/dist/api/chest.js.map b/sdk/dist/api/chest.js.map index 6244a7b..17c6c0c 100644 --- a/sdk/dist/api/chest.js.map +++ b/sdk/dist/api/chest.js.map @@ -1 +1 @@ -{"version":3,"file":"chest.js","sourceRoot":"","sources":["../../src/api/chest.ts"],"names":[],"mappings":";;;AAAA,iDAAuC;AACvC,qDAAgD;AAChD,wCAAqD;AAGrD,MAAa,QAAQ;IAEnB,MAAM,CAAC,KAAK,CAAC,WAAW,CACtB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,IAAY,EACZ,SAAiB,EACjB,gBAAmC,EACnC,MAAsB;QAEtB,MAAM,MAAM,GAAG,cAAc,CAAC;QAE9B,MAAM,KAAK,GAAG,gBAAgB,CAAC,GAAG,CAAE,CAAC,eAAgC,EAAE,EAAE;YAEvE,MAAM,UAAU,GAAG,eAAe,CAAC,UAAU,CAAC,GAAG,CAAE,CAAC,IAA0B,EAAE,EAAE;gBAEhF,IAAI,KAAK,GAAG,YAAE,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;gBAC1C,QAAQ,OAAO,IAAI,CAAC,KAAK,EAAE;oBACzB,KAAK,QAAQ;wBACX,KAAK,GAAG,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;oBAC7C,KAAK,QAAQ;wBACX,KAAK,GAAG,YAAE,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;iBAC/C;gBAED,OAAO,YAAE,CAAC,aAAa,CAAC,KAAK,CACzB,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EACnC,YAAE,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EACjC,KAAK,CACR,CAAA;YACH,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;YACV,OAAO,GAAG,CAAA;SACX;QACD,IAAI,YAAY,GAAG,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QACpC,MAAM,MAAM,GAAG,aAAC,CAAC,UAAU,CAAC,aAAC,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAA;QACjE,YAAY,CAAC,MAAM,GAAG,IAAI,kBAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAChD,OAAO,YAAY,CAAA;IACrB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,WAAW,CACtB,IAAY,EACZ,YAAoB,EACpB,YAAoB,EACpB,MAAuB;QAEvB,MAAM,MAAM,GAAG,cAAc,CAAC;QAE9B,MAAM,GAAG,GAAG,MAAM,IAAA,wBAAc,EAAC,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;QACtF,IAAI,MAAM,EAAE;YACV,OAAO,GAAG,CAAA;SACX;QACD,OAAO,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;CAEF;AA3JD,4BA2JC"} \ No newline at end of file diff --git a/sdk/dist/interface/interface.d.ts b/sdk/dist/interface/interface.d.ts index 18e62c1..92f9185 100644 --- a/sdk/dist/interface/interface.d.ts +++ b/sdk/dist/interface/interface.d.ts @@ -122,5 +122,5 @@ export interface EligibilityAttribute { } export interface EligibilityCase { scriptHash: string; - attributes: [EligibilityAttribute]; + attributes: EligibilityAttribute[]; } diff --git a/sdk/package-lock.json b/sdk/package-lock.json index cf2e191..f2befef 100644 --- a/sdk/package-lock.json +++ b/sdk/package-lock.json @@ -1,12 +1,12 @@ { "name": "@cityofzion/props", - "version": "0.1.9", + "version": "0.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@cityofzion/props", - "version": "0.1.9", + "version": "0.2.0", "license": "ISC", "dependencies": { "@cityofzion/neon-core": "^5.0.0-next.16", diff --git a/sdk/package.json b/sdk/package.json index ef2c543..39700c8 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@cityofzion/props", - "version": "0.2.0", + "version": "0.2.5", "description": "an sdk for interfacing with props to use in decentralized applications", "main": "dist/index", "types": "dist/index", diff --git a/sdk/src/Chest.ts b/sdk/src/Chest.ts index 1af4781..4b6e9a7 100644 --- a/sdk/src/Chest.ts +++ b/sdk/src/Chest.ts @@ -1,8 +1,9 @@ import {merge} from 'lodash' -import {rpc, u, wallet} from '@cityofzion/neon-core' +import {rpc, sc, u, wallet} from '@cityofzion/neon-core' import {ChestAPI, TemplateAPI} from './api' import {EligibilityCase, NetworkOption, PropConstructorOptions} from "./interface"; -import {formatter, sleep, txDidComplete} from "./helpers"; +import {formatter, sleep, txDidComplete, variableInvoke} from "./helpers"; +import Neon from "@cityofzion/neon-js"; const DEFAULT_OPTIONS: PropConstructorOptions = { network: NetworkOption.LocalNet @@ -79,7 +80,7 @@ export class Chest { * Create one of these pass throughs for each method you expose in your smart contract. The goal of this entire class is to * simplify the network configuration steps which can be complicated. */ - async createChest(name: string, type: number, eligibilityCases: [EligibilityCase], signer: wallet.Account): Promise { + async createChest(name: string, type: number, eligibilityCases: EligibilityCase[], signer: wallet.Account): Promise { return ChestAPI.createChest(this.node.url, this.networkMagic, this.scriptHash, name, type, eligibilityCases, signer) } @@ -116,8 +117,28 @@ export class Chest { return ChestAPI.getChestJSON(this.node.url, this.networkMagic, this.scriptHash, chestId, signer) } - async totalChests(name: string, type: number, signer?: wallet.Account): Promise { + async totalChests(signer?: wallet.Account): Promise { return ChestAPI.totalChests(this.node.url, this.networkMagic, this.scriptHash, signer) } + async loadChestFungible(tokenScriptHash: string, chestId: number, transferAmount: number, amountPerReservoirItem: number, signer: wallet.Account): Promise { + const contractAddress = wallet.getAddressFromScriptHash(this.scriptHash.slice(2)) + + //transfer some GAS + const params = [ + sc.ContractParam.hash160(signer.address), + sc.ContractParam.hash160(contractAddress), + sc.ContractParam.integer(transferAmount), + sc.ContractParam.array( + sc.ContractParam.integer(chestId), + sc.ContractParam.integer(amountPerReservoirItem) + ) + ] + return await variableInvoke(this.node.url, this.networkMagic, + tokenScriptHash, + "transfer", + params, + signer + ); + } } diff --git a/sdk/src/api/chest.ts b/sdk/src/api/chest.ts index d5becf8..42975fd 100644 --- a/sdk/src/api/chest.ts +++ b/sdk/src/api/chest.ts @@ -11,7 +11,7 @@ export class ChestAPI { contractHash: string, name: string, chestType: number, - eligibilityCases: [EligibilityCase], + eligibilityCases: EligibilityCase[], signer: wallet.Account, //this field can be optional if you are doing a test invocation(you arent changing contract state and dont rely on block entropy) ): Promise { const method = "create_chest"; diff --git a/sdk/test/integration/chest.js b/sdk/test/integration/chest.js index f81e709..02b05cb 100644 --- a/sdk/test/integration/chest.js +++ b/sdk/test/integration/chest.js @@ -18,6 +18,7 @@ describe("Basic Chest Test Suite", function() { const targetNetwork = sdk.types.NetworkOption.LocalNet chest = await new sdk.Chest({ + scriptHash: "0x9378d9f8add6e1d47e7af4d75c121a11a5e9f929", network: targetNetwork }) puppet = await new sdk.Puppet({ @@ -42,26 +43,28 @@ describe("Basic Chest Test Suite", function() { it("should create a new chest", async () => { this.timeout(0) - const cozWallet = network.wallets[0].wallet + const cozWallet = new Neon.wallet.Account('') + const lizard = '0xa6f144d552cc96103393b9ca4e34cc8fd384f4bf' const oldChestCount = await chest.totalChests() + console.log(oldChestCount) // create a chest and get the json const eligibilityCases = [ { - scriptHash: puppet.scriptHash.slice(2), + scriptHash: lizard.slice(2), attributes: [{ logic: 'e', key: 'traits.color', - value: 'blue' + value: "white" }] } ] - const txid = await chest.createChest("A test chest", 0, eligibilityCases, cozWallet) + console.log(txid) await sdk.helpers.sleep(TIME_CONSTANT) const res = await sdk.helpers.txDidComplete(chest.node.url, txid, true) console.log(res[0])