From b7838d42d1e267c5359893824c80874622143a22 Mon Sep 17 00:00:00 2001 From: Joon2000 Date: Sat, 1 Jun 2024 17:56:56 +0900 Subject: [PATCH] success --- .../NftMarketplace.approval.teal | 354 +++++++++ .../nft_marketplace/NftMarketplace.arc32.json | 111 +++ .../nft_marketplace/NftMarketplace.clear.teal | 7 + .../artifacts/nft_marketplace/client.ts | 719 ++++++++++++++++++ .../NftMarketplaceList.approval.teal | 256 +++++++ .../NftMarketplaceList.arc32.json | 89 +++ .../NftMarketplaceList.clear.teal | 7 + .../artifacts/nft_marketplace_list/client.ts | 639 ++++++++++++++++ .../nft_marketplace/contract.py | 46 +- .../src/contracts/NftMarketplace.ts | 719 ++++++++++++++++++ .../src/contracts/NftMarketplaceList.ts | 639 ++++++++++++++++ .../src/contracts/PersonalBank.ts | 714 +++++++++++++++++ .../src/methods.ts | 10 +- .../src/utils/getCurrentNftmClient.ts | 13 +- .../src/utils/marketplaceListAppId.ts | 2 +- 15 files changed, 4312 insertions(+), 13 deletions(-) create mode 100644 projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace/NftMarketplace.approval.teal create mode 100644 projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace/NftMarketplace.arc32.json create mode 100644 projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace/NftMarketplace.clear.teal create mode 100644 projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace/client.ts create mode 100644 projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace_list/NftMarketplaceList.approval.teal create mode 100644 projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace_list/NftMarketplaceList.arc32.json create mode 100644 projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace_list/NftMarketplaceList.clear.teal create mode 100644 projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace_list/client.ts create mode 100644 projects/orakle-nft-marketplace-app-frontend/src/contracts/NftMarketplace.ts create mode 100644 projects/orakle-nft-marketplace-app-frontend/src/contracts/NftMarketplaceList.ts create mode 100644 projects/orakle-nft-marketplace-app-frontend/src/contracts/PersonalBank.ts diff --git a/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace/NftMarketplace.approval.teal b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace/NftMarketplace.approval.teal new file mode 100644 index 0000000..e3cc30f --- /dev/null +++ b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace/NftMarketplace.approval.teal @@ -0,0 +1,354 @@ +#pragma version 10 + +smart_contracts.nft_marketplace.contract.NftMarketplace.approval_program: + txn ApplicationID + bnz main_entrypoint@2 + callsub __init__ + +main_entrypoint@2: + // smart_contracts/nft_marketplace/contract.py:20 + // class NftMarketplace(arc4.ARC4Contract): + txn NumAppArgs + bz main_bare_routing@9 + method "bootstrap(asset,uint64,pay)void" + method "buy(pay,uint64)void" + method "withdraw_and_delete()void" + txna ApplicationArgs 0 + match main_bootstrap_route@4 main_buy_route@5 main_withdraw_and_delete_route@6 + err // reject transaction + +main_bootstrap_route@4: + // smart_contracts/nft_marketplace/contract.py:96 + // @arc4.abimethod + txn OnCompletion + ! + assert // OnCompletion is NoOp + txn ApplicationID + assert // is not creating + // smart_contracts/nft_marketplace/contract.py:20 + // class NftMarketplace(arc4.ARC4Contract): + txna ApplicationArgs 1 + btoi + txnas Assets + txna ApplicationArgs 2 + btoi + txn GroupIndex + int 1 + - + dup + gtxns TypeEnum + int pay + == + assert // transaction type is pay + // smart_contracts/nft_marketplace/contract.py:96 + // @arc4.abimethod + callsub bootstrap + int 1 + return + +main_buy_route@5: + // smart_contracts/nft_marketplace/contract.py:147 + // @arc4.abimethod + txn OnCompletion + ! + assert // OnCompletion is NoOp + txn ApplicationID + assert // is not creating + // smart_contracts/nft_marketplace/contract.py:20 + // class NftMarketplace(arc4.ARC4Contract): + txn GroupIndex + int 1 + - + dup + gtxns TypeEnum + int pay + == + assert // transaction type is pay + txna ApplicationArgs 1 + btoi + // smart_contracts/nft_marketplace/contract.py:147 + // @arc4.abimethod + callsub buy + int 1 + return + +main_withdraw_and_delete_route@6: + // smart_contracts/nft_marketplace/contract.py:211 + // @arc4.abimethod(allow_actions=["DeleteApplication"]) + txn OnCompletion + int DeleteApplication + == + assert // OnCompletion is DeleteApplication + txn ApplicationID + assert // is not creating + callsub withdraw_and_delete + int 1 + return + +main_bare_routing@9: + // smart_contracts/nft_marketplace/contract.py:20 + // class NftMarketplace(arc4.ARC4Contract): + txn OnCompletion + ! + assert // reject transaction + txn ApplicationID + ! + assert // is creating + int 1 + return + + +// smart_contracts.nft_marketplace.contract.NftMarketplace.bootstrap(asset: uint64, unitary_price: uint64, mbr_pay: uint64) -> void: +bootstrap: + // smart_contracts/nft_marketplace/contract.py:96-99 + // @arc4.abimethod + // def bootstrap( + // self, asset: Asset, unitary_price: UInt64, mbr_pay: gtxn.PaymentTransaction + // ) -> None: + proto 3 0 + // smart_contracts/nft_marketplace/contract.py:100 + // assert Txn.sender == Global.creator_address + txn Sender + global CreatorAddress + == + assert + // smart_contracts/nft_marketplace/contract.py:101 + // assert self.bootstrapped == False + int 0 + byte "bootstrapped" + app_global_get_ex + assert // check bootstrapped exists + ! + assert + // smart_contracts/nft_marketplace/contract.py:102 + // assert mbr_pay.receiver == Global.current_application_address + frame_dig -1 + gtxns Receiver + global CurrentApplicationAddress + == + assert + // smart_contracts/nft_marketplace/contract.py:103 + // assert mbr_pay.amount == Global.asset_create_min_balance + Global.asset_opt_in_min_balance + frame_dig -1 + gtxns Amount + global AssetCreateMinBalance + global AssetOptInMinBalance + + + == + assert + // smart_contracts/nft_marketplace/contract.py:105 + // self.asset_id = asset.id + byte "asset_id" + frame_dig -3 + app_global_put + // smart_contracts/nft_marketplace/contract.py:106 + // self.unitary_price = unitary_price + byte "unitary_price" + frame_dig -2 + app_global_put + // smart_contracts/nft_marketplace/contract.py:107 + // self.bootstrapped = True + byte "bootstrapped" + int 1 + app_global_put + // smart_contracts/nft_marketplace/contract.py:109-113 + // itxn.AssetTransfer( + // xfer_asset = asset.id, + // asset_receiver = Global.current_application_address, + // asset_amount= 0, + // ).submit() + itxn_begin + // smart_contracts/nft_marketplace/contract.py:111 + // asset_receiver = Global.current_application_address, + global CurrentApplicationAddress + // smart_contracts/nft_marketplace/contract.py:112 + // asset_amount= 0, + int 0 + itxn_field AssetAmount + itxn_field AssetReceiver + frame_dig -3 + itxn_field XferAsset + // smart_contracts/nft_marketplace/contract.py:109 + // itxn.AssetTransfer( + int axfer + itxn_field TypeEnum + // smart_contracts/nft_marketplace/contract.py:109-113 + // itxn.AssetTransfer( + // xfer_asset = asset.id, + // asset_receiver = Global.current_application_address, + // asset_amount= 0, + // ).submit() + itxn_submit + retsub + + +// smart_contracts.nft_marketplace.contract.NftMarketplace.buy(buyer_txn: uint64, quantity: uint64) -> void: +buy: + // smart_contracts/nft_marketplace/contract.py:147-152 + // @arc4.abimethod + // def buy( + // self, + // buyer_txn: gtxn.PaymentTransaction, + // quantity: UInt64, + // ) -> None: + proto 2 0 + // smart_contracts/nft_marketplace/contract.py:154 + // assert self.bootstrapped == True + int 0 + byte "bootstrapped" + app_global_get_ex + assert // check bootstrapped exists + int 1 + == + assert + // smart_contracts/nft_marketplace/contract.py:155 + // assert buyer_txn.sender == Txn.sender + frame_dig -2 + gtxns Sender + dup + txn Sender + == + assert + // smart_contracts/nft_marketplace/contract.py:156 + // assert buyer_txn.receiver == Global.current_application_address + frame_dig -2 + gtxns Receiver + global CurrentApplicationAddress + == + assert + // smart_contracts/nft_marketplace/contract.py:157 + // assert buyer_txn.amount == self.unitary_price * quantity + frame_dig -2 + gtxns Amount + int 0 + byte "unitary_price" + app_global_get_ex + assert // check unitary_price exists + frame_dig -1 + * + == + assert + // smart_contracts/nft_marketplace/contract.py:159-163 + // itxn.AssetTransfer( + // xfer_asset = self.asset_id, + // asset_receiver = buyer_txn.sender, + // asset_amount= quantity, + // ).submit() + itxn_begin + // smart_contracts/nft_marketplace/contract.py:160 + // xfer_asset = self.asset_id, + int 0 + byte "asset_id" + app_global_get_ex + assert // check asset_id exists + frame_dig -1 + itxn_field AssetAmount + itxn_field XferAsset + itxn_field AssetReceiver + // smart_contracts/nft_marketplace/contract.py:159 + // itxn.AssetTransfer( + int axfer + itxn_field TypeEnum + // smart_contracts/nft_marketplace/contract.py:159-163 + // itxn.AssetTransfer( + // xfer_asset = self.asset_id, + // asset_receiver = buyer_txn.sender, + // asset_amount= quantity, + // ).submit() + itxn_submit + retsub + + +// smart_contracts.nft_marketplace.contract.NftMarketplace.withdraw_and_delete() -> void: +withdraw_and_delete: + // smart_contracts/nft_marketplace/contract.py:211-212 + // @arc4.abimethod(allow_actions=["DeleteApplication"]) + // def withdraw_and_delete(self) -> None: + proto 0 0 + // smart_contracts/nft_marketplace/contract.py:214 + // assert Txn.sender == Global.creator_address + txn Sender + global CreatorAddress + == + assert + // smart_contracts/nft_marketplace/contract.py:216-220 + // itxn.AssetTransfer( + // xfer_asset = self.asset_id, + // asset_receiver = Global.creator_address, + // asset_close_to= Global.creator_address, + // ).submit() + itxn_begin + // smart_contracts/nft_marketplace/contract.py:217 + // xfer_asset = self.asset_id, + int 0 + byte "asset_id" + app_global_get_ex + assert // check asset_id exists + // smart_contracts/nft_marketplace/contract.py:218 + // asset_receiver = Global.creator_address, + global CreatorAddress + // smart_contracts/nft_marketplace/contract.py:219 + // asset_close_to= Global.creator_address, + dup + itxn_field AssetCloseTo + itxn_field AssetReceiver + itxn_field XferAsset + // smart_contracts/nft_marketplace/contract.py:216 + // itxn.AssetTransfer( + int axfer + itxn_field TypeEnum + // smart_contracts/nft_marketplace/contract.py:216-220 + // itxn.AssetTransfer( + // xfer_asset = self.asset_id, + // asset_receiver = Global.creator_address, + // asset_close_to= Global.creator_address, + // ).submit() + itxn_submit + // smart_contracts/nft_marketplace/contract.py:222-225 + // itxn.Payment( + // receiver = Global.creator_address, + // close_remainder_to = Global.creator_address + // ).submit() + itxn_begin + // smart_contracts/nft_marketplace/contract.py:223 + // receiver = Global.creator_address, + global CreatorAddress + // smart_contracts/nft_marketplace/contract.py:224 + // close_remainder_to = Global.creator_address + dup + itxn_field CloseRemainderTo + itxn_field Receiver + // smart_contracts/nft_marketplace/contract.py:222 + // itxn.Payment( + int pay + itxn_field TypeEnum + // smart_contracts/nft_marketplace/contract.py:222-225 + // itxn.Payment( + // receiver = Global.creator_address, + // close_remainder_to = Global.creator_address + // ).submit() + itxn_submit + retsub + + +// smart_contracts.nft_marketplace.contract.NftMarketplace.__init__() -> void: +__init__: + // smart_contracts/nft_marketplace/contract.py:48 + // def __init__(self) -> None: + proto 0 0 + // smart_contracts/nft_marketplace/contract.py:50 + // self.asset_id = UInt64(0) + byte "asset_id" + int 0 + app_global_put + // smart_contracts/nft_marketplace/contract.py:51 + // self.unitary_price = UInt64(0) + byte "unitary_price" + int 0 + app_global_put + // smart_contracts/nft_marketplace/contract.py:52 + // self.bootstrapped = bool(False) + byte "bootstrapped" + int 0 + app_global_put + retsub diff --git a/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace/NftMarketplace.arc32.json b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace/NftMarketplace.arc32.json new file mode 100644 index 0000000..6700f94 --- /dev/null +++ b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace/NftMarketplace.arc32.json @@ -0,0 +1,111 @@ +{ + "hints": { + "bootstrap(asset,uint64,pay)void": { + "call_config": { + "no_op": "CALL" + } + }, + "buy(pay,uint64)void": { + "call_config": { + "no_op": "CALL" + } + }, + "withdraw_and_delete()void": { + "call_config": { + "delete_application": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgpzbWFydF9jb250cmFjdHMubmZ0X21hcmtldHBsYWNlLmNvbnRyYWN0Lk5mdE1hcmtldHBsYWNlLmFwcHJ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A9IFVJbnQ2NCgwKQogICAgYnl0ZSAidW5pdGFyeV9wcmljZSIKICAgIGludCAwCiAgICBhcHBfZ2xvYmFsX3B1dAogICAgLy8gc21hcnRfY29udHJhY3RzL25mdF9tYXJrZXRwbGFjZS9jb250cmFjdC5weTo1MgogICAgLy8gc2VsZi5ib290c3RyYXBwZWQgPSBib29sKEZhbHNlKQogICAgYnl0ZSAiYm9vdHN0cmFwcGVkIgogICAgaW50IDAKICAgIGFwcF9nbG9iYWxfcHV0CiAgICByZXRzdWIK", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgpzbWFydF9jb250cmFjdHMubmZ0X21hcmtldHBsYWNlLmNvbnRyYWN0Lk5mdE1hcmtldHBsYWNlLmNsZWFyX3N0YXRlX3Byb2dyYW06CiAgICAvLyBzbWFydF9jb250cmFjdHMvbmZ0X21hcmtldHBsYWNlL2NvbnRyYWN0LnB5OjIwCiAgICAvLyBjbGFzcyBOZnRNYXJrZXRwbGFjZShhcmM0LkFSQzRDb250cmFjdCk6CiAgICBpbnQgMQogICAgcmV0dXJuCg==" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 3 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": { + "asset_id": { + "type": "uint64", + "key": "asset_id" + }, + "bootstrapped": { + "type": "uint64", + "key": "bootstrapped" + }, + "unitary_price": { + "type": "uint64", + "key": "unitary_price" + } + }, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "NftMarketplace", + "desc": "\n \ubb38\uc81c 1\n NftMarketplace \uc571\uc758 \uc0c1\ud0dc(state)\ub97c \uc815\uc758\ud558\uace0 \ucd08\uae30\uac12\uc744 \uc124\uc815\ud558\uc138\uc694.\n\n NftMarketplace \uc571\uc740 \uc138\uac1c\uc758 \uc0c1\ud0dc\ub97c \uac00\uc9c0\uace0 \uc788\uc2b5\ub2c8\ub2e4.\n 1. asset_id: \ud310\ub9e4\ud560 \uc5d0\uc14b(ASA)\uc758 \uc544\uc774\ub514; UInt64\ud0c0\uc785\uc744 \uac00\uc9c4 \uae00\ub85c\ubc8c \uc0c1\ud0dc(Global State)\n - \ucd08\uae30\uac12\uc740 0\uc73c\ub85c \uc124\uc815\ud574\uc8fc\uc138\uc694.\n 2. unitary_price: \ud310\ub9e4\ud560 \uc5d0\uc14b(ASA)\uc758 \uac00\uaca9. UInt64\ud0c0\uc785\uc744 \uac00\uc9c4 \uae00\ub85c\ubc8c \uc0c1\ud0dc(Global State)\n - \ucd08\uae30\uac12\uc740 0\uc73c\ub85c \uc124\uc815\ud574\uc8fc\uc138\uc694.\n 3. bootstrapped: \uc571\uc5d0\uc11c \uc5d0\uc14b\uc744 \ud310\ub9e4\ud560 \uc900\ube44\uac00 \ub418\uc5c8\ub294\uc9c0 \uccb4\ud06c\ud558\ub294 bool \ud0c0\uc785\uc758 \uae00\ub85c\ubc8c \uc0c1\ud0dc(Global State). bootstrap \uba54\uc11c\ub4dc\uac00 \uc2e4\ud589\ub418\uba74 True\ub85c \ubcc0\uacbd\ub429\ub2c8\ub2e4.\n - \ucd08\uae30\uac12\uc740 False\ub85c \uc124\uc815\ud574\uc8fc\uc138\uc694.\n\n \uc7ac\ubc0c\ub294 \ud329\ud2b8!\n AVM\uc740 Bytes \ud0c0\uc785\uacfc UInt64 \ud0c0\uc785\ub9cc \uc9c0\uc6d0\ud569\ub2c8\ub2e4. \uadf8\ub798\uc11c \ub2e4\ub978 \ud0c0\uc785\uc744 \uc0ac\uc6a9\ud558\uace0 \uc2f6\uc73c\uba74 \ubcf4\ud1b5 arc4\ud0c0\uc785\uc744 \uc0ac\uc6a9\ud569\ub2c8\ub2e4. \ud558\uc9c0\ub9cc\n Algorand Python\uc5d0\uc11c\ub294 bool, string \ud0c0\uc785\uc740 \ud30c\uc774\uc36c \ucf54\ub4dc\uc640 \ub3d9\uc77c\ud558\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc608\ub97c \ub4e4\uc5b4 bool \ud0c0\uc785\uc740 True,\n False\ub85c \ud45c\ud604\ud558\uba74 \ub418\uace0, string \ud0c0\uc785\uc740 \"Hello, World!\"\uc640 \uac19\uc774 \ud45c\ud604\ud558\uba74 \ub429\ub2c8\ub2e4. Algorand Python\uc5d0\uc11c \ub370\uc774\ud130 \ud0c0\uc785\uc744\n \uc0ac\uc6a9\ud558\ub294 \ubc29\ubc95\uc740 \uc544\ub798 \ub9c1\ud06c\ub97c \ucc38\uace0\ud574\uc8fc\uc138\uc694.\n - Python Built in \ud0c0\uc785: https://algorandfoundation.github.io/puya/lg-types.html#python-built-in-types\n\n \ud301!\n - Global State\ub97c \uc815\uc758\ud560\ub54c simplifed \ubc84\uc804\uc73c\ub85c \uc815\uc758\ud558\uba74 \uac04\uacb0\ud55c \ucf54\ub4dc\ub85c \uc0c1\ud0dc\ub97c \uc815\uc758\ud558\uace0 \ucd08\uae30\uac12\uc744 \uc124\uc815\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n \uc790\uc138\ud55c \uc0ac\ud56d\uc740 \uc544\ub798 \ud78c\ud2b8 1\uc744 \ucc38\uace0\ud574\uc8fc\uc138\uc694.\n\n \ud78c\ud2b8 1 - \uae00\ub85c\ubc8c \uc0c1\ud0dc \uc124\uc815 \ubc29\ubc95: https://algorandfoundation.github.io/puya/lg-storage.html#global-storage\n \ud78c\ud2b8 2 - \ucf54\ub4dc \uc608\uc2dc: https://github.com/algorandfoundation/puya/blob/11843f6bc4bb6e4c56ac53e3980f74df69d07397/examples/global_state/contract.py#L5\n ", + "methods": [ + { + "name": "bootstrap", + "args": [ + { + "type": "asset", + "name": "asset" + }, + { + "type": "uint64", + "name": "unitary_price" + }, + { + "type": "pay", + "name": "mbr_pay" + } + ], + "returns": { + "type": "void" + } + }, + { + "name": "buy", + "args": [ + { + "type": "pay", + "name": "buyer_txn" + }, + { + "type": "uint64", + "name": "quantity" + } + ], + "returns": { + "type": "void" + }, + "desc": "\uc5ec\uae30\uc5d0 \ucf54\ub4dc \uc791\uc131" + }, + { + "name": "withdraw_and_delete", + "args": [], + "returns": { + "type": "void" + }, + "desc": "\uc5ec\uae30\uc5d0 \ucf54\ub4dc \uc791\uc131" + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} \ No newline at end of file diff --git a/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace/NftMarketplace.clear.teal b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace/NftMarketplace.clear.teal new file mode 100644 index 0000000..e79b7a3 --- /dev/null +++ b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace/NftMarketplace.clear.teal @@ -0,0 +1,7 @@ +#pragma version 10 + +smart_contracts.nft_marketplace.contract.NftMarketplace.clear_state_program: + // smart_contracts/nft_marketplace/contract.py:20 + // class NftMarketplace(arc4.ARC4Contract): + int 1 + return diff --git a/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace/client.ts b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace/client.ts new file mode 100644 index 0000000..3433ed8 --- /dev/null +++ b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace/client.ts @@ -0,0 +1,719 @@ +/* eslint-disable */ +/** + * This file was automatically generated by @algorandfoundation/algokit-client-generator. + * DO NOT MODIFY IT BY HAND. + * requires: @algorandfoundation/algokit-utils: ^2 + */ +import * as algokit from '@algorandfoundation/algokit-utils' +import type { + ABIAppCallArg, + AppCallTransactionResult, + AppCallTransactionResultOfType, + AppCompilationResult, + AppReference, + AppState, + AppStorageSchema, + CoreAppCallArgs, + RawAppCallArgs, + TealTemplateParams, +} from '@algorandfoundation/algokit-utils/types/app' +import type { + AppClientCallCoreParams, + AppClientCompilationParams, + AppClientDeployCoreParams, + AppDetails, + ApplicationClient, +} from '@algorandfoundation/algokit-utils/types/app-client' +import type { AppSpec } from '@algorandfoundation/algokit-utils/types/app-spec' +import type { SendTransactionResult, TransactionToSign, SendTransactionFrom, SendTransactionParams } from '@algorandfoundation/algokit-utils/types/transaction' +import type { ABIResult, TransactionWithSigner } from 'algosdk' +import { Algodv2, OnApplicationComplete, Transaction, AtomicTransactionComposer, modelsv2 } from 'algosdk' +export const APP_SPEC: AppSpec = { + "hints": { + "bootstrap(asset,uint64,pay)void": { + "call_config": { + "no_op": "CALL" + } + }, + "buy(pay,uint64)void": { + "call_config": { + "no_op": "CALL" + } + }, + "withdraw_and_delete()void": { + "call_config": { + "delete_application": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgpzbWFydF9jb250cmFjdHMubmZ0X21hcmtldHBsYWNlLmNvbnRyYWN0Lk5mdE1hcmtldHBsYWNlLmFwcHJvdmFsX3Byb2dyYW06CiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgYm56IG1haW5fZW50cnlwb2ludEAyCiAgICBjYWxsc3ViIF9faW5pdF9fCgptYWluX2VudHJ5cG9pbnRAMjoKICAgIC8vIHNtYXJ0X2NvbnRyYWN0cy9uZnRfbWFya2V0cGxhY2UvY29udHJhY3QucHk6MjAKICAgIC8vIGNsYXNzIE5mdE1hcmtldHBsYWNlKGFyYzQuQVJDNENvbnRyYWN0KToKICAgIHR4biBOdW1BcHBBcmdzCiAgICBieiBtYWluX2JhcmVfcm91dGluZ0A5CiAgICBtZXRob2QgImJvb3RzdHJhcChhc3NldCx1aW50NjQscGF5KXZvaWQiCiAgICBtZXRob2QgImJ1eShwYXksdWludDY0KXZvaWQiCiAgICBtZXRob2QgIndpdGhkcmF3X2FuZF9kZWxldGUoKXZvaWQiCiAgICB0eG5hIEFwcGxpY2F0aW9uQXJncyAwCiAgICBtYXRjaCBtYWluX2Jvb3RzdHJhcF9yb3V0ZUA0IG1haW5fYnV5X3JvdXRlQDUgbWFpbl93aXRoZHJhd19hbmRfZGVsZXRlX3JvdXRlQDYKIC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tldHBsYWNlLl9faW5pdF9fKCkgLT4gdm9pZDoKX19pbml0X186CiAgICAvLyBzbWFydF9jb250cmFjdHMvbmZ0X21hcmtldHBsYWNlL2NvbnRyYWN0LnB5OjQ4CiAgICAvLyBkZWYgX19pbml0X18oc2VsZikgLT4gTm9uZToKICAgIHByb3RvIDAgMAogICAgLy8gc21hcnRfY29udHJhY3RzL25mdF9tYXJrZXRwbGFjZS9jb250cmFjdC5weTo1MAogICAgLy8gc2VsZi5hc3NldF9pZCA9IFVJbnQ2NCgwKQogICAgYnl0ZSAiYXNzZXRfaWQiCiAgICBpbnQgMAogICAgYXBwX2dsb2JhbF9wdXQKICAgIC8vIHNtYXJ0X2NvbnRyYWN0cy9uZnRfbWFya2V0cGxhY2UvY29udHJhY3QucHk6NTEKICAgIC8vIHNlbGYudW5pdGFyeV9wcmljZSA9IFVJbnQ2NCgwKQogICAgYnl0ZSAidW5pdGFyeV9wcmljZSIKICAgIGludCAwCiAgICBhcHBfZ2xvYmFsX3B1dAogICAgLy8gc21hcnRfY29udHJhY3RzL25mdF9tYXJrZXRwbGFjZS9jb250cmFjdC5weTo1MgogICAgLy8gc2VsZi5ib290c3RyYXBwZWQgPSBib29sKEZhbHNlKQogICAgYnl0ZSAiYm9vdHN0cmFwcGVkIgogICAgaW50IDAKICAgIGFwcF9nbG9iYWxfcHV0CiAgICByZXRzdWIK", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgpzbWFydF9jb250cmFjdHMubmZ0X21hcmtldHBsYWNlLmNvbnRyYWN0Lk5mdE1hcmtldHBsYWNlLmNsZWFyX3N0YXRlX3Byb2dyYW06CiAgICAvLyBzbWFydF9jb250cmFjdHMvbmZ0X21hcmtldHBsYWNlL2NvbnRyYWN0LnB5OjIwCiAgICAvLyBjbGFzcyBOZnRNYXJrZXRwbGFjZShhcmM0LkFSQzRDb250cmFjdCk6CiAgICBpbnQgMQogICAgcmV0dXJuCg==" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 3 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": { + "asset_id": { + "type": "uint64", + "key": "asset_id" + }, + "bootstrapped": { + "type": "uint64", + "key": "bootstrapped" + }, + "unitary_price": { + "type": "uint64", + "key": "unitary_price" + } + }, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "NftMarketplace", + "desc": "\n 문제 1\n NftMarketplace 앱의 상태(state)를 정의하고 초기값을 설정하세요.\n\n NftMarketplace 앱은 세개의 상태를 가지고 있습니다.\n 1. asset_id: 판매할 에셋(ASA)의 아이디; UInt64타입을 가진 글로벌 상태(Global State)\n - 초기값은 0으로 설정해주세요.\n 2. unitary_price: 판매할 에셋(ASA)의 가격. UInt64타입을 가진 글로벌 상태(Global State)\n - 초기값은 0으로 설정해주세요.\n 3. bootstrapped: 앱에서 에셋을 판매할 준비가 되었는지 체크하는 bool 타입의 글로벌 상태(Global State). bootstrap 메서드가 실행되면 True로 변경됩니다.\n - 초기값은 False로 설정해주세요.\n\n 재밌는 팩트!\n AVM은 Bytes 타입과 UInt64 타입만 지원합니다. 그래서 다른 타입을 사용하고 싶으면 보통 arc4타입을 사용합니다. 하지만\n Algorand Python에서는 bool, string 타입은 파이썬 코드와 동일하게 사용할 수 있습니다. 예를 들어 bool 타입은 True,\n False로 표현하면 되고, string 타입은 \"Hello, World!\"와 같이 표현하면 됩니다. Algorand Python에서 데이터 타입을\n 사용하는 방법은 아래 링크를 참고해주세요.\n - Python Built in 타입: https://algorandfoundation.github.io/puya/lg-types.html#python-built-in-types\n\n 팁!\n - Global State를 정의할때 simplifed 버전으로 정의하면 간결한 코드로 상태를 정의하고 초기값을 설정할 수 있습니다.\n 자세한 사항은 아래 힌트 1을 참고해주세요.\n\n 힌트 1 - 글로벌 상태 설정 방법: https://algorandfoundation.github.io/puya/lg-storage.html#global-storage\n 힌트 2 - 코드 예시: https://github.com/algorandfoundation/puya/blob/11843f6bc4bb6e4c56ac53e3980f74df69d07397/examples/global_state/contract.py#L5\n ", + "methods": [ + { + "name": "bootstrap", + "args": [ + { + "type": "asset", + "name": "asset" + }, + { + "type": "uint64", + "name": "unitary_price" + }, + { + "type": "pay", + "name": "mbr_pay" + } + ], + "returns": { + "type": "void" + } + }, + { + "name": "buy", + "args": [ + { + "type": "pay", + "name": "buyer_txn" + }, + { + "type": "uint64", + "name": "quantity" + } + ], + "returns": { + "type": "void" + }, + "desc": "여기에 코드 작성" + }, + { + "name": "withdraw_and_delete", + "args": [], + "returns": { + "type": "void" + }, + "desc": "여기에 코드 작성" + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} + +/** + * Defines an onCompletionAction of 'no_op' + */ +export type OnCompleteNoOp = { onCompleteAction?: 'no_op' | OnApplicationComplete.NoOpOC } +/** + * Defines an onCompletionAction of 'opt_in' + */ +export type OnCompleteOptIn = { onCompleteAction: 'opt_in' | OnApplicationComplete.OptInOC } +/** + * Defines an onCompletionAction of 'close_out' + */ +export type OnCompleteCloseOut = { onCompleteAction: 'close_out' | OnApplicationComplete.CloseOutOC } +/** + * Defines an onCompletionAction of 'delete_application' + */ +export type OnCompleteDelApp = { onCompleteAction: 'delete_application' | OnApplicationComplete.DeleteApplicationOC } +/** + * Defines an onCompletionAction of 'update_application' + */ +export type OnCompleteUpdApp = { onCompleteAction: 'update_application' | OnApplicationComplete.UpdateApplicationOC } +/** + * A state record containing a single unsigned integer + */ +export type IntegerState = { + /** + * Gets the state value as a BigInt. + */ + asBigInt(): bigint + /** + * Gets the state value as a number. + */ + asNumber(): number +} +/** + * A state record containing binary data + */ +export type BinaryState = { + /** + * Gets the state value as a Uint8Array + */ + asByteArray(): Uint8Array + /** + * Gets the state value as a string + */ + asString(): string +} + +export type AppCreateCallTransactionResult = AppCallTransactionResult & Partial & AppReference +export type AppUpdateCallTransactionResult = AppCallTransactionResult & Partial + +export type AppClientComposeCallCoreParams = Omit & { + sendParams?: Omit +} +export type AppClientComposeExecuteParams = Pick + +export type IncludeSchema = { + /** + * Any overrides for the storage schema to request for the created app; by default the schema indicated by the app spec is used. + */ + schema?: Partial +} + +/** + * Defines the types of available calls and state of the NftMarketplace smart contract. + */ +export type NftMarketplace = { + /** + * Maps method signatures / names to their argument and return types. + */ + methods: + & Record<'bootstrap(asset,uint64,pay)void' | 'bootstrap', { + argsObj: { + asset: number | bigint + unitaryPrice: bigint | number + mbrPay: TransactionToSign | Transaction | Promise + } + argsTuple: [asset: number | bigint, unitaryPrice: bigint | number, mbrPay: TransactionToSign | Transaction | Promise] + returns: void + }> + & Record<'buy(pay,uint64)void' | 'buy', { + argsObj: { + buyerTxn: TransactionToSign | Transaction | Promise + quantity: bigint | number + } + argsTuple: [buyerTxn: TransactionToSign | Transaction | Promise, quantity: bigint | number] + returns: void + }> + & Record<'withdraw_and_delete()void' | 'withdraw_and_delete', { + argsObj: { + } + argsTuple: [] + returns: void + }> + /** + * Defines the shape of the global and local state of the application. + */ + state: { + global: { + assetId?: IntegerState + bootstrapped?: IntegerState + unitaryPrice?: IntegerState + } + } +} +/** + * Defines the possible abi call signatures + */ +export type NftMarketplaceSig = keyof NftMarketplace['methods'] +/** + * Defines an object containing all relevant parameters for a single call to the contract. Where TSignature is undefined, a bare call is made + */ +export type TypedCallParams = { + method: TSignature + methodArgs: TSignature extends undefined ? undefined : Array +} & AppClientCallCoreParams & CoreAppCallArgs +/** + * Defines the arguments required for a bare call + */ +export type BareCallArgs = Omit +/** + * Maps a method signature from the NftMarketplace smart contract to the method's arguments in either tuple of struct form + */ +export type MethodArgs = NftMarketplace['methods'][TSignature]['argsObj' | 'argsTuple'] +/** + * Maps a method signature from the NftMarketplace smart contract to the method's return type + */ +export type MethodReturn = NftMarketplace['methods'][TSignature]['returns'] + +/** + * A factory for available 'create' calls + */ +export type NftMarketplaceCreateCalls = (typeof NftMarketplaceCallFactory)['create'] +/** + * Defines supported create methods for this smart contract + */ +export type NftMarketplaceCreateCallParams = + | (TypedCallParams & (OnCompleteNoOp)) +/** + * A factory for available 'delete' calls + */ +export type NftMarketplaceDeleteCalls = (typeof NftMarketplaceCallFactory)['delete'] +/** + * Defines supported delete methods for this smart contract + */ +export type NftMarketplaceDeleteCallParams = + | TypedCallParams<'withdraw_and_delete()void'> +/** + * Defines arguments required for the deploy method. + */ +export type NftMarketplaceDeployArgs = { + deployTimeParams?: TealTemplateParams + /** + * A delegate which takes a create call factory and returns the create call params for this smart contract + */ + createCall?: (callFactory: NftMarketplaceCreateCalls) => NftMarketplaceCreateCallParams + /** + * A delegate which takes a delete call factory and returns the delete call params for this smart contract + */ + deleteCall?: (callFactory: NftMarketplaceDeleteCalls) => NftMarketplaceDeleteCallParams +} + + +/** + * Exposes methods for constructing all available smart contract calls + */ +export abstract class NftMarketplaceCallFactory { + /** + * Gets available create call factories + */ + static get create() { + return { + /** + * Constructs a create call for the NftMarketplace smart contract using a bare call + * + * @param params Any parameters for the call + * @returns A TypedCallParams object for the call + */ + bare(params: BareCallArgs & AppClientCallCoreParams & CoreAppCallArgs & AppClientCompilationParams & (OnCompleteNoOp) = {}) { + return { + method: undefined, + methodArgs: undefined, + ...params, + } + }, + } + } + + /** + * Gets available delete call factories + */ + static get delete() { + return { + /** + * Constructs a delete call for the NftMarketplace smart contract using the withdraw_and_delete()void ABI method + * + * @param args Any args for the contract call + * @param params Any additional parameters for the call + * @returns A TypedCallParams object for the call + */ + withdrawAndDelete(args: MethodArgs<'withdraw_and_delete()void'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return { + method: 'withdraw_and_delete()void' as const, + methodArgs: Array.isArray(args) ? args : [], + ...params, + } + }, + } + } + + /** + * Constructs a no op call for the bootstrap(asset,uint64,pay)void ABI method + * + * @param args Any args for the contract call + * @param params Any additional parameters for the call + * @returns A TypedCallParams object for the call + */ + static bootstrap(args: MethodArgs<'bootstrap(asset,uint64,pay)void'>, params: AppClientCallCoreParams & CoreAppCallArgs) { + return { + method: 'bootstrap(asset,uint64,pay)void' as const, + methodArgs: Array.isArray(args) ? args : [args.asset, args.unitaryPrice, args.mbrPay], + ...params, + } + } + /** + * Constructs a no op call for the buy(pay,uint64)void ABI method + * + * 여기에 코드 작성 + * + * @param args Any args for the contract call + * @param params Any additional parameters for the call + * @returns A TypedCallParams object for the call + */ + static buy(args: MethodArgs<'buy(pay,uint64)void'>, params: AppClientCallCoreParams & CoreAppCallArgs) { + return { + method: 'buy(pay,uint64)void' as const, + methodArgs: Array.isArray(args) ? args : [args.buyerTxn, args.quantity], + ...params, + } + } +} + +/** + * A client to make calls to the NftMarketplace smart contract + */ +export class NftMarketplaceClient { + /** + * The underlying `ApplicationClient` for when you want to have more flexibility + */ + public readonly appClient: ApplicationClient + + private readonly sender: SendTransactionFrom | undefined + + /** + * Creates a new instance of `NftMarketplaceClient` + * + * @param appDetails appDetails The details to identify the app to deploy + * @param algod An algod client instance + */ + constructor(appDetails: AppDetails, private algod: Algodv2) { + this.sender = appDetails.sender + this.appClient = algokit.getAppClient({ + ...appDetails, + app: APP_SPEC + }, algod) + } + + /** + * Checks for decode errors on the AppCallTransactionResult and maps the return value to the specified generic type + * + * @param result The AppCallTransactionResult to be mapped + * @param returnValueFormatter An optional delegate to format the return value if required + * @returns The smart contract response with an updated return value + */ + protected mapReturnValue(result: AppCallTransactionResult, returnValueFormatter?: (value: any) => TReturn): AppCallTransactionResultOfType & TResult { + if(result.return?.decodeError) { + throw result.return.decodeError + } + const returnValue = result.return?.returnValue !== undefined && returnValueFormatter !== undefined + ? returnValueFormatter(result.return.returnValue) + : result.return?.returnValue as TReturn | undefined + return { ...result, return: returnValue } as AppCallTransactionResultOfType & TResult + } + + /** + * Calls the ABI method with the matching signature using an onCompletion code of NO_OP + * + * @param typedCallParams An object containing the method signature, args, and any other relevant parameters + * @param returnValueFormatter An optional delegate which when provided will be used to map non-undefined return values to the target type + * @returns The result of the smart contract call + */ + public async call(typedCallParams: TypedCallParams, returnValueFormatter?: (value: any) => MethodReturn) { + return this.mapReturnValue>(await this.appClient.call(typedCallParams), returnValueFormatter) + } + + /** + * Idempotently deploys the NftMarketplace smart contract. + * + * @param params The arguments for the contract calls and any additional parameters for the call + * @returns The deployment result + */ + public deploy(params: NftMarketplaceDeployArgs & AppClientDeployCoreParams & IncludeSchema = {}): ReturnType { + const createArgs = params.createCall?.(NftMarketplaceCallFactory.create) + const deleteArgs = params.deleteCall?.(NftMarketplaceCallFactory.delete) + return this.appClient.deploy({ + ...params, + deleteArgs, + createArgs, + createOnCompleteAction: createArgs?.onCompleteAction, + }) + } + + /** + * Gets available create methods + */ + public get create() { + const $this = this + return { + /** + * Creates a new instance of the NftMarketplace smart contract using a bare call. + * + * @param args The arguments for the bare call + * @returns The create result + */ + async bare(args: BareCallArgs & AppClientCallCoreParams & AppClientCompilationParams & IncludeSchema & CoreAppCallArgs & (OnCompleteNoOp) = {}) { + return $this.mapReturnValue(await $this.appClient.create(args)) + }, + } + } + + /** + * Gets available delete methods + */ + public get delete() { + const $this = this + return { + /** + * Deletes an existing instance of the NftMarketplace smart contract using the withdraw_and_delete()void ABI method. + * + * @param args The arguments for the smart contract call + * @param params Any additional parameters for the call + * @returns The delete result + */ + async withdrawAndDelete(args: MethodArgs<'withdraw_and_delete()void'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return $this.mapReturnValue>(await $this.appClient.delete(NftMarketplaceCallFactory.delete.withdrawAndDelete(args, params))) + }, + } + } + + /** + * Makes a clear_state call to an existing instance of the NftMarketplace smart contract. + * + * @param args The arguments for the bare call + * @returns The clear_state result + */ + public clearState(args: BareCallArgs & AppClientCallCoreParams & CoreAppCallArgs = {}) { + return this.appClient.clearState(args) + } + + /** + * Calls the bootstrap(asset,uint64,pay)void ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The result of the call + */ + public bootstrap(args: MethodArgs<'bootstrap(asset,uint64,pay)void'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return this.call(NftMarketplaceCallFactory.bootstrap(args, params)) + } + + /** + * Calls the buy(pay,uint64)void ABI method. + * + * 여기에 코드 작성 + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The result of the call + */ + public buy(args: MethodArgs<'buy(pay,uint64)void'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return this.call(NftMarketplaceCallFactory.buy(args, params)) + } + + /** + * Extracts a binary state value out of an AppState dictionary + * + * @param state The state dictionary containing the state value + * @param key The key of the state value + * @returns A BinaryState instance containing the state value, or undefined if the key was not found + */ + private static getBinaryState(state: AppState, key: string): BinaryState | undefined { + const value = state[key] + if (!value) return undefined + if (!('valueRaw' in value)) + throw new Error(`Failed to parse state value for ${key}; received an int when expected a byte array`) + return { + asString(): string { + return value.value + }, + asByteArray(): Uint8Array { + return value.valueRaw + } + } + } + + /** + * Extracts a integer state value out of an AppState dictionary + * + * @param state The state dictionary containing the state value + * @param key The key of the state value + * @returns An IntegerState instance containing the state value, or undefined if the key was not found + */ + private static getIntegerState(state: AppState, key: string): IntegerState | undefined { + const value = state[key] + if (!value) return undefined + if ('valueRaw' in value) + throw new Error(`Failed to parse state value for ${key}; received a byte array when expected a number`) + return { + asBigInt() { + return typeof value.value === 'bigint' ? value.value : BigInt(value.value) + }, + asNumber(): number { + return typeof value.value === 'bigint' ? Number(value.value) : value.value + }, + } + } + + /** + * Returns the smart contract's global state wrapped in a strongly typed accessor with options to format the stored value + */ + public async getGlobalState(): Promise { + const state = await this.appClient.getGlobalState() + return { + get assetId() { + return NftMarketplaceClient.getIntegerState(state, 'asset_id') + }, + get bootstrapped() { + return NftMarketplaceClient.getIntegerState(state, 'bootstrapped') + }, + get unitaryPrice() { + return NftMarketplaceClient.getIntegerState(state, 'unitary_price') + }, + } + } + + public compose(): NftMarketplaceComposer { + const client = this + const atc = new AtomicTransactionComposer() + let promiseChain:Promise = Promise.resolve() + const resultMappers: Array any)> = [] + return { + bootstrap(args: MethodArgs<'bootstrap(asset,uint64,pay)void'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) { + promiseChain = promiseChain.then(() => client.bootstrap(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return this + }, + buy(args: MethodArgs<'buy(pay,uint64)void'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) { + promiseChain = promiseChain.then(() => client.buy(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return this + }, + get delete() { + const $this = this + return { + withdrawAndDelete(args: MethodArgs<'withdraw_and_delete()void'>, params?: AppClientComposeCallCoreParams) { + promiseChain = promiseChain.then(() => client.delete.withdrawAndDelete(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return $this + }, + } + }, + clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs) { + promiseChain = promiseChain.then(() => client.clearState({...args, sendParams: {...args?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return this + }, + addTransaction(txn: TransactionWithSigner | TransactionToSign | Transaction | Promise, defaultSender?: SendTransactionFrom) { + promiseChain = promiseChain.then(async () => atc.addTransaction(await algokit.getTransactionWithSigner(txn, defaultSender ?? client.sender))) + return this + }, + async atc() { + await promiseChain + return atc + }, + async simulate(options?: SimulateOptions) { + await promiseChain + const result = await atc.simulate(client.algod, new modelsv2.SimulateRequest({ txnGroups: [], ...options })) + return { + ...result, + returns: result.methodResults?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val.returnValue) : val.returnValue) + } + }, + async execute(sendParams?: AppClientComposeExecuteParams) { + await promiseChain + const result = await algokit.sendAtomicTransactionComposer({ atc, sendParams }, client.algod) + return { + ...result, + returns: result.returns?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val.returnValue) : val.returnValue) + } + } + } as unknown as NftMarketplaceComposer + } +} +export type NftMarketplaceComposer = { + /** + * Calls the bootstrap(asset,uint64,pay)void ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + bootstrap(args: MethodArgs<'bootstrap(asset,uint64,pay)void'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): NftMarketplaceComposer<[...TReturns, MethodReturn<'bootstrap(asset,uint64,pay)void'>]> + + /** + * Calls the buy(pay,uint64)void ABI method. + * + * 여기에 코드 작성 + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + buy(args: MethodArgs<'buy(pay,uint64)void'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): NftMarketplaceComposer<[...TReturns, MethodReturn<'buy(pay,uint64)void'>]> + + /** + * Gets available delete methods + */ + readonly delete: { + /** + * Deletes an existing instance of the NftMarketplace smart contract using the withdraw_and_delete()void ABI method. + * + * @param args The arguments for the smart contract call + * @param params Any additional parameters for the call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + withdrawAndDelete(args: MethodArgs<'withdraw_and_delete()void'>, params?: AppClientComposeCallCoreParams): NftMarketplaceComposer<[...TReturns, MethodReturn<'withdraw_and_delete()void'>]> + } + + /** + * Makes a clear_state call to an existing instance of the NftMarketplace smart contract. + * + * @param args The arguments for the bare call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs): NftMarketplaceComposer<[...TReturns, undefined]> + + /** + * Adds a transaction to the composer + * + * @param txn One of: A TransactionWithSigner object (returned as is), a TransactionToSign object (signer is obtained from the signer property), a Transaction object (signer is extracted from the defaultSender parameter), an async SendTransactionResult returned by one of algokit utils helpers (signer is obtained from the defaultSender parameter) + * @param defaultSender The default sender to be used to obtain a signer where the object provided to the transaction parameter does not include a signer. + */ + addTransaction(txn: TransactionWithSigner | TransactionToSign | Transaction | Promise, defaultSender?: SendTransactionFrom): NftMarketplaceComposer + /** + * Returns the underlying AtomicTransactionComposer instance + */ + atc(): Promise + /** + * Simulates the transaction group and returns the result + */ + simulate(options?: SimulateOptions): Promise> + /** + * Executes the transaction group and returns the results + */ + execute(sendParams?: AppClientComposeExecuteParams): Promise> +} +export type SimulateOptions = Omit[0], 'txnGroups'> +export type NftMarketplaceComposerSimulateResult = { + returns: TReturns + methodResults: ABIResult[] + simulateResponse: modelsv2.SimulateResponse +} +export type NftMarketplaceComposerResults = { + returns: TReturns + groupId: string + txIds: string[] + transactions: Transaction[] +} diff --git a/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace_list/NftMarketplaceList.approval.teal b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace_list/NftMarketplaceList.approval.teal new file mode 100644 index 0000000..a5b8bf4 --- /dev/null +++ b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace_list/NftMarketplaceList.approval.teal @@ -0,0 +1,256 @@ +#pragma version 10 + +smart_contracts.nft_marketplace_list.contract.NftMarketplaceList.approval_program: + txn ApplicationID + bnz main_entrypoint@2 + callsub __init__ + +main_entrypoint@2: + // smart_contracts/nft_marketplace_list/contract.py:9 + // class NftMarketplaceList(ARC4Contract): + txn NumAppArgs + bz main_bare_routing@9 + method "add_marketplace_to_list(uint64)uint64[]" + method "remove_marketplace_from_list(uint64)uint64[]" + method "read_marketplace_list()uint64[]" + txna ApplicationArgs 0 + match main_add_marketplace_to_list_route@4 main_remove_marketplace_from_list_route@5 main_read_marketplace_list_route@6 + err // reject transaction + +main_add_marketplace_to_list_route@4: + // smart_contracts/nft_marketplace_list/contract.py:14 + // @arc4.abimethod() + txn OnCompletion + ! + assert // OnCompletion is NoOp + txn ApplicationID + assert // is not creating + // smart_contracts/nft_marketplace_list/contract.py:9 + // class NftMarketplaceList(ARC4Contract): + txna ApplicationArgs 1 + btoi + // smart_contracts/nft_marketplace_list/contract.py:14 + // @arc4.abimethod() + callsub add_marketplace_to_list + byte 0x151f7c75 + swap + concat + log + int 1 + return + +main_remove_marketplace_from_list_route@5: + // smart_contracts/nft_marketplace_list/contract.py:19 + // @arc4.abimethod() + txn OnCompletion + ! + assert // OnCompletion is NoOp + txn ApplicationID + assert // is not creating + // smart_contracts/nft_marketplace_list/contract.py:9 + // class NftMarketplaceList(ARC4Contract): + txna ApplicationArgs 1 + btoi + // smart_contracts/nft_marketplace_list/contract.py:19 + // @arc4.abimethod() + callsub remove_marketplace_from_list + byte 0x151f7c75 + swap + concat + log + int 1 + return + +main_read_marketplace_list_route@6: + // smart_contracts/nft_marketplace_list/contract.py:32 + // @arc4.abimethod(readonly=True) + txn OnCompletion + ! + assert // OnCompletion is NoOp + txn ApplicationID + assert // is not creating + callsub read_marketplace_list + byte 0x151f7c75 + swap + concat + log + int 1 + return + +main_bare_routing@9: + // smart_contracts/nft_marketplace_list/contract.py:9 + // class NftMarketplaceList(ARC4Contract): + txn OnCompletion + ! + assert // reject transaction + txn ApplicationID + ! + assert // is creating + int 1 + return + + +// smart_contracts.nft_marketplace_list.contract.NftMarketplaceList.add_marketplace_to_list(app_id: uint64) -> bytes: +add_marketplace_to_list: + // smart_contracts/nft_marketplace_list/contract.py:14-15 + // @arc4.abimethod() + // def add_marketplace_to_list(self, app_id: UInt64) -> app_id_list: + proto 1 1 + // smart_contracts/nft_marketplace_list/contract.py:16 + // self.marketplace_list.append(arc4.UInt64(app_id)) + int 0 + byte "marketplace_list" + app_global_get_ex + assert // check marketplace_list exists + extract 2 0 + frame_dig -1 + itob + concat + dup + len + int 8 + / + itob + extract 6 0 + swap + concat + byte "marketplace_list" + swap + app_global_put + // smart_contracts/nft_marketplace_list/contract.py:17 + // return self.marketplace_list + int 0 + byte "marketplace_list" + app_global_get_ex + assert // check marketplace_list exists + retsub + + +// smart_contracts.nft_marketplace_list.contract.NftMarketplaceList.remove_marketplace_from_list(app_id: uint64) -> bytes: +remove_marketplace_from_list: + // smart_contracts/nft_marketplace_list/contract.py:19-20 + // @arc4.abimethod() + // def remove_marketplace_from_list(self, app_id: UInt64) -> app_id_list: + proto 1 1 + int 0 + dup + // smart_contracts/nft_marketplace_list/contract.py:21 + // new_list = app_id_list() + byte 0x0000 + // smart_contracts/nft_marketplace_list/contract.py:22 + // for i in urange(self.marketplace_list.length): + int 0 + byte "marketplace_list" + app_global_get_ex + assert // check marketplace_list exists + int 0 + extract_uint16 + int 0 + +remove_marketplace_from_list_for_header@1: + // smart_contracts/nft_marketplace_list/contract.py:22 + // for i in urange(self.marketplace_list.length): + frame_dig 4 + frame_dig 3 + < + bz remove_marketplace_from_list_after_for@7 + // smart_contracts/nft_marketplace_list/contract.py:23 + // current_app_id = self.marketplace_list[i] + int 0 + byte "marketplace_list" + app_global_get_ex + assert // check marketplace_list exists + dup + int 0 + extract_uint16 + frame_dig 4 + dup + uncover 2 + < + assert // Index access is out of bounds + swap + extract 2 0 + swap + int 8 + * + int 8 + extract3 + dup + frame_bury 0 + // smart_contracts/nft_marketplace_list/contract.py:25 + // if current_app_id != app_id: + frame_dig -1 + itob + b!= + frame_dig 2 + frame_bury 1 + bz remove_marketplace_from_list_after_if_else@4 + // smart_contracts/nft_marketplace_list/contract.py:26 + // new_list.append(current_app_id) + frame_dig 2 + extract 2 0 + frame_dig 0 + concat + dup + len + int 8 + / + itob + extract 6 0 + swap + concat + frame_bury 1 + +remove_marketplace_from_list_after_if_else@4: + frame_dig 1 + frame_bury 2 + // smart_contracts/nft_marketplace_list/contract.py:22 + // for i in urange(self.marketplace_list.length): + frame_dig 4 + int 1 + + + frame_bury 4 + b remove_marketplace_from_list_for_header@1 + +remove_marketplace_from_list_after_for@7: + // smart_contracts/nft_marketplace_list/contract.py:28 + // self.marketplace_list = new_list.copy() + byte "marketplace_list" + frame_dig 2 + app_global_put + // smart_contracts/nft_marketplace_list/contract.py:30 + // return self.marketplace_list + int 0 + byte "marketplace_list" + app_global_get_ex + assert // check marketplace_list exists + frame_bury 0 + retsub + + +// smart_contracts.nft_marketplace_list.contract.NftMarketplaceList.read_marketplace_list() -> bytes: +read_marketplace_list: + // smart_contracts/nft_marketplace_list/contract.py:32-33 + // @arc4.abimethod(readonly=True) + // def read_marketplace_list(self) -> app_id_list: + proto 0 1 + // smart_contracts/nft_marketplace_list/contract.py:34 + // return self.marketplace_list + int 0 + byte "marketplace_list" + app_global_get_ex + assert // check marketplace_list exists + retsub + + +// smart_contracts.nft_marketplace_list.contract.NftMarketplaceList.__init__() -> void: +__init__: + // smart_contracts/nft_marketplace_list/contract.py:11 + // def __init__(self) -> None: + proto 0 0 + // smart_contracts/nft_marketplace_list/contract.py:12 + // self.marketplace_list = app_id_list() + byte "marketplace_list" + byte 0x0000 + app_global_put + retsub diff --git a/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace_list/NftMarketplaceList.arc32.json b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace_list/NftMarketplaceList.arc32.json new file mode 100644 index 0000000..f92d11a --- /dev/null +++ b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace_list/NftMarketplaceList.arc32.json @@ -0,0 +1,89 @@ +{ + "hints": { + "add_marketplace_to_list(uint64)uint64[]": { + "call_config": { + "no_op": "CALL" + } + }, + "remove_marketplace_from_list(uint64)uint64[]": { + "call_config": { + "no_op": "CALL" + } + }, + "read_marketplace_list()uint64[]": { + "read_only": true, + "call_config": { + "no_op": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgpzbWFydF9jb250cmFjdHMubmZ0X21hcmtldHBsYWNlX2xpc3QuY29udHJhY3QuTmZ0TWFya2V0cGxhY2VMaXN0LmFwcHJvdmFsX3Byb2dyYW06CiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgYm56IG1haW5fZW50cnlwb2ludEAyCiAgICBjYWxsc3ViIF9faW5pdF9fCgptYWluX2VudHJ5cG9pbnRAMjoKICAgIC8vIHNtYXJ0X2NvbnRyYWN0cy9uZnRfbWFya2V0cGxhY2VfbGlzdC9jb250cmFjdC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ydF9jb250cmFjdHMubmZ0X21hcmtldHBsYWNlX2xpc3QuY29udHJhY3QuTmZ0TWFya2V0cGxhY2VMaXN0LmNsZWFyX3N0YXRlX3Byb2dyYW06CiAgICAvLyBzbWFydF9jb250cmFjdHMvbmZ0X21hcmtldHBsYWNlX2xpc3QvY29udHJhY3QucHk6OQogICAgLy8gY2xhc3MgTmZ0TWFya2V0cGxhY2VMaXN0KEFSQzRDb250cmFjdCk6CiAgICBpbnQgMQogICAgcmV0dXJuCg==" + }, + "state": { + "global": { + "num_byte_slices": 1, + "num_uints": 0 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": { + "marketplace_list": { + "type": "bytes", + "key": "marketplace_list" + } + }, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "NftMarketplaceList", + "methods": [ + { + "name": "add_marketplace_to_list", + "args": [ + { + "type": "uint64", + "name": "app_id" + } + ], + "returns": { + "type": "uint64[]" + } + }, + { + "name": "remove_marketplace_from_list", + "args": [ + { + "type": "uint64", + "name": "app_id" + } + ], + "returns": { + "type": "uint64[]" + } + }, + { + "name": "read_marketplace_list", + "args": [], + "returns": { + "type": "uint64[]" + } + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} \ No newline at end of file diff --git a/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace_list/NftMarketplaceList.clear.teal b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace_list/NftMarketplaceList.clear.teal new file mode 100644 index 0000000..168b375 --- /dev/null +++ b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace_list/NftMarketplaceList.clear.teal @@ -0,0 +1,7 @@ +#pragma version 10 + +smart_contracts.nft_marketplace_list.contract.NftMarketplaceList.clear_state_program: + // smart_contracts/nft_marketplace_list/contract.py:9 + // class NftMarketplaceList(ARC4Contract): + int 1 + return diff --git a/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace_list/client.ts b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace_list/client.ts new file mode 100644 index 0000000..f169473 --- /dev/null +++ b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/artifacts/nft_marketplace_list/client.ts @@ -0,0 +1,639 @@ +/* eslint-disable */ +/** + * This file was automatically generated by @algorandfoundation/algokit-client-generator. + * DO NOT MODIFY IT BY HAND. + * requires: @algorandfoundation/algokit-utils: ^2 + */ +import * as algokit from '@algorandfoundation/algokit-utils' +import type { + ABIAppCallArg, + AppCallTransactionResult, + AppCallTransactionResultOfType, + AppCompilationResult, + AppReference, + AppState, + AppStorageSchema, + CoreAppCallArgs, + RawAppCallArgs, + TealTemplateParams, +} from '@algorandfoundation/algokit-utils/types/app' +import type { + AppClientCallCoreParams, + AppClientCompilationParams, + AppClientDeployCoreParams, + AppDetails, + ApplicationClient, +} from '@algorandfoundation/algokit-utils/types/app-client' +import type { AppSpec } from '@algorandfoundation/algokit-utils/types/app-spec' +import type { SendTransactionResult, TransactionToSign, SendTransactionFrom, SendTransactionParams } from '@algorandfoundation/algokit-utils/types/transaction' +import type { ABIResult, TransactionWithSigner } from 'algosdk' +import { Algodv2, OnApplicationComplete, Transaction, AtomicTransactionComposer, modelsv2 } from 'algosdk' +export const APP_SPEC: AppSpec = { + "hints": { + "add_marketplace_to_list(uint64)uint64[]": { + "call_config": { + "no_op": "CALL" + } + }, + "remove_marketplace_from_list(uint64)uint64[]": { + "call_config": { + "no_op": "CALL" + } + }, + "read_marketplace_list()uint64[]": { + "read_only": true, + "call_config": { + "no_op": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgpzbWFydF9jb250cmFjdHMubmZ0X21hcmtldHBsYWNlX2xpc3QuY29udHJhY3QuTmZ0TWFya2V0cGxhY2VMaXN0LmFwcHJvdmFsX3Byb2dyYW06CiAgICB0eG4gQXBwbGljYXRp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IGFwcF9pZF9saXN0KCkKICAgIGJ5dGUgIm1hcmtldHBsYWNlX2xpc3QiCiAgICBieXRlIDB4MDAwMAogICAgYXBwX2dsb2JhbF9wdXQKICAgIHJldHN1Ygo=", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgpzbWFydF9jb250cmFjdHMubmZ0X21hcmtldHBsYWNlX2xpc3QuY29udHJhY3QuTmZ0TWFya2V0cGxhY2VMaXN0LmNsZWFyX3N0YXRlX3Byb2dyYW06CiAgICAvLyBzbWFydF9jb250cmFjdHMvbmZ0X21hcmtldHBsYWNlX2xpc3QvY29udHJhY3QucHk6OQogICAgLy8gY2xhc3MgTmZ0TWFya2V0cGxhY2VMaXN0KEFSQzRDb250cmFjdCk6CiAgICBpbnQgMQogICAgcmV0dXJuCg==" + }, + "state": { + "global": { + "num_byte_slices": 1, + "num_uints": 0 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": { + "marketplace_list": { + "type": "bytes", + "key": "marketplace_list" + } + }, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "NftMarketplaceList", + "methods": [ + { + "name": "add_marketplace_to_list", + "args": [ + { + "type": "uint64", + "name": "app_id" + } + ], + "returns": { + "type": "uint64[]" + } + }, + { + "name": "remove_marketplace_from_list", + "args": [ + { + "type": "uint64", + "name": "app_id" + } + ], + "returns": { + "type": "uint64[]" + } + }, + { + "name": "read_marketplace_list", + "args": [], + "returns": { + "type": "uint64[]" + } + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} + +/** + * Defines an onCompletionAction of 'no_op' + */ +export type OnCompleteNoOp = { onCompleteAction?: 'no_op' | OnApplicationComplete.NoOpOC } +/** + * Defines an onCompletionAction of 'opt_in' + */ +export type OnCompleteOptIn = { onCompleteAction: 'opt_in' | OnApplicationComplete.OptInOC } +/** + * Defines an onCompletionAction of 'close_out' + */ +export type OnCompleteCloseOut = { onCompleteAction: 'close_out' | OnApplicationComplete.CloseOutOC } +/** + * Defines an onCompletionAction of 'delete_application' + */ +export type OnCompleteDelApp = { onCompleteAction: 'delete_application' | OnApplicationComplete.DeleteApplicationOC } +/** + * Defines an onCompletionAction of 'update_application' + */ +export type OnCompleteUpdApp = { onCompleteAction: 'update_application' | OnApplicationComplete.UpdateApplicationOC } +/** + * A state record containing a single unsigned integer + */ +export type IntegerState = { + /** + * Gets the state value as a BigInt. + */ + asBigInt(): bigint + /** + * Gets the state value as a number. + */ + asNumber(): number +} +/** + * A state record containing binary data + */ +export type BinaryState = { + /** + * Gets the state value as a Uint8Array + */ + asByteArray(): Uint8Array + /** + * Gets the state value as a string + */ + asString(): string +} + +export type AppCreateCallTransactionResult = AppCallTransactionResult & Partial & AppReference +export type AppUpdateCallTransactionResult = AppCallTransactionResult & Partial + +export type AppClientComposeCallCoreParams = Omit & { + sendParams?: Omit +} +export type AppClientComposeExecuteParams = Pick + +export type IncludeSchema = { + /** + * Any overrides for the storage schema to request for the created app; by default the schema indicated by the app spec is used. + */ + schema?: Partial +} + +/** + * Defines the types of available calls and state of the NftMarketplaceList smart contract. + */ +export type NftMarketplaceList = { + /** + * Maps method signatures / names to their argument and return types. + */ + methods: + & Record<'add_marketplace_to_list(uint64)uint64[]' | 'add_marketplace_to_list', { + argsObj: { + appId: bigint | number + } + argsTuple: [appId: bigint | number] + returns: bigint[] + }> + & Record<'remove_marketplace_from_list(uint64)uint64[]' | 'remove_marketplace_from_list', { + argsObj: { + appId: bigint | number + } + argsTuple: [appId: bigint | number] + returns: bigint[] + }> + & Record<'read_marketplace_list()uint64[]' | 'read_marketplace_list', { + argsObj: { + } + argsTuple: [] + returns: bigint[] + }> + /** + * Defines the shape of the global and local state of the application. + */ + state: { + global: { + marketplaceList?: BinaryState + } + } +} +/** + * Defines the possible abi call signatures + */ +export type NftMarketplaceListSig = keyof NftMarketplaceList['methods'] +/** + * Defines an object containing all relevant parameters for a single call to the contract. Where TSignature is undefined, a bare call is made + */ +export type TypedCallParams = { + method: TSignature + methodArgs: TSignature extends undefined ? undefined : Array +} & AppClientCallCoreParams & CoreAppCallArgs +/** + * Defines the arguments required for a bare call + */ +export type BareCallArgs = Omit +/** + * Maps a method signature from the NftMarketplaceList smart contract to the method's arguments in either tuple of struct form + */ +export type MethodArgs = NftMarketplaceList['methods'][TSignature]['argsObj' | 'argsTuple'] +/** + * Maps a method signature from the NftMarketplaceList smart contract to the method's return type + */ +export type MethodReturn = NftMarketplaceList['methods'][TSignature]['returns'] + +/** + * A factory for available 'create' calls + */ +export type NftMarketplaceListCreateCalls = (typeof NftMarketplaceListCallFactory)['create'] +/** + * Defines supported create methods for this smart contract + */ +export type NftMarketplaceListCreateCallParams = + | (TypedCallParams & (OnCompleteNoOp)) +/** + * Defines arguments required for the deploy method. + */ +export type NftMarketplaceListDeployArgs = { + deployTimeParams?: TealTemplateParams + /** + * A delegate which takes a create call factory and returns the create call params for this smart contract + */ + createCall?: (callFactory: NftMarketplaceListCreateCalls) => NftMarketplaceListCreateCallParams +} + + +/** + * Exposes methods for constructing all available smart contract calls + */ +export abstract class NftMarketplaceListCallFactory { + /** + * Gets available create call factories + */ + static get create() { + return { + /** + * Constructs a create call for the NftMarketplaceList smart contract using a bare call + * + * @param params Any parameters for the call + * @returns A TypedCallParams object for the call + */ + bare(params: BareCallArgs & AppClientCallCoreParams & CoreAppCallArgs & AppClientCompilationParams & (OnCompleteNoOp) = {}) { + return { + method: undefined, + methodArgs: undefined, + ...params, + } + }, + } + } + + /** + * Constructs a no op call for the add_marketplace_to_list(uint64)uint64[] ABI method + * + * @param args Any args for the contract call + * @param params Any additional parameters for the call + * @returns A TypedCallParams object for the call + */ + static addMarketplaceToList(args: MethodArgs<'add_marketplace_to_list(uint64)uint64[]'>, params: AppClientCallCoreParams & CoreAppCallArgs) { + return { + method: 'add_marketplace_to_list(uint64)uint64[]' as const, + methodArgs: Array.isArray(args) ? args : [args.appId], + ...params, + } + } + /** + * Constructs a no op call for the remove_marketplace_from_list(uint64)uint64[] ABI method + * + * @param args Any args for the contract call + * @param params Any additional parameters for the call + * @returns A TypedCallParams object for the call + */ + static removeMarketplaceFromList(args: MethodArgs<'remove_marketplace_from_list(uint64)uint64[]'>, params: AppClientCallCoreParams & CoreAppCallArgs) { + return { + method: 'remove_marketplace_from_list(uint64)uint64[]' as const, + methodArgs: Array.isArray(args) ? args : [args.appId], + ...params, + } + } + /** + * Constructs a no op call for the read_marketplace_list()uint64[] ABI method + * + * @param args Any args for the contract call + * @param params Any additional parameters for the call + * @returns A TypedCallParams object for the call + */ + static readMarketplaceList(args: MethodArgs<'read_marketplace_list()uint64[]'>, params: AppClientCallCoreParams & CoreAppCallArgs) { + return { + method: 'read_marketplace_list()uint64[]' as const, + methodArgs: Array.isArray(args) ? args : [], + ...params, + } + } +} + +/** + * A client to make calls to the NftMarketplaceList smart contract + */ +export class NftMarketplaceListClient { + /** + * The underlying `ApplicationClient` for when you want to have more flexibility + */ + public readonly appClient: ApplicationClient + + private readonly sender: SendTransactionFrom | undefined + + /** + * Creates a new instance of `NftMarketplaceListClient` + * + * @param appDetails appDetails The details to identify the app to deploy + * @param algod An algod client instance + */ + constructor(appDetails: AppDetails, private algod: Algodv2) { + this.sender = appDetails.sender + this.appClient = algokit.getAppClient({ + ...appDetails, + app: APP_SPEC + }, algod) + } + + /** + * Checks for decode errors on the AppCallTransactionResult and maps the return value to the specified generic type + * + * @param result The AppCallTransactionResult to be mapped + * @param returnValueFormatter An optional delegate to format the return value if required + * @returns The smart contract response with an updated return value + */ + protected mapReturnValue(result: AppCallTransactionResult, returnValueFormatter?: (value: any) => TReturn): AppCallTransactionResultOfType & TResult { + if(result.return?.decodeError) { + throw result.return.decodeError + } + const returnValue = result.return?.returnValue !== undefined && returnValueFormatter !== undefined + ? returnValueFormatter(result.return.returnValue) + : result.return?.returnValue as TReturn | undefined + return { ...result, return: returnValue } as AppCallTransactionResultOfType & TResult + } + + /** + * Calls the ABI method with the matching signature using an onCompletion code of NO_OP + * + * @param typedCallParams An object containing the method signature, args, and any other relevant parameters + * @param returnValueFormatter An optional delegate which when provided will be used to map non-undefined return values to the target type + * @returns The result of the smart contract call + */ + public async call(typedCallParams: TypedCallParams, returnValueFormatter?: (value: any) => MethodReturn) { + return this.mapReturnValue>(await this.appClient.call(typedCallParams), returnValueFormatter) + } + + /** + * Idempotently deploys the NftMarketplaceList smart contract. + * + * @param params The arguments for the contract calls and any additional parameters for the call + * @returns The deployment result + */ + public deploy(params: NftMarketplaceListDeployArgs & AppClientDeployCoreParams & IncludeSchema = {}): ReturnType { + const createArgs = params.createCall?.(NftMarketplaceListCallFactory.create) + return this.appClient.deploy({ + ...params, + createArgs, + createOnCompleteAction: createArgs?.onCompleteAction, + }) + } + + /** + * Gets available create methods + */ + public get create() { + const $this = this + return { + /** + * Creates a new instance of the NftMarketplaceList smart contract using a bare call. + * + * @param args The arguments for the bare call + * @returns The create result + */ + async bare(args: BareCallArgs & AppClientCallCoreParams & AppClientCompilationParams & IncludeSchema & CoreAppCallArgs & (OnCompleteNoOp) = {}) { + return $this.mapReturnValue(await $this.appClient.create(args)) + }, + } + } + + /** + * Makes a clear_state call to an existing instance of the NftMarketplaceList smart contract. + * + * @param args The arguments for the bare call + * @returns The clear_state result + */ + public clearState(args: BareCallArgs & AppClientCallCoreParams & CoreAppCallArgs = {}) { + return this.appClient.clearState(args) + } + + /** + * Calls the add_marketplace_to_list(uint64)uint64[] ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The result of the call + */ + public addMarketplaceToList(args: MethodArgs<'add_marketplace_to_list(uint64)uint64[]'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return this.call(NftMarketplaceListCallFactory.addMarketplaceToList(args, params)) + } + + /** + * Calls the remove_marketplace_from_list(uint64)uint64[] ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The result of the call + */ + public removeMarketplaceFromList(args: MethodArgs<'remove_marketplace_from_list(uint64)uint64[]'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return this.call(NftMarketplaceListCallFactory.removeMarketplaceFromList(args, params)) + } + + /** + * Calls the read_marketplace_list()uint64[] ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The result of the call + */ + public readMarketplaceList(args: MethodArgs<'read_marketplace_list()uint64[]'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return this.call(NftMarketplaceListCallFactory.readMarketplaceList(args, params)) + } + + /** + * Extracts a binary state value out of an AppState dictionary + * + * @param state The state dictionary containing the state value + * @param key The key of the state value + * @returns A BinaryState instance containing the state value, or undefined if the key was not found + */ + private static getBinaryState(state: AppState, key: string): BinaryState | undefined { + const value = state[key] + if (!value) return undefined + if (!('valueRaw' in value)) + throw new Error(`Failed to parse state value for ${key}; received an int when expected a byte array`) + return { + asString(): string { + return value.value + }, + asByteArray(): Uint8Array { + return value.valueRaw + } + } + } + + /** + * Extracts a integer state value out of an AppState dictionary + * + * @param state The state dictionary containing the state value + * @param key The key of the state value + * @returns An IntegerState instance containing the state value, or undefined if the key was not found + */ + private static getIntegerState(state: AppState, key: string): IntegerState | undefined { + const value = state[key] + if (!value) return undefined + if ('valueRaw' in value) + throw new Error(`Failed to parse state value for ${key}; received a byte array when expected a number`) + return { + asBigInt() { + return typeof value.value === 'bigint' ? value.value : BigInt(value.value) + }, + asNumber(): number { + return typeof value.value === 'bigint' ? Number(value.value) : value.value + }, + } + } + + /** + * Returns the smart contract's global state wrapped in a strongly typed accessor with options to format the stored value + */ + public async getGlobalState(): Promise { + const state = await this.appClient.getGlobalState() + return { + get marketplaceList() { + return NftMarketplaceListClient.getBinaryState(state, 'marketplace_list') + }, + } + } + + public compose(): NftMarketplaceListComposer { + const client = this + const atc = new AtomicTransactionComposer() + let promiseChain:Promise = Promise.resolve() + const resultMappers: Array any)> = [] + return { + addMarketplaceToList(args: MethodArgs<'add_marketplace_to_list(uint64)uint64[]'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) { + promiseChain = promiseChain.then(() => client.addMarketplaceToList(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return this + }, + removeMarketplaceFromList(args: MethodArgs<'remove_marketplace_from_list(uint64)uint64[]'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) { + promiseChain = promiseChain.then(() => client.removeMarketplaceFromList(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return this + }, + readMarketplaceList(args: MethodArgs<'read_marketplace_list()uint64[]'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) { + promiseChain = promiseChain.then(() => client.readMarketplaceList(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return this + }, + clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs) { + promiseChain = promiseChain.then(() => client.clearState({...args, sendParams: {...args?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return this + }, + addTransaction(txn: TransactionWithSigner | TransactionToSign | Transaction | Promise, defaultSender?: SendTransactionFrom) { + promiseChain = promiseChain.then(async () => atc.addTransaction(await algokit.getTransactionWithSigner(txn, defaultSender ?? client.sender))) + return this + }, + async atc() { + await promiseChain + return atc + }, + async simulate(options?: SimulateOptions) { + await promiseChain + const result = await atc.simulate(client.algod, new modelsv2.SimulateRequest({ txnGroups: [], ...options })) + return { + ...result, + returns: result.methodResults?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val.returnValue) : val.returnValue) + } + }, + async execute(sendParams?: AppClientComposeExecuteParams) { + await promiseChain + const result = await algokit.sendAtomicTransactionComposer({ atc, sendParams }, client.algod) + return { + ...result, + returns: result.returns?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val.returnValue) : val.returnValue) + } + } + } as unknown as NftMarketplaceListComposer + } +} +export type NftMarketplaceListComposer = { + /** + * Calls the add_marketplace_to_list(uint64)uint64[] ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + addMarketplaceToList(args: MethodArgs<'add_marketplace_to_list(uint64)uint64[]'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): NftMarketplaceListComposer<[...TReturns, MethodReturn<'add_marketplace_to_list(uint64)uint64[]'>]> + + /** + * Calls the remove_marketplace_from_list(uint64)uint64[] ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + removeMarketplaceFromList(args: MethodArgs<'remove_marketplace_from_list(uint64)uint64[]'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): NftMarketplaceListComposer<[...TReturns, MethodReturn<'remove_marketplace_from_list(uint64)uint64[]'>]> + + /** + * Calls the read_marketplace_list()uint64[] ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + readMarketplaceList(args: MethodArgs<'read_marketplace_list()uint64[]'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): NftMarketplaceListComposer<[...TReturns, MethodReturn<'read_marketplace_list()uint64[]'>]> + + /** + * Makes a clear_state call to an existing instance of the NftMarketplaceList smart contract. + * + * @param args The arguments for the bare call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs): NftMarketplaceListComposer<[...TReturns, undefined]> + + /** + * Adds a transaction to the composer + * + * @param txn One of: A TransactionWithSigner object (returned as is), a TransactionToSign object (signer is obtained from the signer property), a Transaction object (signer is extracted from the defaultSender parameter), an async SendTransactionResult returned by one of algokit utils helpers (signer is obtained from the defaultSender parameter) + * @param defaultSender The default sender to be used to obtain a signer where the object provided to the transaction parameter does not include a signer. + */ + addTransaction(txn: TransactionWithSigner | TransactionToSign | Transaction | Promise, defaultSender?: SendTransactionFrom): NftMarketplaceListComposer + /** + * Returns the underlying AtomicTransactionComposer instance + */ + atc(): Promise + /** + * Simulates the transaction group and returns the result + */ + simulate(options?: SimulateOptions): Promise> + /** + * Executes the transaction group and returns the results + */ + execute(sendParams?: AppClientComposeExecuteParams): Promise> +} +export type SimulateOptions = Omit[0], 'txnGroups'> +export type NftMarketplaceListComposerSimulateResult = { + returns: TReturns + methodResults: ABIResult[] + simulateResponse: modelsv2.SimulateResponse +} +export type NftMarketplaceListComposerResults = { + returns: TReturns + groupId: string + txIds: string[] + transactions: Transaction[] +} diff --git a/projects/orakle-nft-marketplace-app-contracts/smart_contracts/nft_marketplace/contract.py b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/nft_marketplace/contract.py index c3338f7..cedd4a2 100644 --- a/projects/orakle-nft-marketplace-app-contracts/smart_contracts/nft_marketplace/contract.py +++ b/projects/orakle-nft-marketplace-app-contracts/smart_contracts/nft_marketplace/contract.py @@ -47,9 +47,9 @@ class NftMarketplace(arc4.ARC4Contract): def __init__(self) -> None: "문제 1 시작" - self.asset_id = "여기에 코드 작성" - self.unitary_price = "여기에 코드 작성" - self.bootstrapped = "여기에 코드 작성" + self.asset_id = UInt64(0) + self.unitary_price = UInt64(0) + self.bootstrapped = bool(False) "문제 1 끝" """ @@ -97,7 +97,20 @@ def __init__(self) -> None: def bootstrap( self, asset: Asset, unitary_price: UInt64, mbr_pay: gtxn.PaymentTransaction ) -> None: - "여기에 코드 작성" + assert Txn.sender == Global.creator_address + assert self.bootstrapped == False + assert mbr_pay.receiver == Global.current_application_address + assert mbr_pay.amount == Global.asset_create_min_balance + Global.asset_opt_in_min_balance + + self.asset_id = asset.id + self.unitary_price = unitary_price + self.bootstrapped = True + + itxn.AssetTransfer( + xfer_asset = asset.id, + asset_receiver = Global.current_application_address, + asset_amount= 0, + ).submit() "문제 2 끝" @@ -138,7 +151,17 @@ def buy( quantity: UInt64, ) -> None: "여기에 코드 작성" - + assert self.bootstrapped == True + assert buyer_txn.sender == Txn.sender + assert buyer_txn.receiver == Global.current_application_address + assert buyer_txn.amount == self.unitary_price * quantity + + itxn.AssetTransfer( + xfer_asset = self.asset_id, + asset_receiver = buyer_txn.sender, + asset_amount= quantity, + ).submit() + "문제 3 끝" """ @@ -188,5 +211,16 @@ def buy( @arc4.abimethod(allow_actions=["DeleteApplication"]) def withdraw_and_delete(self) -> None: "여기에 코드 작성" - + assert Txn.sender == Global.creator_address + + itxn.AssetTransfer( + xfer_asset = self.asset_id, + asset_receiver = Global.creator_address, + asset_close_to= Global.creator_address, + ).submit() + + itxn.Payment( + receiver = Global.creator_address, + close_remainder_to = Global.creator_address + ).submit() "문제 4 끝" diff --git a/projects/orakle-nft-marketplace-app-frontend/src/contracts/NftMarketplace.ts b/projects/orakle-nft-marketplace-app-frontend/src/contracts/NftMarketplace.ts new file mode 100644 index 0000000..3433ed8 --- /dev/null +++ b/projects/orakle-nft-marketplace-app-frontend/src/contracts/NftMarketplace.ts @@ -0,0 +1,719 @@ +/* eslint-disable */ +/** + * This file was automatically generated by @algorandfoundation/algokit-client-generator. + * DO NOT MODIFY IT BY HAND. + * requires: @algorandfoundation/algokit-utils: ^2 + */ +import * as algokit from '@algorandfoundation/algokit-utils' +import type { + ABIAppCallArg, + AppCallTransactionResult, + AppCallTransactionResultOfType, + AppCompilationResult, + AppReference, + AppState, + AppStorageSchema, + CoreAppCallArgs, + RawAppCallArgs, + TealTemplateParams, +} from '@algorandfoundation/algokit-utils/types/app' +import type { + AppClientCallCoreParams, + AppClientCompilationParams, + AppClientDeployCoreParams, + AppDetails, + ApplicationClient, +} from '@algorandfoundation/algokit-utils/types/app-client' +import type { AppSpec } from '@algorandfoundation/algokit-utils/types/app-spec' +import type { SendTransactionResult, TransactionToSign, SendTransactionFrom, SendTransactionParams } from '@algorandfoundation/algokit-utils/types/transaction' +import type { ABIResult, TransactionWithSigner } from 'algosdk' +import { Algodv2, OnApplicationComplete, Transaction, AtomicTransactionComposer, modelsv2 } from 'algosdk' +export const APP_SPEC: AppSpec = { + "hints": { + "bootstrap(asset,uint64,pay)void": { + "call_config": { + "no_op": "CALL" + } + }, + "buy(pay,uint64)void": { + "call_config": { + "no_op": "CALL" + } + }, + "withdraw_and_delete()void": { + "call_config": { + "delete_application": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgpzbWFydF9jb250cmFjdHMubmZ0X21hcmtldHBsYWNlLmNvbnRyYWN0Lk5mdE1hcmtldHBsYWNlLmFwcHJvdmFsX3Byb2dyYW06CiAgICB0eG4gQXBwbGljYXRpb25JRAogICAgYm56IG1haW5fZW50cnlwb2ludEAyCiAgICBjYWxsc3ViIF9faW5pdF9fCgptYWluX2VudHJ5cG9pbnRAMjoKICAgIC8vIHNtYXJ0X2NvbnRyYWN0cy9uZnRfbWFya2V0cGxhY2UvY29udHJhY3QucHk6MjAKICAgIC8vIGNsYXNzIE5mdE1hcmtldHBsYWNlKGFyYzQuQVJDNENvbnRyYWN0KToKICAgIHR4biBOdW1BcHBBcmdzCiAgICBieiBtYWluX2JhcmVfcm91dGluZ0A5CiAgICBtZXRob2QgImJvb3RzdHJhcChhc3NldCx1aW50NjQscGF5KXZvaWQiCiAgICBtZXRob2QgImJ1eShwYXksdWludDY0KXZvaWQiCiAgICBtZXRob2QgIndpdGhkcmF3X2FuZF9kZWxldGUoKXZvaWQiCiAgICB0eG5hIEFwcGxpY2F0aW9uQXJncyAwCiAgICBtYXRjaCBtYWluX2Jvb3RzdHJhcF9yb3V0ZUA0IG1haW5fYnV5X3JvdXRlQDUgbWFpbl93aXRoZHJhd19hbmRfZGVsZXRlX3JvdXRlQDYKICAgIGVyciAvLyByZWplY3QgdHJhbnNhY3Rpb24KCm1haW5fYm9vdHN0cmFwX3JvdXRlQDQ6CiAgICAvLyBzbWFydF9jb250cmFjdHMvbmZ0X21hcmtldHBsYWNlL2NvbnRyYWN0LnB5Ojk2CiAgICAvLyBAYXJjNC5hYmltZXRob2QKICAgIHR4biBPbkNvbX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hcnRfY29udHJhY3RzL25mdF9tYXJrZXRwbGFjZS9jb250cmFjdC5weTo1MAogICAgLy8gc2VsZi5hc3NldF9pZCA9IFVJbnQ2NCgwKQogICAgYnl0ZSAiYXNzZXRfaWQiCiAgICBpbnQgMAogICAgYXBwX2dsb2JhbF9wdXQKICAgIC8vIHNtYXJ0X2NvbnRyYWN0cy9uZnRfbWFya2V0cGxhY2UvY29udHJhY3QucHk6NTEKICAgIC8vIHNlbGYudW5pdGFyeV9wcmljZSA9IFVJbnQ2NCgwKQogICAgYnl0ZSAidW5pdGFyeV9wcmljZSIKICAgIGludCAwCiAgICBhcHBfZ2xvYmFsX3B1dAogICAgLy8gc21hcnRfY29udHJhY3RzL25mdF9tYXJrZXRwbGFjZS9jb250cmFjdC5weTo1MgogICAgLy8gc2VsZi5ib290c3RyYXBwZWQgPSBib29sKEZhbHNlKQogICAgYnl0ZSAiYm9vdHN0cmFwcGVkIgogICAgaW50IDAKICAgIGFwcF9nbG9iYWxfcHV0CiAgICByZXRzdWIK", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgpzbWFydF9jb250cmFjdHMubmZ0X21hcmtldHBsYWNlLmNvbnRyYWN0Lk5mdE1hcmtldHBsYWNlLmNsZWFyX3N0YXRlX3Byb2dyYW06CiAgICAvLyBzbWFydF9jb250cmFjdHMvbmZ0X21hcmtldHBsYWNlL2NvbnRyYWN0LnB5OjIwCiAgICAvLyBjbGFzcyBOZnRNYXJrZXRwbGFjZShhcmM0LkFSQzRDb250cmFjdCk6CiAgICBpbnQgMQogICAgcmV0dXJuCg==" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 3 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": { + "asset_id": { + "type": "uint64", + "key": "asset_id" + }, + "bootstrapped": { + "type": "uint64", + "key": "bootstrapped" + }, + "unitary_price": { + "type": "uint64", + "key": "unitary_price" + } + }, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "NftMarketplace", + "desc": "\n 문제 1\n NftMarketplace 앱의 상태(state)를 정의하고 초기값을 설정하세요.\n\n NftMarketplace 앱은 세개의 상태를 가지고 있습니다.\n 1. asset_id: 판매할 에셋(ASA)의 아이디; UInt64타입을 가진 글로벌 상태(Global State)\n - 초기값은 0으로 설정해주세요.\n 2. unitary_price: 판매할 에셋(ASA)의 가격. UInt64타입을 가진 글로벌 상태(Global State)\n - 초기값은 0으로 설정해주세요.\n 3. bootstrapped: 앱에서 에셋을 판매할 준비가 되었는지 체크하는 bool 타입의 글로벌 상태(Global State). bootstrap 메서드가 실행되면 True로 변경됩니다.\n - 초기값은 False로 설정해주세요.\n\n 재밌는 팩트!\n AVM은 Bytes 타입과 UInt64 타입만 지원합니다. 그래서 다른 타입을 사용하고 싶으면 보통 arc4타입을 사용합니다. 하지만\n Algorand Python에서는 bool, string 타입은 파이썬 코드와 동일하게 사용할 수 있습니다. 예를 들어 bool 타입은 True,\n False로 표현하면 되고, string 타입은 \"Hello, World!\"와 같이 표현하면 됩니다. Algorand Python에서 데이터 타입을\n 사용하는 방법은 아래 링크를 참고해주세요.\n - Python Built in 타입: https://algorandfoundation.github.io/puya/lg-types.html#python-built-in-types\n\n 팁!\n - Global State를 정의할때 simplifed 버전으로 정의하면 간결한 코드로 상태를 정의하고 초기값을 설정할 수 있습니다.\n 자세한 사항은 아래 힌트 1을 참고해주세요.\n\n 힌트 1 - 글로벌 상태 설정 방법: https://algorandfoundation.github.io/puya/lg-storage.html#global-storage\n 힌트 2 - 코드 예시: https://github.com/algorandfoundation/puya/blob/11843f6bc4bb6e4c56ac53e3980f74df69d07397/examples/global_state/contract.py#L5\n ", + "methods": [ + { + "name": "bootstrap", + "args": [ + { + "type": "asset", + "name": "asset" + }, + { + "type": "uint64", + "name": "unitary_price" + }, + { + "type": "pay", + "name": "mbr_pay" + } + ], + "returns": { + "type": "void" + } + }, + { + "name": "buy", + "args": [ + { + "type": "pay", + "name": "buyer_txn" + }, + { + "type": "uint64", + "name": "quantity" + } + ], + "returns": { + "type": "void" + }, + "desc": "여기에 코드 작성" + }, + { + "name": "withdraw_and_delete", + "args": [], + "returns": { + "type": "void" + }, + "desc": "여기에 코드 작성" + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} + +/** + * Defines an onCompletionAction of 'no_op' + */ +export type OnCompleteNoOp = { onCompleteAction?: 'no_op' | OnApplicationComplete.NoOpOC } +/** + * Defines an onCompletionAction of 'opt_in' + */ +export type OnCompleteOptIn = { onCompleteAction: 'opt_in' | OnApplicationComplete.OptInOC } +/** + * Defines an onCompletionAction of 'close_out' + */ +export type OnCompleteCloseOut = { onCompleteAction: 'close_out' | OnApplicationComplete.CloseOutOC } +/** + * Defines an onCompletionAction of 'delete_application' + */ +export type OnCompleteDelApp = { onCompleteAction: 'delete_application' | OnApplicationComplete.DeleteApplicationOC } +/** + * Defines an onCompletionAction of 'update_application' + */ +export type OnCompleteUpdApp = { onCompleteAction: 'update_application' | OnApplicationComplete.UpdateApplicationOC } +/** + * A state record containing a single unsigned integer + */ +export type IntegerState = { + /** + * Gets the state value as a BigInt. + */ + asBigInt(): bigint + /** + * Gets the state value as a number. + */ + asNumber(): number +} +/** + * A state record containing binary data + */ +export type BinaryState = { + /** + * Gets the state value as a Uint8Array + */ + asByteArray(): Uint8Array + /** + * Gets the state value as a string + */ + asString(): string +} + +export type AppCreateCallTransactionResult = AppCallTransactionResult & Partial & AppReference +export type AppUpdateCallTransactionResult = AppCallTransactionResult & Partial + +export type AppClientComposeCallCoreParams = Omit & { + sendParams?: Omit +} +export type AppClientComposeExecuteParams = Pick + +export type IncludeSchema = { + /** + * Any overrides for the storage schema to request for the created app; by default the schema indicated by the app spec is used. + */ + schema?: Partial +} + +/** + * Defines the types of available calls and state of the NftMarketplace smart contract. + */ +export type NftMarketplace = { + /** + * Maps method signatures / names to their argument and return types. + */ + methods: + & Record<'bootstrap(asset,uint64,pay)void' | 'bootstrap', { + argsObj: { + asset: number | bigint + unitaryPrice: bigint | number + mbrPay: TransactionToSign | Transaction | Promise + } + argsTuple: [asset: number | bigint, unitaryPrice: bigint | number, mbrPay: TransactionToSign | Transaction | Promise] + returns: void + }> + & Record<'buy(pay,uint64)void' | 'buy', { + argsObj: { + buyerTxn: TransactionToSign | Transaction | Promise + quantity: bigint | number + } + argsTuple: [buyerTxn: TransactionToSign | Transaction | Promise, quantity: bigint | number] + returns: void + }> + & Record<'withdraw_and_delete()void' | 'withdraw_and_delete', { + argsObj: { + } + argsTuple: [] + returns: void + }> + /** + * Defines the shape of the global and local state of the application. + */ + state: { + global: { + assetId?: IntegerState + bootstrapped?: IntegerState + unitaryPrice?: IntegerState + } + } +} +/** + * Defines the possible abi call signatures + */ +export type NftMarketplaceSig = keyof NftMarketplace['methods'] +/** + * Defines an object containing all relevant parameters for a single call to the contract. Where TSignature is undefined, a bare call is made + */ +export type TypedCallParams = { + method: TSignature + methodArgs: TSignature extends undefined ? undefined : Array +} & AppClientCallCoreParams & CoreAppCallArgs +/** + * Defines the arguments required for a bare call + */ +export type BareCallArgs = Omit +/** + * Maps a method signature from the NftMarketplace smart contract to the method's arguments in either tuple of struct form + */ +export type MethodArgs = NftMarketplace['methods'][TSignature]['argsObj' | 'argsTuple'] +/** + * Maps a method signature from the NftMarketplace smart contract to the method's return type + */ +export type MethodReturn = NftMarketplace['methods'][TSignature]['returns'] + +/** + * A factory for available 'create' calls + */ +export type NftMarketplaceCreateCalls = (typeof NftMarketplaceCallFactory)['create'] +/** + * Defines supported create methods for this smart contract + */ +export type NftMarketplaceCreateCallParams = + | (TypedCallParams & (OnCompleteNoOp)) +/** + * A factory for available 'delete' calls + */ +export type NftMarketplaceDeleteCalls = (typeof NftMarketplaceCallFactory)['delete'] +/** + * Defines supported delete methods for this smart contract + */ +export type NftMarketplaceDeleteCallParams = + | TypedCallParams<'withdraw_and_delete()void'> +/** + * Defines arguments required for the deploy method. + */ +export type NftMarketplaceDeployArgs = { + deployTimeParams?: TealTemplateParams + /** + * A delegate which takes a create call factory and returns the create call params for this smart contract + */ + createCall?: (callFactory: NftMarketplaceCreateCalls) => NftMarketplaceCreateCallParams + /** + * A delegate which takes a delete call factory and returns the delete call params for this smart contract + */ + deleteCall?: (callFactory: NftMarketplaceDeleteCalls) => NftMarketplaceDeleteCallParams +} + + +/** + * Exposes methods for constructing all available smart contract calls + */ +export abstract class NftMarketplaceCallFactory { + /** + * Gets available create call factories + */ + static get create() { + return { + /** + * Constructs a create call for the NftMarketplace smart contract using a bare call + * + * @param params Any parameters for the call + * @returns A TypedCallParams object for the call + */ + bare(params: BareCallArgs & AppClientCallCoreParams & CoreAppCallArgs & AppClientCompilationParams & (OnCompleteNoOp) = {}) { + return { + method: undefined, + methodArgs: undefined, + ...params, + } + }, + } + } + + /** + * Gets available delete call factories + */ + static get delete() { + return { + /** + * Constructs a delete call for the NftMarketplace smart contract using the withdraw_and_delete()void ABI method + * + * @param args Any args for the contract call + * @param params Any additional parameters for the call + * @returns A TypedCallParams object for the call + */ + withdrawAndDelete(args: MethodArgs<'withdraw_and_delete()void'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return { + method: 'withdraw_and_delete()void' as const, + methodArgs: Array.isArray(args) ? args : [], + ...params, + } + }, + } + } + + /** + * Constructs a no op call for the bootstrap(asset,uint64,pay)void ABI method + * + * @param args Any args for the contract call + * @param params Any additional parameters for the call + * @returns A TypedCallParams object for the call + */ + static bootstrap(args: MethodArgs<'bootstrap(asset,uint64,pay)void'>, params: AppClientCallCoreParams & CoreAppCallArgs) { + return { + method: 'bootstrap(asset,uint64,pay)void' as const, + methodArgs: Array.isArray(args) ? args : [args.asset, args.unitaryPrice, args.mbrPay], + ...params, + } + } + /** + * Constructs a no op call for the buy(pay,uint64)void ABI method + * + * 여기에 코드 작성 + * + * @param args Any args for the contract call + * @param params Any additional parameters for the call + * @returns A TypedCallParams object for the call + */ + static buy(args: MethodArgs<'buy(pay,uint64)void'>, params: AppClientCallCoreParams & CoreAppCallArgs) { + return { + method: 'buy(pay,uint64)void' as const, + methodArgs: Array.isArray(args) ? args : [args.buyerTxn, args.quantity], + ...params, + } + } +} + +/** + * A client to make calls to the NftMarketplace smart contract + */ +export class NftMarketplaceClient { + /** + * The underlying `ApplicationClient` for when you want to have more flexibility + */ + public readonly appClient: ApplicationClient + + private readonly sender: SendTransactionFrom | undefined + + /** + * Creates a new instance of `NftMarketplaceClient` + * + * @param appDetails appDetails The details to identify the app to deploy + * @param algod An algod client instance + */ + constructor(appDetails: AppDetails, private algod: Algodv2) { + this.sender = appDetails.sender + this.appClient = algokit.getAppClient({ + ...appDetails, + app: APP_SPEC + }, algod) + } + + /** + * Checks for decode errors on the AppCallTransactionResult and maps the return value to the specified generic type + * + * @param result The AppCallTransactionResult to be mapped + * @param returnValueFormatter An optional delegate to format the return value if required + * @returns The smart contract response with an updated return value + */ + protected mapReturnValue(result: AppCallTransactionResult, returnValueFormatter?: (value: any) => TReturn): AppCallTransactionResultOfType & TResult { + if(result.return?.decodeError) { + throw result.return.decodeError + } + const returnValue = result.return?.returnValue !== undefined && returnValueFormatter !== undefined + ? returnValueFormatter(result.return.returnValue) + : result.return?.returnValue as TReturn | undefined + return { ...result, return: returnValue } as AppCallTransactionResultOfType & TResult + } + + /** + * Calls the ABI method with the matching signature using an onCompletion code of NO_OP + * + * @param typedCallParams An object containing the method signature, args, and any other relevant parameters + * @param returnValueFormatter An optional delegate which when provided will be used to map non-undefined return values to the target type + * @returns The result of the smart contract call + */ + public async call(typedCallParams: TypedCallParams, returnValueFormatter?: (value: any) => MethodReturn) { + return this.mapReturnValue>(await this.appClient.call(typedCallParams), returnValueFormatter) + } + + /** + * Idempotently deploys the NftMarketplace smart contract. + * + * @param params The arguments for the contract calls and any additional parameters for the call + * @returns The deployment result + */ + public deploy(params: NftMarketplaceDeployArgs & AppClientDeployCoreParams & IncludeSchema = {}): ReturnType { + const createArgs = params.createCall?.(NftMarketplaceCallFactory.create) + const deleteArgs = params.deleteCall?.(NftMarketplaceCallFactory.delete) + return this.appClient.deploy({ + ...params, + deleteArgs, + createArgs, + createOnCompleteAction: createArgs?.onCompleteAction, + }) + } + + /** + * Gets available create methods + */ + public get create() { + const $this = this + return { + /** + * Creates a new instance of the NftMarketplace smart contract using a bare call. + * + * @param args The arguments for the bare call + * @returns The create result + */ + async bare(args: BareCallArgs & AppClientCallCoreParams & AppClientCompilationParams & IncludeSchema & CoreAppCallArgs & (OnCompleteNoOp) = {}) { + return $this.mapReturnValue(await $this.appClient.create(args)) + }, + } + } + + /** + * Gets available delete methods + */ + public get delete() { + const $this = this + return { + /** + * Deletes an existing instance of the NftMarketplace smart contract using the withdraw_and_delete()void ABI method. + * + * @param args The arguments for the smart contract call + * @param params Any additional parameters for the call + * @returns The delete result + */ + async withdrawAndDelete(args: MethodArgs<'withdraw_and_delete()void'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return $this.mapReturnValue>(await $this.appClient.delete(NftMarketplaceCallFactory.delete.withdrawAndDelete(args, params))) + }, + } + } + + /** + * Makes a clear_state call to an existing instance of the NftMarketplace smart contract. + * + * @param args The arguments for the bare call + * @returns The clear_state result + */ + public clearState(args: BareCallArgs & AppClientCallCoreParams & CoreAppCallArgs = {}) { + return this.appClient.clearState(args) + } + + /** + * Calls the bootstrap(asset,uint64,pay)void ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The result of the call + */ + public bootstrap(args: MethodArgs<'bootstrap(asset,uint64,pay)void'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return this.call(NftMarketplaceCallFactory.bootstrap(args, params)) + } + + /** + * Calls the buy(pay,uint64)void ABI method. + * + * 여기에 코드 작성 + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The result of the call + */ + public buy(args: MethodArgs<'buy(pay,uint64)void'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return this.call(NftMarketplaceCallFactory.buy(args, params)) + } + + /** + * Extracts a binary state value out of an AppState dictionary + * + * @param state The state dictionary containing the state value + * @param key The key of the state value + * @returns A BinaryState instance containing the state value, or undefined if the key was not found + */ + private static getBinaryState(state: AppState, key: string): BinaryState | undefined { + const value = state[key] + if (!value) return undefined + if (!('valueRaw' in value)) + throw new Error(`Failed to parse state value for ${key}; received an int when expected a byte array`) + return { + asString(): string { + return value.value + }, + asByteArray(): Uint8Array { + return value.valueRaw + } + } + } + + /** + * Extracts a integer state value out of an AppState dictionary + * + * @param state The state dictionary containing the state value + * @param key The key of the state value + * @returns An IntegerState instance containing the state value, or undefined if the key was not found + */ + private static getIntegerState(state: AppState, key: string): IntegerState | undefined { + const value = state[key] + if (!value) return undefined + if ('valueRaw' in value) + throw new Error(`Failed to parse state value for ${key}; received a byte array when expected a number`) + return { + asBigInt() { + return typeof value.value === 'bigint' ? value.value : BigInt(value.value) + }, + asNumber(): number { + return typeof value.value === 'bigint' ? Number(value.value) : value.value + }, + } + } + + /** + * Returns the smart contract's global state wrapped in a strongly typed accessor with options to format the stored value + */ + public async getGlobalState(): Promise { + const state = await this.appClient.getGlobalState() + return { + get assetId() { + return NftMarketplaceClient.getIntegerState(state, 'asset_id') + }, + get bootstrapped() { + return NftMarketplaceClient.getIntegerState(state, 'bootstrapped') + }, + get unitaryPrice() { + return NftMarketplaceClient.getIntegerState(state, 'unitary_price') + }, + } + } + + public compose(): NftMarketplaceComposer { + const client = this + const atc = new AtomicTransactionComposer() + let promiseChain:Promise = Promise.resolve() + const resultMappers: Array any)> = [] + return { + bootstrap(args: MethodArgs<'bootstrap(asset,uint64,pay)void'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) { + promiseChain = promiseChain.then(() => client.bootstrap(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return this + }, + buy(args: MethodArgs<'buy(pay,uint64)void'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) { + promiseChain = promiseChain.then(() => client.buy(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return this + }, + get delete() { + const $this = this + return { + withdrawAndDelete(args: MethodArgs<'withdraw_and_delete()void'>, params?: AppClientComposeCallCoreParams) { + promiseChain = promiseChain.then(() => client.delete.withdrawAndDelete(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return $this + }, + } + }, + clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs) { + promiseChain = promiseChain.then(() => client.clearState({...args, sendParams: {...args?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return this + }, + addTransaction(txn: TransactionWithSigner | TransactionToSign | Transaction | Promise, defaultSender?: SendTransactionFrom) { + promiseChain = promiseChain.then(async () => atc.addTransaction(await algokit.getTransactionWithSigner(txn, defaultSender ?? client.sender))) + return this + }, + async atc() { + await promiseChain + return atc + }, + async simulate(options?: SimulateOptions) { + await promiseChain + const result = await atc.simulate(client.algod, new modelsv2.SimulateRequest({ txnGroups: [], ...options })) + return { + ...result, + returns: result.methodResults?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val.returnValue) : val.returnValue) + } + }, + async execute(sendParams?: AppClientComposeExecuteParams) { + await promiseChain + const result = await algokit.sendAtomicTransactionComposer({ atc, sendParams }, client.algod) + return { + ...result, + returns: result.returns?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val.returnValue) : val.returnValue) + } + } + } as unknown as NftMarketplaceComposer + } +} +export type NftMarketplaceComposer = { + /** + * Calls the bootstrap(asset,uint64,pay)void ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + bootstrap(args: MethodArgs<'bootstrap(asset,uint64,pay)void'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): NftMarketplaceComposer<[...TReturns, MethodReturn<'bootstrap(asset,uint64,pay)void'>]> + + /** + * Calls the buy(pay,uint64)void ABI method. + * + * 여기에 코드 작성 + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + buy(args: MethodArgs<'buy(pay,uint64)void'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): NftMarketplaceComposer<[...TReturns, MethodReturn<'buy(pay,uint64)void'>]> + + /** + * Gets available delete methods + */ + readonly delete: { + /** + * Deletes an existing instance of the NftMarketplace smart contract using the withdraw_and_delete()void ABI method. + * + * @param args The arguments for the smart contract call + * @param params Any additional parameters for the call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + withdrawAndDelete(args: MethodArgs<'withdraw_and_delete()void'>, params?: AppClientComposeCallCoreParams): NftMarketplaceComposer<[...TReturns, MethodReturn<'withdraw_and_delete()void'>]> + } + + /** + * Makes a clear_state call to an existing instance of the NftMarketplace smart contract. + * + * @param args The arguments for the bare call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs): NftMarketplaceComposer<[...TReturns, undefined]> + + /** + * Adds a transaction to the composer + * + * @param txn One of: A TransactionWithSigner object (returned as is), a TransactionToSign object (signer is obtained from the signer property), a Transaction object (signer is extracted from the defaultSender parameter), an async SendTransactionResult returned by one of algokit utils helpers (signer is obtained from the defaultSender parameter) + * @param defaultSender The default sender to be used to obtain a signer where the object provided to the transaction parameter does not include a signer. + */ + addTransaction(txn: TransactionWithSigner | TransactionToSign | Transaction | Promise, defaultSender?: SendTransactionFrom): NftMarketplaceComposer + /** + * Returns the underlying AtomicTransactionComposer instance + */ + atc(): Promise + /** + * Simulates the transaction group and returns the result + */ + simulate(options?: SimulateOptions): Promise> + /** + * Executes the transaction group and returns the results + */ + execute(sendParams?: AppClientComposeExecuteParams): Promise> +} +export type SimulateOptions = Omit[0], 'txnGroups'> +export type NftMarketplaceComposerSimulateResult = { + returns: TReturns + methodResults: ABIResult[] + simulateResponse: modelsv2.SimulateResponse +} +export type NftMarketplaceComposerResults = { + returns: TReturns + groupId: string + txIds: string[] + transactions: Transaction[] +} diff --git a/projects/orakle-nft-marketplace-app-frontend/src/contracts/NftMarketplaceList.ts b/projects/orakle-nft-marketplace-app-frontend/src/contracts/NftMarketplaceList.ts new file mode 100644 index 0000000..f169473 --- /dev/null +++ b/projects/orakle-nft-marketplace-app-frontend/src/contracts/NftMarketplaceList.ts @@ -0,0 +1,639 @@ +/* eslint-disable */ +/** + * This file was automatically generated by @algorandfoundation/algokit-client-generator. + * DO NOT MODIFY IT BY HAND. + * requires: @algorandfoundation/algokit-utils: ^2 + */ +import * as algokit from '@algorandfoundation/algokit-utils' +import type { + ABIAppCallArg, + AppCallTransactionResult, + AppCallTransactionResultOfType, + AppCompilationResult, + AppReference, + AppState, + AppStorageSchema, + CoreAppCallArgs, + RawAppCallArgs, + TealTemplateParams, +} from '@algorandfoundation/algokit-utils/types/app' +import type { + AppClientCallCoreParams, + AppClientCompilationParams, + AppClientDeployCoreParams, + AppDetails, + ApplicationClient, +} from '@algorandfoundation/algokit-utils/types/app-client' +import type { AppSpec } from '@algorandfoundation/algokit-utils/types/app-spec' +import type { SendTransactionResult, TransactionToSign, SendTransactionFrom, SendTransactionParams } from '@algorandfoundation/algokit-utils/types/transaction' +import type { ABIResult, TransactionWithSigner } from 'algosdk' +import { Algodv2, OnApplicationComplete, Transaction, AtomicTransactionComposer, modelsv2 } from 'algosdk' +export const APP_SPEC: AppSpec = { + "hints": { + "add_marketplace_to_list(uint64)uint64[]": { + "call_config": { + "no_op": "CALL" + } + }, + "remove_marketplace_from_list(uint64)uint64[]": { + "call_config": { + "no_op": "CALL" + } + }, + "read_marketplace_list()uint64[]": { + "read_only": true, + "call_config": { + "no_op": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgpzbWFydF9jb250cmFjdHMubmZ0X21hcmtldHBsYWNlX2xpc3QuY29udHJhY3QuTmZ0TWFya2V0cGxh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29udHJhY3QucHk6MTIKICAgIC8vIHNlbGYubWFya2V0cGxhY2VfbGlzdCA9IGFwcF9pZF9saXN0KCkKICAgIGJ5dGUgIm1hcmtldHBsYWNlX2xpc3QiCiAgICBieXRlIDB4MDAwMAogICAgYXBwX2dsb2JhbF9wdXQKICAgIHJldHN1Ygo=", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgpzbWFydF9jb250cmFjdHMubmZ0X21hcmtldHBsYWNlX2xpc3QuY29udHJhY3QuTmZ0TWFya2V0cGxhY2VMaXN0LmNsZWFyX3N0YXRlX3Byb2dyYW06CiAgICAvLyBzbWFydF9jb250cmFjdHMvbmZ0X21hcmtldHBsYWNlX2xpc3QvY29udHJhY3QucHk6OQogICAgLy8gY2xhc3MgTmZ0TWFya2V0cGxhY2VMaXN0KEFSQzRDb250cmFjdCk6CiAgICBpbnQgMQogICAgcmV0dXJuCg==" + }, + "state": { + "global": { + "num_byte_slices": 1, + "num_uints": 0 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 0 + } + }, + "schema": { + "global": { + "declared": { + "marketplace_list": { + "type": "bytes", + "key": "marketplace_list" + } + }, + "reserved": {} + }, + "local": { + "declared": {}, + "reserved": {} + } + }, + "contract": { + "name": "NftMarketplaceList", + "methods": [ + { + "name": "add_marketplace_to_list", + "args": [ + { + "type": "uint64", + "name": "app_id" + } + ], + "returns": { + "type": "uint64[]" + } + }, + { + "name": "remove_marketplace_from_list", + "args": [ + { + "type": "uint64", + "name": "app_id" + } + ], + "returns": { + "type": "uint64[]" + } + }, + { + "name": "read_marketplace_list", + "args": [], + "returns": { + "type": "uint64[]" + } + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} + +/** + * Defines an onCompletionAction of 'no_op' + */ +export type OnCompleteNoOp = { onCompleteAction?: 'no_op' | OnApplicationComplete.NoOpOC } +/** + * Defines an onCompletionAction of 'opt_in' + */ +export type OnCompleteOptIn = { onCompleteAction: 'opt_in' | OnApplicationComplete.OptInOC } +/** + * Defines an onCompletionAction of 'close_out' + */ +export type OnCompleteCloseOut = { onCompleteAction: 'close_out' | OnApplicationComplete.CloseOutOC } +/** + * Defines an onCompletionAction of 'delete_application' + */ +export type OnCompleteDelApp = { onCompleteAction: 'delete_application' | OnApplicationComplete.DeleteApplicationOC } +/** + * Defines an onCompletionAction of 'update_application' + */ +export type OnCompleteUpdApp = { onCompleteAction: 'update_application' | OnApplicationComplete.UpdateApplicationOC } +/** + * A state record containing a single unsigned integer + */ +export type IntegerState = { + /** + * Gets the state value as a BigInt. + */ + asBigInt(): bigint + /** + * Gets the state value as a number. + */ + asNumber(): number +} +/** + * A state record containing binary data + */ +export type BinaryState = { + /** + * Gets the state value as a Uint8Array + */ + asByteArray(): Uint8Array + /** + * Gets the state value as a string + */ + asString(): string +} + +export type AppCreateCallTransactionResult = AppCallTransactionResult & Partial & AppReference +export type AppUpdateCallTransactionResult = AppCallTransactionResult & Partial + +export type AppClientComposeCallCoreParams = Omit & { + sendParams?: Omit +} +export type AppClientComposeExecuteParams = Pick + +export type IncludeSchema = { + /** + * Any overrides for the storage schema to request for the created app; by default the schema indicated by the app spec is used. + */ + schema?: Partial +} + +/** + * Defines the types of available calls and state of the NftMarketplaceList smart contract. + */ +export type NftMarketplaceList = { + /** + * Maps method signatures / names to their argument and return types. + */ + methods: + & Record<'add_marketplace_to_list(uint64)uint64[]' | 'add_marketplace_to_list', { + argsObj: { + appId: bigint | number + } + argsTuple: [appId: bigint | number] + returns: bigint[] + }> + & Record<'remove_marketplace_from_list(uint64)uint64[]' | 'remove_marketplace_from_list', { + argsObj: { + appId: bigint | number + } + argsTuple: [appId: bigint | number] + returns: bigint[] + }> + & Record<'read_marketplace_list()uint64[]' | 'read_marketplace_list', { + argsObj: { + } + argsTuple: [] + returns: bigint[] + }> + /** + * Defines the shape of the global and local state of the application. + */ + state: { + global: { + marketplaceList?: BinaryState + } + } +} +/** + * Defines the possible abi call signatures + */ +export type NftMarketplaceListSig = keyof NftMarketplaceList['methods'] +/** + * Defines an object containing all relevant parameters for a single call to the contract. Where TSignature is undefined, a bare call is made + */ +export type TypedCallParams = { + method: TSignature + methodArgs: TSignature extends undefined ? undefined : Array +} & AppClientCallCoreParams & CoreAppCallArgs +/** + * Defines the arguments required for a bare call + */ +export type BareCallArgs = Omit +/** + * Maps a method signature from the NftMarketplaceList smart contract to the method's arguments in either tuple of struct form + */ +export type MethodArgs = NftMarketplaceList['methods'][TSignature]['argsObj' | 'argsTuple'] +/** + * Maps a method signature from the NftMarketplaceList smart contract to the method's return type + */ +export type MethodReturn = NftMarketplaceList['methods'][TSignature]['returns'] + +/** + * A factory for available 'create' calls + */ +export type NftMarketplaceListCreateCalls = (typeof NftMarketplaceListCallFactory)['create'] +/** + * Defines supported create methods for this smart contract + */ +export type NftMarketplaceListCreateCallParams = + | (TypedCallParams & (OnCompleteNoOp)) +/** + * Defines arguments required for the deploy method. + */ +export type NftMarketplaceListDeployArgs = { + deployTimeParams?: TealTemplateParams + /** + * A delegate which takes a create call factory and returns the create call params for this smart contract + */ + createCall?: (callFactory: NftMarketplaceListCreateCalls) => NftMarketplaceListCreateCallParams +} + + +/** + * Exposes methods for constructing all available smart contract calls + */ +export abstract class NftMarketplaceListCallFactory { + /** + * Gets available create call factories + */ + static get create() { + return { + /** + * Constructs a create call for the NftMarketplaceList smart contract using a bare call + * + * @param params Any parameters for the call + * @returns A TypedCallParams object for the call + */ + bare(params: BareCallArgs & AppClientCallCoreParams & CoreAppCallArgs & AppClientCompilationParams & (OnCompleteNoOp) = {}) { + return { + method: undefined, + methodArgs: undefined, + ...params, + } + }, + } + } + + /** + * Constructs a no op call for the add_marketplace_to_list(uint64)uint64[] ABI method + * + * @param args Any args for the contract call + * @param params Any additional parameters for the call + * @returns A TypedCallParams object for the call + */ + static addMarketplaceToList(args: MethodArgs<'add_marketplace_to_list(uint64)uint64[]'>, params: AppClientCallCoreParams & CoreAppCallArgs) { + return { + method: 'add_marketplace_to_list(uint64)uint64[]' as const, + methodArgs: Array.isArray(args) ? args : [args.appId], + ...params, + } + } + /** + * Constructs a no op call for the remove_marketplace_from_list(uint64)uint64[] ABI method + * + * @param args Any args for the contract call + * @param params Any additional parameters for the call + * @returns A TypedCallParams object for the call + */ + static removeMarketplaceFromList(args: MethodArgs<'remove_marketplace_from_list(uint64)uint64[]'>, params: AppClientCallCoreParams & CoreAppCallArgs) { + return { + method: 'remove_marketplace_from_list(uint64)uint64[]' as const, + methodArgs: Array.isArray(args) ? args : [args.appId], + ...params, + } + } + /** + * Constructs a no op call for the read_marketplace_list()uint64[] ABI method + * + * @param args Any args for the contract call + * @param params Any additional parameters for the call + * @returns A TypedCallParams object for the call + */ + static readMarketplaceList(args: MethodArgs<'read_marketplace_list()uint64[]'>, params: AppClientCallCoreParams & CoreAppCallArgs) { + return { + method: 'read_marketplace_list()uint64[]' as const, + methodArgs: Array.isArray(args) ? args : [], + ...params, + } + } +} + +/** + * A client to make calls to the NftMarketplaceList smart contract + */ +export class NftMarketplaceListClient { + /** + * The underlying `ApplicationClient` for when you want to have more flexibility + */ + public readonly appClient: ApplicationClient + + private readonly sender: SendTransactionFrom | undefined + + /** + * Creates a new instance of `NftMarketplaceListClient` + * + * @param appDetails appDetails The details to identify the app to deploy + * @param algod An algod client instance + */ + constructor(appDetails: AppDetails, private algod: Algodv2) { + this.sender = appDetails.sender + this.appClient = algokit.getAppClient({ + ...appDetails, + app: APP_SPEC + }, algod) + } + + /** + * Checks for decode errors on the AppCallTransactionResult and maps the return value to the specified generic type + * + * @param result The AppCallTransactionResult to be mapped + * @param returnValueFormatter An optional delegate to format the return value if required + * @returns The smart contract response with an updated return value + */ + protected mapReturnValue(result: AppCallTransactionResult, returnValueFormatter?: (value: any) => TReturn): AppCallTransactionResultOfType & TResult { + if(result.return?.decodeError) { + throw result.return.decodeError + } + const returnValue = result.return?.returnValue !== undefined && returnValueFormatter !== undefined + ? returnValueFormatter(result.return.returnValue) + : result.return?.returnValue as TReturn | undefined + return { ...result, return: returnValue } as AppCallTransactionResultOfType & TResult + } + + /** + * Calls the ABI method with the matching signature using an onCompletion code of NO_OP + * + * @param typedCallParams An object containing the method signature, args, and any other relevant parameters + * @param returnValueFormatter An optional delegate which when provided will be used to map non-undefined return values to the target type + * @returns The result of the smart contract call + */ + public async call(typedCallParams: TypedCallParams, returnValueFormatter?: (value: any) => MethodReturn) { + return this.mapReturnValue>(await this.appClient.call(typedCallParams), returnValueFormatter) + } + + /** + * Idempotently deploys the NftMarketplaceList smart contract. + * + * @param params The arguments for the contract calls and any additional parameters for the call + * @returns The deployment result + */ + public deploy(params: NftMarketplaceListDeployArgs & AppClientDeployCoreParams & IncludeSchema = {}): ReturnType { + const createArgs = params.createCall?.(NftMarketplaceListCallFactory.create) + return this.appClient.deploy({ + ...params, + createArgs, + createOnCompleteAction: createArgs?.onCompleteAction, + }) + } + + /** + * Gets available create methods + */ + public get create() { + const $this = this + return { + /** + * Creates a new instance of the NftMarketplaceList smart contract using a bare call. + * + * @param args The arguments for the bare call + * @returns The create result + */ + async bare(args: BareCallArgs & AppClientCallCoreParams & AppClientCompilationParams & IncludeSchema & CoreAppCallArgs & (OnCompleteNoOp) = {}) { + return $this.mapReturnValue(await $this.appClient.create(args)) + }, + } + } + + /** + * Makes a clear_state call to an existing instance of the NftMarketplaceList smart contract. + * + * @param args The arguments for the bare call + * @returns The clear_state result + */ + public clearState(args: BareCallArgs & AppClientCallCoreParams & CoreAppCallArgs = {}) { + return this.appClient.clearState(args) + } + + /** + * Calls the add_marketplace_to_list(uint64)uint64[] ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The result of the call + */ + public addMarketplaceToList(args: MethodArgs<'add_marketplace_to_list(uint64)uint64[]'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return this.call(NftMarketplaceListCallFactory.addMarketplaceToList(args, params)) + } + + /** + * Calls the remove_marketplace_from_list(uint64)uint64[] ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The result of the call + */ + public removeMarketplaceFromList(args: MethodArgs<'remove_marketplace_from_list(uint64)uint64[]'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return this.call(NftMarketplaceListCallFactory.removeMarketplaceFromList(args, params)) + } + + /** + * Calls the read_marketplace_list()uint64[] ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The result of the call + */ + public readMarketplaceList(args: MethodArgs<'read_marketplace_list()uint64[]'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return this.call(NftMarketplaceListCallFactory.readMarketplaceList(args, params)) + } + + /** + * Extracts a binary state value out of an AppState dictionary + * + * @param state The state dictionary containing the state value + * @param key The key of the state value + * @returns A BinaryState instance containing the state value, or undefined if the key was not found + */ + private static getBinaryState(state: AppState, key: string): BinaryState | undefined { + const value = state[key] + if (!value) return undefined + if (!('valueRaw' in value)) + throw new Error(`Failed to parse state value for ${key}; received an int when expected a byte array`) + return { + asString(): string { + return value.value + }, + asByteArray(): Uint8Array { + return value.valueRaw + } + } + } + + /** + * Extracts a integer state value out of an AppState dictionary + * + * @param state The state dictionary containing the state value + * @param key The key of the state value + * @returns An IntegerState instance containing the state value, or undefined if the key was not found + */ + private static getIntegerState(state: AppState, key: string): IntegerState | undefined { + const value = state[key] + if (!value) return undefined + if ('valueRaw' in value) + throw new Error(`Failed to parse state value for ${key}; received a byte array when expected a number`) + return { + asBigInt() { + return typeof value.value === 'bigint' ? value.value : BigInt(value.value) + }, + asNumber(): number { + return typeof value.value === 'bigint' ? Number(value.value) : value.value + }, + } + } + + /** + * Returns the smart contract's global state wrapped in a strongly typed accessor with options to format the stored value + */ + public async getGlobalState(): Promise { + const state = await this.appClient.getGlobalState() + return { + get marketplaceList() { + return NftMarketplaceListClient.getBinaryState(state, 'marketplace_list') + }, + } + } + + public compose(): NftMarketplaceListComposer { + const client = this + const atc = new AtomicTransactionComposer() + let promiseChain:Promise = Promise.resolve() + const resultMappers: Array any)> = [] + return { + addMarketplaceToList(args: MethodArgs<'add_marketplace_to_list(uint64)uint64[]'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) { + promiseChain = promiseChain.then(() => client.addMarketplaceToList(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return this + }, + removeMarketplaceFromList(args: MethodArgs<'remove_marketplace_from_list(uint64)uint64[]'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) { + promiseChain = promiseChain.then(() => client.removeMarketplaceFromList(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return this + }, + readMarketplaceList(args: MethodArgs<'read_marketplace_list()uint64[]'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) { + promiseChain = promiseChain.then(() => client.readMarketplaceList(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return this + }, + clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs) { + promiseChain = promiseChain.then(() => client.clearState({...args, sendParams: {...args?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return this + }, + addTransaction(txn: TransactionWithSigner | TransactionToSign | Transaction | Promise, defaultSender?: SendTransactionFrom) { + promiseChain = promiseChain.then(async () => atc.addTransaction(await algokit.getTransactionWithSigner(txn, defaultSender ?? client.sender))) + return this + }, + async atc() { + await promiseChain + return atc + }, + async simulate(options?: SimulateOptions) { + await promiseChain + const result = await atc.simulate(client.algod, new modelsv2.SimulateRequest({ txnGroups: [], ...options })) + return { + ...result, + returns: result.methodResults?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val.returnValue) : val.returnValue) + } + }, + async execute(sendParams?: AppClientComposeExecuteParams) { + await promiseChain + const result = await algokit.sendAtomicTransactionComposer({ atc, sendParams }, client.algod) + return { + ...result, + returns: result.returns?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val.returnValue) : val.returnValue) + } + } + } as unknown as NftMarketplaceListComposer + } +} +export type NftMarketplaceListComposer = { + /** + * Calls the add_marketplace_to_list(uint64)uint64[] ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + addMarketplaceToList(args: MethodArgs<'add_marketplace_to_list(uint64)uint64[]'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): NftMarketplaceListComposer<[...TReturns, MethodReturn<'add_marketplace_to_list(uint64)uint64[]'>]> + + /** + * Calls the remove_marketplace_from_list(uint64)uint64[] ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + removeMarketplaceFromList(args: MethodArgs<'remove_marketplace_from_list(uint64)uint64[]'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): NftMarketplaceListComposer<[...TReturns, MethodReturn<'remove_marketplace_from_list(uint64)uint64[]'>]> + + /** + * Calls the read_marketplace_list()uint64[] ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + readMarketplaceList(args: MethodArgs<'read_marketplace_list()uint64[]'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): NftMarketplaceListComposer<[...TReturns, MethodReturn<'read_marketplace_list()uint64[]'>]> + + /** + * Makes a clear_state call to an existing instance of the NftMarketplaceList smart contract. + * + * @param args The arguments for the bare call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs): NftMarketplaceListComposer<[...TReturns, undefined]> + + /** + * Adds a transaction to the composer + * + * @param txn One of: A TransactionWithSigner object (returned as is), a TransactionToSign object (signer is obtained from the signer property), a Transaction object (signer is extracted from the defaultSender parameter), an async SendTransactionResult returned by one of algokit utils helpers (signer is obtained from the defaultSender parameter) + * @param defaultSender The default sender to be used to obtain a signer where the object provided to the transaction parameter does not include a signer. + */ + addTransaction(txn: TransactionWithSigner | TransactionToSign | Transaction | Promise, defaultSender?: SendTransactionFrom): NftMarketplaceListComposer + /** + * Returns the underlying AtomicTransactionComposer instance + */ + atc(): Promise + /** + * Simulates the transaction group and returns the result + */ + simulate(options?: SimulateOptions): Promise> + /** + * Executes the transaction group and returns the results + */ + execute(sendParams?: AppClientComposeExecuteParams): Promise> +} +export type SimulateOptions = Omit[0], 'txnGroups'> +export type NftMarketplaceListComposerSimulateResult = { + returns: TReturns + methodResults: ABIResult[] + simulateResponse: modelsv2.SimulateResponse +} +export type NftMarketplaceListComposerResults = { + returns: TReturns + groupId: string + txIds: string[] + transactions: Transaction[] +} diff --git a/projects/orakle-nft-marketplace-app-frontend/src/contracts/PersonalBank.ts b/projects/orakle-nft-marketplace-app-frontend/src/contracts/PersonalBank.ts new file mode 100644 index 0000000..821ae7f --- /dev/null +++ b/projects/orakle-nft-marketplace-app-frontend/src/contracts/PersonalBank.ts @@ -0,0 +1,714 @@ +/* eslint-disable */ +/** + * This file was automatically generated by @algorandfoundation/algokit-client-generator. + * DO NOT MODIFY IT BY HAND. + * requires: @algorandfoundation/algokit-utils: ^2 + */ +import * as algokit from '@algorandfoundation/algokit-utils' +import type { + ABIAppCallArg, + AppCallTransactionResult, + AppCallTransactionResultOfType, + AppCompilationResult, + AppReference, + AppState, + AppStorageSchema, + CoreAppCallArgs, + RawAppCallArgs, + TealTemplateParams, +} from '@algorandfoundation/algokit-utils/types/app' +import type { + AppClientCallCoreParams, + AppClientCompilationParams, + AppClientDeployCoreParams, + AppDetails, + ApplicationClient, +} from '@algorandfoundation/algokit-utils/types/app-client' +import type { AppSpec } from '@algorandfoundation/algokit-utils/types/app-spec' +import type { SendTransactionResult, TransactionToSign, SendTransactionFrom, SendTransactionParams } from '@algorandfoundation/algokit-utils/types/transaction' +import type { ABIResult, TransactionWithSigner } from 'algosdk' +import { Algodv2, OnApplicationComplete, Transaction, AtomicTransactionComposer, modelsv2 } from 'algosdk' +export const APP_SPEC: AppSpec = { + "hints": { + "opt_in_to_app()void": { + "call_config": { + "opt_in": "CALL" + } + }, + "deposit(pay)uint64": { + "call_config": { + "no_op": "CALL" + } + }, + "withdraw()uint64": { + "call_config": { + "close_out": "CALL" + } + } + }, + "source": { + "approval": "I3ByYWdtYSB2ZXJzaW9uIDEwCgpzbWFydF9jb250cmFjdHMucGVyc29uYWxfYmFuay5jb250cmFjdC5QZXJzb25hbEJhbmsuYXBwcm92YWxfcHJvZ3JhbToKICAgIHR4biBBcHBsaWNhdGlvbklECiAgICBibnogbWFpbl9lbnRyeXBvaW50QDIKICAgIGNhbGxzdWIgX19pbml0X18KCm1haW5fZW50cnlwb2ludEAyOgogICAgLy8gc21hcnRfY29udHJhY3RzL3BlcnNvbmFsX2JhbmsvY29udHJhY3QucHk6NAogICAgLy8gY2xhc3MgUGVyc29uYWxCYW5rKEFSQzRDb250cmFjdCk6CiAgICB0eG4gTnVtQXBwQXJncwogICAgYnogbWFpbl9iYXJlX3JvdXRpbmdAOQogICAgbWV0aG9kICJvcHRfaW5fdG9fYXBwKCl2b2lkIgogICAgbWV0aG9kICJkZXBvc2l0KHBheSl1aW50NjQiCiAgICBtZXRob2QgIndpdGhkcmF3KCl1aW50NjQiCiAgICB0eG5hIEFwcGxpY2F0aW9uQXJncyAwCiAgICBtYXRjaCBtYWluX29wdF9pbl90b19hcHBfcm91dGVANCBtYWluX2RlcG9zaXRfcm91dGVANSBtYWluX3dpdGhkcmF3X3JvdXRlQDYKICAgIGVyciAvLyByZWplY3QgdHJhbnNhY3Rpb24KCm1haW5fb3B0X2luX3RvX2FwcF9yb3V0ZUA0OgogICAgLy8gc21hcnRfY29udHJhY3RzL3BlcnNvbmFsX2JhbmsvY29udHJhY3QucHk6MTAKICAgIC8vIEBhcmM0LmFiaW1ldGhvZChhbGxvd19hY3Rpb25zPVsiT3B0SW4iXSkKICAgIHR4biBPbkNvbXBsZXRpb24KICAgIGludCBPcHRJbgogICAgPT0KICAgIGFzc2VydCAvL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c3RzCiAgICBpbnQgMQogICAgLQogICAgYnl0ZSAiZGVwb3NpdG9ycyIKICAgIHN3YXAKICAgIGFwcF9nbG9iYWxfcHV0CiAgICAvLyBzbWFydF9jb250cmFjdHMvcGVyc29uYWxfYmFuay9jb250cmFjdC5weTo1MAogICAgLy8gcmV0dXJuIHVzZXJCYWxhbmNlCiAgICByZXRzdWIKCgovLyBzbWFydF9jb250cmFjdHMucGVyc29uYWxfYmFuay5jb250cmFjdC5QZXJzb25hbEJhbmsuX19pbml0X18oKSAtPiB2b2lkOgpfX2luaXRfXzoKICAgIC8vIHNtYXJ0X2NvbnRyYWN0cy9wZXJzb25hbF9iYW5rL2NvbnRyYWN0LnB5OjUKICAgIC8vIGRlZiBfX2luaXRfXyhzZWxmKSAtPiBOb25lOgogICAgcHJvdG8gMCAwCiAgICAvLyBzbWFydF9jb250cmFjdHMvcGVyc29uYWxfYmFuay9jb250cmFjdC5weTo4CiAgICAvLyBzZWxmLmRlcG9zaXRvcnMgPSBVSW50NjQoMCkKICAgIGJ5dGUgImRlcG9zaXRvcnMiCiAgICBpbnQgMAogICAgYXBwX2dsb2JhbF9wdXQKICAgIHJldHN1Ygo=", + "clear": "I3ByYWdtYSB2ZXJzaW9uIDEwCgpzbWFydF9jb250cmFjdHMucGVyc29uYWxfYmFuay5jb250cmFjdC5QZXJzb25hbEJhbmsuY2xlYXJfc3RhdGVfcHJvZ3JhbToKICAgIC8vIHNtYXJ0X2NvbnRyYWN0cy9wZXJzb25hbF9iYW5rL2NvbnRyYWN0LnB5OjQKICAgIC8vIGNsYXNzIFBlcnNvbmFsQmFuayhBUkM0Q29udHJhY3QpOgogICAgaW50IDEKICAgIHJldHVybgo=" + }, + "state": { + "global": { + "num_byte_slices": 0, + "num_uints": 1 + }, + "local": { + "num_byte_slices": 0, + "num_uints": 2 + } + }, + "schema": { + "global": { + "declared": { + "depositors": { + "type": "uint64", + "key": "depositors" + } + }, + "reserved": {} + }, + "local": { + "declared": { + "balance": { + "type": "uint64", + "key": "balance" + }, + "optedIn": { + "type": "uint64", + "key": "optedIn" + } + }, + "reserved": {} + } + }, + "contract": { + "name": "PersonalBank", + "methods": [ + { + "name": "opt_in_to_app", + "args": [], + "returns": { + "type": "void" + } + }, + { + "name": "deposit", + "args": [ + { + "type": "pay", + "name": "ptxn" + } + ], + "returns": { + "type": "uint64" + } + }, + { + "name": "withdraw", + "args": [], + "returns": { + "type": "uint64" + } + } + ], + "networks": {} + }, + "bare_call_config": { + "no_op": "CREATE" + } +} + +/** + * Defines an onCompletionAction of 'no_op' + */ +export type OnCompleteNoOp = { onCompleteAction?: 'no_op' | OnApplicationComplete.NoOpOC } +/** + * Defines an onCompletionAction of 'opt_in' + */ +export type OnCompleteOptIn = { onCompleteAction: 'opt_in' | OnApplicationComplete.OptInOC } +/** + * Defines an onCompletionAction of 'close_out' + */ +export type OnCompleteCloseOut = { onCompleteAction: 'close_out' | OnApplicationComplete.CloseOutOC } +/** + * Defines an onCompletionAction of 'delete_application' + */ +export type OnCompleteDelApp = { onCompleteAction: 'delete_application' | OnApplicationComplete.DeleteApplicationOC } +/** + * Defines an onCompletionAction of 'update_application' + */ +export type OnCompleteUpdApp = { onCompleteAction: 'update_application' | OnApplicationComplete.UpdateApplicationOC } +/** + * A state record containing a single unsigned integer + */ +export type IntegerState = { + /** + * Gets the state value as a BigInt. + */ + asBigInt(): bigint + /** + * Gets the state value as a number. + */ + asNumber(): number +} +/** + * A state record containing binary data + */ +export type BinaryState = { + /** + * Gets the state value as a Uint8Array + */ + asByteArray(): Uint8Array + /** + * Gets the state value as a string + */ + asString(): string +} + +export type AppCreateCallTransactionResult = AppCallTransactionResult & Partial & AppReference +export type AppUpdateCallTransactionResult = AppCallTransactionResult & Partial + +export type AppClientComposeCallCoreParams = Omit & { + sendParams?: Omit +} +export type AppClientComposeExecuteParams = Pick + +export type IncludeSchema = { + /** + * Any overrides for the storage schema to request for the created app; by default the schema indicated by the app spec is used. + */ + schema?: Partial +} + +/** + * Defines the types of available calls and state of the PersonalBank smart contract. + */ +export type PersonalBank = { + /** + * Maps method signatures / names to their argument and return types. + */ + methods: + & Record<'opt_in_to_app()void' | 'opt_in_to_app', { + argsObj: { + } + argsTuple: [] + returns: void + }> + & Record<'deposit(pay)uint64' | 'deposit', { + argsObj: { + ptxn: TransactionToSign | Transaction | Promise + } + argsTuple: [ptxn: TransactionToSign | Transaction | Promise] + returns: bigint + }> + & Record<'withdraw()uint64' | 'withdraw', { + argsObj: { + } + argsTuple: [] + returns: bigint + }> + /** + * Defines the shape of the global and local state of the application. + */ + state: { + global: { + depositors?: IntegerState + } + local: { + balance?: IntegerState + optedIn?: IntegerState + } + } +} +/** + * Defines the possible abi call signatures + */ +export type PersonalBankSig = keyof PersonalBank['methods'] +/** + * Defines an object containing all relevant parameters for a single call to the contract. Where TSignature is undefined, a bare call is made + */ +export type TypedCallParams = { + method: TSignature + methodArgs: TSignature extends undefined ? undefined : Array +} & AppClientCallCoreParams & CoreAppCallArgs +/** + * Defines the arguments required for a bare call + */ +export type BareCallArgs = Omit +/** + * Maps a method signature from the PersonalBank smart contract to the method's arguments in either tuple of struct form + */ +export type MethodArgs = PersonalBank['methods'][TSignature]['argsObj' | 'argsTuple'] +/** + * Maps a method signature from the PersonalBank smart contract to the method's return type + */ +export type MethodReturn = PersonalBank['methods'][TSignature]['returns'] + +/** + * A factory for available 'create' calls + */ +export type PersonalBankCreateCalls = (typeof PersonalBankCallFactory)['create'] +/** + * Defines supported create methods for this smart contract + */ +export type PersonalBankCreateCallParams = + | (TypedCallParams & (OnCompleteNoOp)) +/** + * Defines arguments required for the deploy method. + */ +export type PersonalBankDeployArgs = { + deployTimeParams?: TealTemplateParams + /** + * A delegate which takes a create call factory and returns the create call params for this smart contract + */ + createCall?: (callFactory: PersonalBankCreateCalls) => PersonalBankCreateCallParams +} + + +/** + * Exposes methods for constructing all available smart contract calls + */ +export abstract class PersonalBankCallFactory { + /** + * Gets available create call factories + */ + static get create() { + return { + /** + * Constructs a create call for the PersonalBank smart contract using a bare call + * + * @param params Any parameters for the call + * @returns A TypedCallParams object for the call + */ + bare(params: BareCallArgs & AppClientCallCoreParams & CoreAppCallArgs & AppClientCompilationParams & (OnCompleteNoOp) = {}) { + return { + method: undefined, + methodArgs: undefined, + ...params, + } + }, + } + } + + /** + * Gets available optIn call factories + */ + static get optIn() { + return { + /** + * Constructs an opt in call for the PersonalBank smart contract using the opt_in_to_app()void ABI method + * + * @param args Any args for the contract call + * @param params Any additional parameters for the call + * @returns A TypedCallParams object for the call + */ + optInToApp(args: MethodArgs<'opt_in_to_app()void'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return { + method: 'opt_in_to_app()void' as const, + methodArgs: Array.isArray(args) ? args : [], + ...params, + } + }, + } + } + + /** + * Gets available closeOut call factories + */ + static get closeOut() { + return { + /** + * Constructs a close out call for the PersonalBank smart contract using the withdraw()uint64 ABI method + * + * @param args Any args for the contract call + * @param params Any additional parameters for the call + * @returns A TypedCallParams object for the call + */ + withdraw(args: MethodArgs<'withdraw()uint64'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return { + method: 'withdraw()uint64' as const, + methodArgs: Array.isArray(args) ? args : [], + ...params, + } + }, + } + } + + /** + * Constructs a no op call for the deposit(pay)uint64 ABI method + * + * @param args Any args for the contract call + * @param params Any additional parameters for the call + * @returns A TypedCallParams object for the call + */ + static deposit(args: MethodArgs<'deposit(pay)uint64'>, params: AppClientCallCoreParams & CoreAppCallArgs) { + return { + method: 'deposit(pay)uint64' as const, + methodArgs: Array.isArray(args) ? args : [args.ptxn], + ...params, + } + } +} + +/** + * A client to make calls to the PersonalBank smart contract + */ +export class PersonalBankClient { + /** + * The underlying `ApplicationClient` for when you want to have more flexibility + */ + public readonly appClient: ApplicationClient + + private readonly sender: SendTransactionFrom | undefined + + /** + * Creates a new instance of `PersonalBankClient` + * + * @param appDetails appDetails The details to identify the app to deploy + * @param algod An algod client instance + */ + constructor(appDetails: AppDetails, private algod: Algodv2) { + this.sender = appDetails.sender + this.appClient = algokit.getAppClient({ + ...appDetails, + app: APP_SPEC + }, algod) + } + + /** + * Checks for decode errors on the AppCallTransactionResult and maps the return value to the specified generic type + * + * @param result The AppCallTransactionResult to be mapped + * @param returnValueFormatter An optional delegate to format the return value if required + * @returns The smart contract response with an updated return value + */ + protected mapReturnValue(result: AppCallTransactionResult, returnValueFormatter?: (value: any) => TReturn): AppCallTransactionResultOfType & TResult { + if(result.return?.decodeError) { + throw result.return.decodeError + } + const returnValue = result.return?.returnValue !== undefined && returnValueFormatter !== undefined + ? returnValueFormatter(result.return.returnValue) + : result.return?.returnValue as TReturn | undefined + return { ...result, return: returnValue } as AppCallTransactionResultOfType & TResult + } + + /** + * Calls the ABI method with the matching signature using an onCompletion code of NO_OP + * + * @param typedCallParams An object containing the method signature, args, and any other relevant parameters + * @param returnValueFormatter An optional delegate which when provided will be used to map non-undefined return values to the target type + * @returns The result of the smart contract call + */ + public async call(typedCallParams: TypedCallParams, returnValueFormatter?: (value: any) => MethodReturn) { + return this.mapReturnValue>(await this.appClient.call(typedCallParams), returnValueFormatter) + } + + /** + * Idempotently deploys the PersonalBank smart contract. + * + * @param params The arguments for the contract calls and any additional parameters for the call + * @returns The deployment result + */ + public deploy(params: PersonalBankDeployArgs & AppClientDeployCoreParams & IncludeSchema = {}): ReturnType { + const createArgs = params.createCall?.(PersonalBankCallFactory.create) + return this.appClient.deploy({ + ...params, + createArgs, + createOnCompleteAction: createArgs?.onCompleteAction, + }) + } + + /** + * Gets available create methods + */ + public get create() { + const $this = this + return { + /** + * Creates a new instance of the PersonalBank smart contract using a bare call. + * + * @param args The arguments for the bare call + * @returns The create result + */ + async bare(args: BareCallArgs & AppClientCallCoreParams & AppClientCompilationParams & IncludeSchema & CoreAppCallArgs & (OnCompleteNoOp) = {}) { + return $this.mapReturnValue(await $this.appClient.create(args)) + }, + } + } + + /** + * Gets available optIn methods + */ + public get optIn() { + const $this = this + return { + /** + * Opts the user into an existing instance of the PersonalBank smart contract using the opt_in_to_app()void ABI method. + * + * @param args The arguments for the smart contract call + * @param params Any additional parameters for the call + * @returns The optIn result + */ + async optInToApp(args: MethodArgs<'opt_in_to_app()void'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return $this.mapReturnValue>(await $this.appClient.optIn(PersonalBankCallFactory.optIn.optInToApp(args, params))) + }, + } + } + + /** + * Gets available closeOut methods + */ + public get closeOut() { + const $this = this + return { + /** + * Makes a close out call to an existing instance of the PersonalBank smart contract using the withdraw()uint64 ABI method. + * + * @param args The arguments for the smart contract call + * @param params Any additional parameters for the call + * @returns The closeOut result + */ + async withdraw(args: MethodArgs<'withdraw()uint64'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return $this.mapReturnValue>(await $this.appClient.closeOut(PersonalBankCallFactory.closeOut.withdraw(args, params))) + }, + } + } + + /** + * Makes a clear_state call to an existing instance of the PersonalBank smart contract. + * + * @param args The arguments for the bare call + * @returns The clear_state result + */ + public clearState(args: BareCallArgs & AppClientCallCoreParams & CoreAppCallArgs = {}) { + return this.appClient.clearState(args) + } + + /** + * Calls the deposit(pay)uint64 ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The result of the call + */ + public deposit(args: MethodArgs<'deposit(pay)uint64'>, params: AppClientCallCoreParams & CoreAppCallArgs = {}) { + return this.call(PersonalBankCallFactory.deposit(args, params)) + } + + /** + * Extracts a binary state value out of an AppState dictionary + * + * @param state The state dictionary containing the state value + * @param key The key of the state value + * @returns A BinaryState instance containing the state value, or undefined if the key was not found + */ + private static getBinaryState(state: AppState, key: string): BinaryState | undefined { + const value = state[key] + if (!value) return undefined + if (!('valueRaw' in value)) + throw new Error(`Failed to parse state value for ${key}; received an int when expected a byte array`) + return { + asString(): string { + return value.value + }, + asByteArray(): Uint8Array { + return value.valueRaw + } + } + } + + /** + * Extracts a integer state value out of an AppState dictionary + * + * @param state The state dictionary containing the state value + * @param key The key of the state value + * @returns An IntegerState instance containing the state value, or undefined if the key was not found + */ + private static getIntegerState(state: AppState, key: string): IntegerState | undefined { + const value = state[key] + if (!value) return undefined + if ('valueRaw' in value) + throw new Error(`Failed to parse state value for ${key}; received a byte array when expected a number`) + return { + asBigInt() { + return typeof value.value === 'bigint' ? value.value : BigInt(value.value) + }, + asNumber(): number { + return typeof value.value === 'bigint' ? Number(value.value) : value.value + }, + } + } + + /** + * Returns the smart contract's global state wrapped in a strongly typed accessor with options to format the stored value + */ + public async getGlobalState(): Promise { + const state = await this.appClient.getGlobalState() + return { + get depositors() { + return PersonalBankClient.getIntegerState(state, 'depositors') + }, + } + } + + /** + * Returns the smart contract's local state wrapped in a strongly typed accessor with options to format the stored value + * + * @param account The address of the account for which to read local state from + */ + public async getLocalState(account: string | SendTransactionFrom): Promise { + const state = await this.appClient.getLocalState(account) + return { + get balance() { + return PersonalBankClient.getIntegerState(state, 'balance') + }, + get optedIn() { + return PersonalBankClient.getIntegerState(state, 'optedIn') + }, + } + } + + public compose(): PersonalBankComposer { + const client = this + const atc = new AtomicTransactionComposer() + let promiseChain:Promise = Promise.resolve() + const resultMappers: Array any)> = [] + return { + deposit(args: MethodArgs<'deposit(pay)uint64'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs) { + promiseChain = promiseChain.then(() => client.deposit(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return this + }, + get optIn() { + const $this = this + return { + optInToApp(args: MethodArgs<'opt_in_to_app()void'>, params?: AppClientComposeCallCoreParams) { + promiseChain = promiseChain.then(() => client.optIn.optInToApp(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return $this + }, + } + }, + get closeOut() { + const $this = this + return { + withdraw(args: MethodArgs<'withdraw()uint64'>, params?: AppClientComposeCallCoreParams) { + promiseChain = promiseChain.then(() => client.closeOut.withdraw(args, {...params, sendParams: {...params?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return $this + }, + } + }, + clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs) { + promiseChain = promiseChain.then(() => client.clearState({...args, sendParams: {...args?.sendParams, skipSending: true, atc}})) + resultMappers.push(undefined) + return this + }, + addTransaction(txn: TransactionWithSigner | TransactionToSign | Transaction | Promise, defaultSender?: SendTransactionFrom) { + promiseChain = promiseChain.then(async () => atc.addTransaction(await algokit.getTransactionWithSigner(txn, defaultSender ?? client.sender))) + return this + }, + async atc() { + await promiseChain + return atc + }, + async simulate(options?: SimulateOptions) { + await promiseChain + const result = await atc.simulate(client.algod, new modelsv2.SimulateRequest({ txnGroups: [], ...options })) + return { + ...result, + returns: result.methodResults?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val.returnValue) : val.returnValue) + } + }, + async execute(sendParams?: AppClientComposeExecuteParams) { + await promiseChain + const result = await algokit.sendAtomicTransactionComposer({ atc, sendParams }, client.algod) + return { + ...result, + returns: result.returns?.map((val, i) => resultMappers[i] !== undefined ? resultMappers[i]!(val.returnValue) : val.returnValue) + } + } + } as unknown as PersonalBankComposer + } +} +export type PersonalBankComposer = { + /** + * Calls the deposit(pay)uint64 ABI method. + * + * @param args The arguments for the contract call + * @param params Any additional parameters for the call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + deposit(args: MethodArgs<'deposit(pay)uint64'>, params?: AppClientComposeCallCoreParams & CoreAppCallArgs): PersonalBankComposer<[...TReturns, MethodReturn<'deposit(pay)uint64'>]> + + /** + * Gets available optIn methods + */ + readonly optIn: { + /** + * Opts the user into an existing instance of the PersonalBank smart contract using the opt_in_to_app()void ABI method. + * + * @param args The arguments for the smart contract call + * @param params Any additional parameters for the call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + optInToApp(args: MethodArgs<'opt_in_to_app()void'>, params?: AppClientComposeCallCoreParams): PersonalBankComposer<[...TReturns, MethodReturn<'opt_in_to_app()void'>]> + } + + /** + * Gets available closeOut methods + */ + readonly closeOut: { + /** + * Makes a close out call to an existing instance of the PersonalBank smart contract using the withdraw()uint64 ABI method. + * + * @param args The arguments for the smart contract call + * @param params Any additional parameters for the call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + withdraw(args: MethodArgs<'withdraw()uint64'>, params?: AppClientComposeCallCoreParams): PersonalBankComposer<[...TReturns, MethodReturn<'withdraw()uint64'>]> + } + + /** + * Makes a clear_state call to an existing instance of the PersonalBank smart contract. + * + * @param args The arguments for the bare call + * @returns The typed transaction composer so you can fluently chain multiple calls or call execute to execute all queued up transactions + */ + clearState(args?: BareCallArgs & AppClientComposeCallCoreParams & CoreAppCallArgs): PersonalBankComposer<[...TReturns, undefined]> + + /** + * Adds a transaction to the composer + * + * @param txn One of: A TransactionWithSigner object (returned as is), a TransactionToSign object (signer is obtained from the signer property), a Transaction object (signer is extracted from the defaultSender parameter), an async SendTransactionResult returned by one of algokit utils helpers (signer is obtained from the defaultSender parameter) + * @param defaultSender The default sender to be used to obtain a signer where the object provided to the transaction parameter does not include a signer. + */ + addTransaction(txn: TransactionWithSigner | TransactionToSign | Transaction | Promise, defaultSender?: SendTransactionFrom): PersonalBankComposer + /** + * Returns the underlying AtomicTransactionComposer instance + */ + atc(): Promise + /** + * Simulates the transaction group and returns the result + */ + simulate(options?: SimulateOptions): Promise> + /** + * Executes the transaction group and returns the results + */ + execute(sendParams?: AppClientComposeExecuteParams): Promise> +} +export type SimulateOptions = Omit[0], 'txnGroups'> +export type PersonalBankComposerSimulateResult = { + returns: TReturns + methodResults: ABIResult[] + simulateResponse: modelsv2.SimulateResponse +} +export type PersonalBankComposerResults = { + returns: TReturns + groupId: string + txIds: string[] + transactions: Transaction[] +} diff --git a/projects/orakle-nft-marketplace-app-frontend/src/methods.ts b/projects/orakle-nft-marketplace-app-frontend/src/methods.ts index 58e8275..0420685 100644 --- a/projects/orakle-nft-marketplace-app-frontend/src/methods.ts +++ b/projects/orakle-nft-marketplace-app-frontend/src/methods.ts @@ -46,7 +46,7 @@ export function createAndListNft( 힌트: https://github.com/algorandfoundation/algokit-client-generator-ts/blob/main/docs/usage.md#create-calls */ // 문제 6 시작 - const createResult = '여기에 코드 작성' + const createResult = await nftmClient.create.bare() // 문제 6 끝 /* @@ -78,10 +78,10 @@ export function createAndListNft( sender, receiver: createResult.appAddress, amount: algokit.algos(0.1 + 0.1), - extraFee: '여기에 코드 작성', + extraFee: algokit.transactionFees(2), }) - ;('여기에 코드 작성') + await nftmClient.bootstrap({ asset: assetBeingSold, unitaryPrice: unitaryPrice, mbrPay: mbrTxn }) // 문제 7 끝 const sendAssetToSell = { @@ -161,7 +161,7 @@ export function buyNft( assetId, }) // 문제 8 시작 - ;('여기에 코드 작성') + await nftmClient.compose().addTransaction(assetOptInTxn).buy({ buyerTxn: buyerTxn, quantity: quantity }).execute() // 문제 8 끝 console.log(`${sender}가 에셋에 옵트인하고 구매했어요!`) @@ -209,7 +209,7 @@ export function deleteAppAndWithdraw(nftmClient: NftMarketplaceClient, listClien */ // 문제 9 시작 - ;('여기에 코드 작성') + await nftmClient.delete.withdrawAndDelete({}, { sendParams: { fee: algokit.algos(0.003) } }) // 문제 9 끝 await listClient.removeMarketplaceFromList({ appId: BigInt(appId) }) diff --git a/projects/orakle-nft-marketplace-app-frontend/src/utils/getCurrentNftmClient.ts b/projects/orakle-nft-marketplace-app-frontend/src/utils/getCurrentNftmClient.ts index 5d22ab8..5736625 100644 --- a/projects/orakle-nft-marketplace-app-frontend/src/utils/getCurrentNftmClient.ts +++ b/projects/orakle-nft-marketplace-app-frontend/src/utils/getCurrentNftmClient.ts @@ -43,7 +43,18 @@ export function getCurrentNftmClient( */ // 문제 5 시작 - const nftmClient = '여기에 코드 작성' + const nftmClient = new NftMarketplaceClient( + { + resolveBy: 'id', + id: currentAppId, + // Optionally specify a different name for the contract - otherwise contract.name from the application spec file is used + name: 'AlternativeName', + // Optionally specify a default sender for all calls made from the client + sender: { addr: activeAddress!, signer }, + }, + // An algod client is required to make the underlying calls to the network + algorandClient.client.algod, + ) // 문제 5 끝 return nftmClient diff --git a/projects/orakle-nft-marketplace-app-frontend/src/utils/marketplaceListAppId.ts b/projects/orakle-nft-marketplace-app-frontend/src/utils/marketplaceListAppId.ts index 4abd86c..2bbb018 100644 --- a/projects/orakle-nft-marketplace-app-frontend/src/utils/marketplaceListAppId.ts +++ b/projects/orakle-nft-marketplace-app-frontend/src/utils/marketplaceListAppId.ts @@ -1 +1 @@ -export const marketplaceListAppId = 1018 //테스트 중 에러가 발생하면 마켓플레이스 리스트 스마트계약을 재배포하고 새로운 app id로 교체해주세요. +export const marketplaceListAppId = 1083 //테스트 중 에러가 발생하면 마켓플레이스 리스트 스마트계약을 재배포하고 새로운 app id로 교체해주세요.