Ejemplo n.º 1
0
 async def test_basic_functionality(self, client):
     issuer_wallet = Wallet.create()
     response = await submit_transaction_async(
         TrustSet(
             account=WALLET.classic_address,
             sequence=WALLET.sequence,
             flags=TrustSetFlag.TF_SET_NO_RIPPLE,
             limit_amount=IssuedCurrencyAmount(
                 issuer=issuer_wallet.classic_address,
                 currency="USD",
                 value="100",
             ),
         ),
         WALLET,
     )
     self.assertTrue(response.is_successful())
     WALLET.sequence += 1
Ejemplo n.º 2
0
 def test_basic_functionality(self):
     issuer_wallet = Wallet.create()
     response = submit_transaction(
         TrustSet(
             account=WALLET.classic_address,
             sequence=WALLET.next_sequence_num,
             fee=FEE,
             flags=TrustSetFlag.TF_SET_NO_RIPPLE,
             limit_amount=IssuedCurrencyAmount(
                 issuer=issuer_wallet.classic_address,
                 currency="USD",
                 value="100",
             ),
         ),
         WALLET,
     )
     self.assertTrue(response.is_successful())
Ejemplo n.º 3
0
 def test_from_dict_explicit_none(self):
     dictionary = {
         "account": "rH6ZiHU1PGamME2LvVTxrgvfjQpppWKGmr",
         "fee": "10",
         "sequence": None,
         "flags": TrustSetFlag.TF_SET_NO_RIPPLE,
         "limit_amount": {
             "currency": "USD",
             "issuer": "raoV5dkC66XvGWjSzUhCUuuGM3YFTitMxT",
             "value": "100",
         },
     }
     expected = TrustSet(
         account="rH6ZiHU1PGamME2LvVTxrgvfjQpppWKGmr",
         fee="10",
         flags=TrustSetFlag.TF_SET_NO_RIPPLE.value,
         limit_amount=IssuedCurrencyAmount(
             currency="USD",
             issuer="raoV5dkC66XvGWjSzUhCUuuGM3YFTitMxT",
             value="100"),
     )
     actual = TrustSet.from_dict(dictionary)
     self.assertEqual(actual, expected)
Ejemplo n.º 4
0
 def test_from_xrpl_memos(self):
     memo_type = "687474703a2f2f6578616d706c652e636f6d2f6d656d6f2f67656e65726963"
     tx = {
         "Account": "rnoGkgSpt6AX1nQxZ2qVGx7Fgw6JEcoQas",
         "TransactionType": "TrustSet",
         "Fee": "10",
         "Sequence": 17892983,
         "Flags": 131072,
         "Memos": [{
             "Memo": {
                 "MemoType": memo_type,
                 "MemoData": "72656e74",
             }
         }],
         "SigningPubKey": "",
         "LimitAmount": {
             "currency": "USD",
             "issuer": "rBPvTKisx7UCGLDtiUZ6mDssXNREuVuL8Y",
             "value": "10",
         },
     }
     expected = TrustSet(
         account="rnoGkgSpt6AX1nQxZ2qVGx7Fgw6JEcoQas",
         fee="10",
         sequence=17892983,
         flags=131072,
         memos=[Memo(
             memo_type=memo_type,
             memo_data="72656e74",
         )],
         limit_amount=IssuedCurrencyAmount(
             currency="USD",
             issuer="rBPvTKisx7UCGLDtiUZ6mDssXNREuVuL8Y",
             value="10"),
     )
     self.assertEqual(Transaction.from_xrpl(tx), expected)
Ejemplo n.º 5
0
 def test_from_dict_trust_set(self):
     dictionary = {
         "account": "rH6ZiHU1PGamME2LvVTxrgvfjQpppWKGmr",
         "fee": "10",
         "sequence": 16178313,
         "flags": 131072,
         "limit_amount": {
             "currency": "USD",
             "issuer": "raoV5dkC66XvGWjSzUhCUuuGM3YFTitMxT",
             "value": "100",
         },
     }
     expected = TrustSet(
         account="rH6ZiHU1PGamME2LvVTxrgvfjQpppWKGmr",
         fee="10",
         sequence=16178313,
         flags=131072,
         limit_amount=IssuedCurrencyAmount(
             currency="USD",
             issuer="raoV5dkC66XvGWjSzUhCUuuGM3YFTitMxT",
             value="100"),
     )
     actual = TrustSet.from_dict(dictionary)
     self.assertEqual(actual, expected)
