File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 10
10
validate_message as validate_message_neynar ,
11
11
validate_message_or_mock as validate_message_or_mock_neynar
12
12
)
13
- from .transaction import transaction
13
+ from .transaction import transaction , mint
Original file line number Diff line number Diff line change @@ -51,3 +51,14 @@ def transaction(
51
51
res = jsonify (tx .model_dump (mode = 'json' , exclude_none = True ))
52
52
res .status_code = 200
53
53
return res
54
+
55
+
56
+ def mint (chain_id : int , contract : str , token_id : int = None ) -> str :
57
+ if not is_address (contract ):
58
+ raise ValueError (f'invalid contract address { contract } ' )
59
+
60
+ target = f'eip155:{ chain_id } :{ contract } '
61
+ if token_id is not None :
62
+ target += f':{ token_id } '
63
+
64
+ return target
Original file line number Diff line number Diff line change
1
+ """
2
+ test cases for frame minting logic
3
+ """
4
+
5
+ # lib
6
+ import json
7
+ import pytest
8
+ from flask import Flask
9
+
10
+ # src
11
+ from framelib import mint
12
+
13
+
14
+ class TestTransaction (object ):
15
+
16
+ def test_mint (self ):
17
+ target = mint (7777777 , '0x060f3edd18c47f59bd23d063bbeb9aa4a8fec6df' )
18
+ assert target == 'eip155:7777777:0x060f3edd18c47f59bd23d063bbeb9aa4a8fec6df'
19
+
20
+ def test_mint_with_id (self ):
21
+ target = mint (7777777 , '0x060f3edd18c47f59bd23d063bbeb9aa4a8fec6df' , token_id = 1234 )
22
+ assert target == 'eip155:7777777:0x060f3edd18c47f59bd23d063bbeb9aa4a8fec6df:1234'
You can’t perform that action at this time.
0 commit comments