Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 3, 2024. It is now read-only.

Commit dae9a5e

Browse files
committed
Moved types files, added stubs for pack module
1 parent 0b57b75 commit dae9a5e

File tree

10 files changed

+104
-22
lines changed

10 files changed

+104
-22
lines changed

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import nftlabs.options
44
from nftlabs import NftlabsSdk
55
from pprint import pprint
6-
from nftlabs.modules.nft_types import MintArg
6+
from nftlabs.types.nft import MintArg
77
from nftlabs.types import Role
88

99
options = nftlabs.options.SdkOptions()

nftlabs/modules/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from .currency import *
2-
from .currency_types import *
32

43
from .nft import *
54
from .nft_types import *
65

76
from .pack import *
8-

nftlabs/modules/currency.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from ..types import Role
33
from ..abi.coin import Coin
44
from .base import BaseModule
5-
from .currency_types import Currency, CurrencyValue
5+
from ..types.currency import Currency, CurrencyValue
66
from ..abi.erc20 import ERC20
77
from web3 import Web3
88
from typing import List, Dict

nftlabs/modules/nft.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
from typing import Dict, List
1010
from ..abi.nft import NFT
1111

12-
from ..types import NFT as NftType, Role
13-
from .nft_types import MintArg
12+
from ..types import Role
13+
from ..types.nft import MintArg, NftMetadata as NftType
1414

1515

1616
class NftModule(BaseModule):

nftlabs/modules/nft_types.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1 @@
1-
from dataclasses import dataclass
2-
from typing import Optional
3-
4-
5-
@dataclass
6-
class MintArg:
7-
name: str
8-
description: str = ""
9-
image_uri: str = ""
10-
properties: Optional[dict] = None
111

nftlabs/modules/pack.py

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from ..errors import NoSignerException
22
from ..types import Role
3+
from ..types.pack import PackMetadata, PackNftMetadata, CreatePackArg, AssetAmountPair
4+
from ..types.nft import NftMetadata
5+
from ..types.currency import Currency, CurrencyValue
36
from ..abi.pack import Pack
47
from .base import BaseModule
5-
from .currency_types import Currency, CurrencyValue
68
from ..abi.erc20 import ERC20
79
from web3 import Web3
810
from typing import List, Dict
@@ -17,6 +19,57 @@ def __init__(self, address: str, client: Web3):
1719
self.address = address
1820
self.__abi_module = Pack(client, address)
1921

22+
def get(self, pack_id: int) -> PackMetadata:
23+
pass
24+
25+
def open(self, pack_id: int) -> List[NftMetadata]:
26+
pass
27+
28+
def get_all(self) -> List[PackMetadata]:
29+
pass
30+
31+
def get_nfts(self, pack_id: int) -> List[PackNftMetadata]:
32+
pass
33+
34+
def balance_of(self, address: str, token_id: int) -> int:
35+
pass
36+
37+
def balance(self, token_id) -> int:
38+
pass
39+
40+
def is_approved(self, address: str, operator: str) -> bool:
41+
pass
42+
43+
def set_approval(self, operator: str, approved: bool):
44+
pass
45+
46+
def transfer(self, to_address: str, token_id: int, amount: int):
47+
pass
48+
49+
def create(self, arg: CreatePackArg) -> PackMetadata:
50+
pass
51+
52+
def transfer_from(self, from_address: str, to_address: str, args: AssetAmountPair):
53+
pass
54+
55+
def transfer_batch_from(self, from_address: str, to_address: str, args: List[AssetAmountPair]):
56+
pass
57+
58+
def get_link_balance(self) -> CurrencyValue:
59+
pass
60+
61+
def deposit_link(self, amount: int):
62+
pass
63+
64+
def withdraw_link(self, to_address: str, amount: int):
65+
pass
66+
67+
def set_royalty_bps(self, amount: int):
68+
pass
69+
70+
def set_restricted_transfer(self, restricted: bool = False):
71+
pass
72+
2073
def grant_role(self, role: Role, address: str):
2174
role_hash = role.get_hash()
2275
self.execute_tx(self.__abi_module.grant_role.build_transaction(

nftlabs/types/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
from .nft import *
2-
3-
from .role import *
1+
from .role import *

nftlabs/modules/currency_types.py renamed to nftlabs/types/currency/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ class Currency:
77
symbol: str
88
decimals: int
99

10+
1011
@dataclasses.dataclass
1112
class CurrencyValue(Currency):
1213
value: str
1314
display_value: str
14-

nftlabs/types/nft.py renamed to nftlabs/types/nft/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@
44
from dataclasses_json import dataclass_json
55

66

7+
@dataclass
8+
class MintArg:
9+
name: str
10+
description: str = ""
11+
image_uri: str = ""
12+
properties: Optional[dict] = None
13+
14+
715
@dataclass_json
816
@dataclass
9-
class NFT:
17+
class NftMetadata:
1018
name: str
1119
description: str
1220
image: str

nftlabs/types/pack/__init__.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from dataclasses import dataclass
2+
from datetime import datetime
3+
from ..nft import NftMetadata
4+
from typing import Union, List
5+
6+
7+
@dataclass
8+
class PackMetadata:
9+
id: int
10+
creator_address: str
11+
current_supply: int
12+
open_start: datetime
13+
metadata: NftMetadata
14+
15+
16+
@dataclass
17+
class PackNftMetadata:
18+
supply: int
19+
metadata: NftMetadata
20+
21+
22+
@dataclass
23+
class AssetAmountPair:
24+
token_id: int
25+
amount: int
26+
27+
28+
@dataclass
29+
class CreatePackArg:
30+
asset_contract_address: str
31+
metadata: Union[str, dict]
32+
assets: List[AssetAmountPair]
33+
seconds_until_open_start: int
34+
seconds_until_open_end: int
35+
rewards_per_open: int

0 commit comments

Comments
 (0)