Ejemplo n.º 6
0
 def test_from_xrpl_signers(self):
     txn_sig1 = (
         "F80E201FE295AA08678F8542D8FC18EA18D582A0BD19BE77B9A24479418ADBCF4CAD28E7BD"
         "96137F88DE7736827C7AC6204FBA8DDADB7394E6D704CD1F4CD609")
     txn_sig2 = (
         "036E95B8100EBA2A4A447A3AF24500261BF480A0E8D62EE15D03A697C85E73237A5202BD9A"
         "F2D9C68B8E8A5FA8B8DA4F8DABABE95E8401C5E57EC783291EF80C")
     pubkey1 = "ED621D6D4FF54E809397195C4E24EF05E8500A7CE45CDD211F523A892CDBCDCDB2"
     pubkey2 = "EDD3ABCFF008ECE9ED3073B41913619341519BFF01F07331B56E5D6D2EC4A94A57"
     tx = {
         "Account":
         "rnoGkgSpt6AX1nQxZ2qVGx7Fgw6JEcoQas",
         "TransactionType":
         "TrustSet",
         "Fee":
         "10",
         "Sequence":
         17892983,
         "Flags":
         131072,
         "Signers": [
             {
                 "Signer": {
                     "Account": "rGVXgBz4NraZcwi5vqpmwPW6P4y74A4YvX",
                     "TxnSignature": txn_sig1,
                     "SigningPubKey": pubkey1,
                 }
             },
             {
                 "Signer": {
                     "Account": "rB5q2wsHeXdQeh2KFzBb1CujNAfSKys6GN",
                     "TxnSignature": txn_sig2,
                     "SigningPubKey": pubkey2,
                 }
             },
         ],
         "SigningPubKey":
         "",
         "LimitAmount": {
             "currency": "USD",
             "issuer": "rBPvTKisx7UCGLDtiUZ6mDssXNREuVuL8Y",
             "value": "10",
         },
     }
     expected = TrustSet(
         account="rnoGkgSpt6AX1nQxZ2qVGx7Fgw6JEcoQas",
         fee="10",
         sequence=17892983,
         flags=131072,
         signers=[
             Signer(
                 account="rGVXgBz4NraZcwi5vqpmwPW6P4y74A4YvX",
                 txn_signature=txn_sig1,
                 signing_pub_key=pubkey1,
             ),
             Signer(
                 account="rB5q2wsHeXdQeh2KFzBb1CujNAfSKys6GN",
                 txn_signature=txn_sig2,
                 signing_pub_key=pubkey2,
             ),
         ],
         limit_amount=IssuedCurrencyAmount(
             currency="USD",
             issuer="rBPvTKisx7UCGLDtiUZ6mDssXNREuVuL8Y",
             value="10"),
     )
     self.assertEqual(Transaction.from_xrpl(tx), expected)
