shadowPaySDK 0.2.0.21__tar.gz → 0.2.0.23__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/PKG-INFO +1 -1
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/setup.py +1 -1
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK/interface/sol.py +25 -1
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK.egg-info/PKG-INFO +1 -1
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/LICENSE +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/README.md +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/setup.cfg +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK/__init__.py +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK/api.py +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK/const.py +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK/interface/__init__.py +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK/interface/erc20.py +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK/interface/erc721.py +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK/types/EVMcheque.py +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK/types/SOLcheque.py +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK/types/__init__.py +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK/utils/__init__.py +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK/utils/utils.py +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK.egg-info/SOURCES.txt +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK.egg-info/dependency_links.txt +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK.egg-info/requires.txt +0 -0
- {shadowpaysdk-0.2.0.21 → shadowpaysdk-0.2.0.23}/shadowPaySDK.egg-info/top_level.txt +0 -0
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name='shadowPaySDK',
|
5
|
-
version='0.2.0.
|
5
|
+
version='0.2.0.23',
|
6
6
|
description='ShadowPay SDK for ERC20/ERC721 and P2P smart contract interaction',
|
7
7
|
long_description=open('README.md').read(),
|
8
8
|
long_description_content_type='text/markdown',
|
@@ -7,10 +7,14 @@ import spl
|
|
7
7
|
import spl.token
|
8
8
|
import spl.token.constants
|
9
9
|
from spl.token.instructions import get_associated_token_address, create_associated_token_account, transfer, close_account, TransferParams
|
10
|
+
from solders.system_program import transfer as ts
|
11
|
+
from solders.system_program import TransferParams as tsf
|
10
12
|
from spl.token.constants import TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID
|
11
13
|
from solana.rpc.types import TxOpts, TokenAccountOpts
|
12
14
|
from solana.rpc.types import TxOpts
|
13
15
|
import solders
|
16
|
+
from solders.message import Message
|
17
|
+
|
14
18
|
# from solders.pubkey import Pubkey
|
15
19
|
# from solders.keypair import Keypair
|
16
20
|
# from solders.signature import Signature
|
@@ -32,9 +36,9 @@ import re
|
|
32
36
|
LAMPORTS_PER_SOL = 1_000_000_000 # 1 SOL = 1,000,000,000 lamports
|
33
37
|
|
34
38
|
class SOL:
|
35
|
-
|
36
39
|
def __init__(self, rpc_url = "https://api.mainnet-beta.solana.com", KEYPAIR: Optional[Union[str, solders.keypair.Keypair]] = None,TOKEN_MINT: Optional[str] = None):
|
37
40
|
self.rpc_url = rpc_url
|
41
|
+
|
38
42
|
self.client = AsyncClient(rpc_url)
|
39
43
|
self.KEYPAIR = None
|
40
44
|
self.PROGRAM_ID = TOKEN_PROGRAM_ID # Default to the SPL Token Program ID
|
@@ -201,6 +205,26 @@ class SOL:
|
|
201
205
|
return resp.value
|
202
206
|
|
203
207
|
|
208
|
+
async def transfer_native(self, to:str, amount):
|
209
|
+
if not self.KEYPAIR:
|
210
|
+
raise ValueError("not set KEYPAIR.")
|
211
|
+
|
212
|
+
sender_pubkey = self.get_pubkey()
|
213
|
+
receiver_pubkey = solders.pubkey.Pubkey.from_string(to)
|
214
|
+
ixns = [
|
215
|
+
ts(tsf(
|
216
|
+
from_pubkey=sender_pubkey,
|
217
|
+
to_pubkey=receiver_pubkey,
|
218
|
+
lamports=amount * LAMPORTS_PER_SOL
|
219
|
+
))
|
220
|
+
]
|
221
|
+
msg = Message(ixns, self.get_pubkey())
|
222
|
+
latest_blockhash_resp = self.client.get_latest_blockhash()
|
223
|
+
|
224
|
+
blockhash_str = latest_blockhash_resp.value.blockhash
|
225
|
+
tx = Transaction([self.KEYPAIR], msg, blockhash_str)
|
226
|
+
resp = await self.client.send_transaction(tx)
|
227
|
+
return resp
|
204
228
|
|
205
229
|
|
206
230
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|