Ejemplo n.º 7
0
 def test_from_dict_multisign(self):
     txn_sig1 = (
         "F80E201FE295AA08678F8542D8FC18EA18D582A0BD19BE77B9A24479418ADBCF4CAD28E7BD"
         "96137F88DE7736827C7AC6204FBA8DDADB7394E6D704CD1F4CD609")
     txn_sig2 = (
         "036E95B8100EBA2A4A447A3AF24500261BF480A0E8D62EE15D03A697C85E73237A5202BD9A"
         "F2D9C68B8E8A5FA8B8DA4F8DABABE95E8401C5E57EC783291EF80C")
     pubkey1 = "ED621D6D4FF54E809397195C4E24EF05E8500A7CE45CDD211F523A892CDBCDCDB2"
     pubkey2 = "EDD3ABCFF008ECE9ED3073B41913619341519BFF01F07331B56E5D6D2EC4A94A57"
     request = {
         "method": "submit_multisigned",
         "tx_json": {
             "Account":
             "rnD6t3JF9RTG4VgNLoc4i44bsQLgJUSi6h",
             "TransactionType":
             "TrustSet",
             "Fee":
             "10",
             "Sequence":
             17896798,
             "Flags":
             131072,
             "Signers": [
                 {
                     "Signer": {
                         "Account": "rGoKUCwJ2C4oHUsqnd8PVxZhFiBMV2T42G",
                         "TxnSignature": txn_sig1,
                         "SigningPubKey": pubkey1,
                     }
                 },
                 {
                     "Signer": {
                         "Account": "rsi3GL27pstEYUJ28ZM3q155rmFCCTBCZ1",
                         "TxnSignature": txn_sig2,
                         "SigningPubKey": pubkey2,
                     }
                 },
             ],
             "SigningPubKey":
             "",
             "LimitAmount": {
                 "currency": "USD",
                 "issuer": "rH5gvkKxGHrFAMAACeu9CB3FMu7pQ9jfZm",
                 "value": "10",
             },
         },
         "fail_hard": False,
     }
     expected = SubmitMultisigned(tx_json=TrustSet(
         account="rnD6t3JF9RTG4VgNLoc4i44bsQLgJUSi6h",
         fee="10",
         sequence=17896798,
         flags=131072,
         signers=[
             Signer(
                 account="rGoKUCwJ2C4oHUsqnd8PVxZhFiBMV2T42G",
                 txn_signature=txn_sig1,
                 signing_pub_key=pubkey1,
             ),
             Signer(
                 account="rsi3GL27pstEYUJ28ZM3q155rmFCCTBCZ1",
                 txn_signature=txn_sig2,
                 signing_pub_key=pubkey2,
             ),
         ],
         limit_amount=IssuedCurrencyAmount(
             currency="USD",
             issuer="rH5gvkKxGHrFAMAACeu9CB3FMu7pQ9jfZm",
             value="10",
         ),
     ), )
     actual = Request.from_dict(request)
     self.assertEqual(actual, expected)
Ejemplo n.º 8
0
    def test_basic_functionality(self):
        #
        # Perform multisign
        #
        # NOTE: If you need to use xrpl-py for multisigning, please create an issue on
        # the repo. We'd like to gauge interest in higher level multisigning
        # functionality.
        issuer = Wallet.create()
        tx = TrustSet(
            account=WALLET.classic_address,
            sequence=WALLET.next_sequence_num,
            fee=FEE,
            flags=TrustSetFlag.TF_SET_NO_RIPPLE,
            limit_amount=IssuedCurrencyAmount(
                issuer=issuer.classic_address,
                currency="USD",
                value="10",
            ),
        )
        tx_json = transaction_json_to_binary_codec_form(tx.to_dict())
        first_sig = sign(
            bytes.fromhex(
                encode_for_multisigning(
                    tx_json,
                    FIRST_SIGNER.classic_address,
                )),
            FIRST_SIGNER.private_key,
        )
        second_sig = sign(
            bytes.fromhex(
                encode_for_multisigning(
                    tx_json,
                    SECOND_SIGNER.classic_address,
                )),
            SECOND_SIGNER.private_key,
        )
        multisigned_tx = TrustSet(
            account=WALLET.classic_address,
            sequence=WALLET.next_sequence_num,
            fee=FEE,
            flags=TrustSetFlag.TF_SET_NO_RIPPLE,
            limit_amount=IssuedCurrencyAmount(
                issuer=issuer.classic_address,
                currency="USD",
                value="10",
            ),
            signers=[
                Signer(
                    account=FIRST_SIGNER.classic_address,
                    txn_signature=first_sig,
                    signing_pub_key=FIRST_SIGNER.public_key,
                ),
                Signer(
                    account=SECOND_SIGNER.classic_address,
                    txn_signature=second_sig,
                    signing_pub_key=SECOND_SIGNER.public_key,
                ),
            ],
        )

        # submit tx
        response = JSON_RPC_CLIENT.request(
            SubmitMultisigned(tx_json=transaction_json_to_binary_codec_form(
                multisigned_tx.to_dict()), ))
        self.assertTrue(response.is_successful())