Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D1.1 Create a test address and do the 7 txs (script): #6

Open
2 of 17 tasks
esteblock opened this issue Nov 13, 2023 · 5 comments
Open
2 of 17 tasks

D1.1 Create a test address and do the 7 txs (script): #6

esteblock opened this issue Nov 13, 2023 · 5 comments

Comments

@esteblock
Copy link
Member

esteblock commented Nov 13, 2023

In Javascript or bash? @esteblock

We should create 2 scripts:

  • createAddress.js which will create 2 Addresses and stores keys for later use on testKeys.json
    • Add public keys to subscriptionConfig.json with type account
    • Structure would be like:
 {
   "account0": {
       "privateKey": "CCJRRQE4YNU4475CCUXYFU4PDWNOUQ6V2WQAPZP2Z6LF7SPMY74W7POU",
       "publicKey": "CCJRRQE4YNU4475CCUXYFU4PDWNOUQ6V2WQAPZP2Z6LF7SPMY74W7POU",
   },
   "account1": {
       "privateKey": "CCJRRQE4YNU4475CCUXYFU4PDWNOUQ6V2WQAPZP2Z6LF7SPMY74W7POU",
       "publicKey": "CCJRRQE4YNU4475CCUXYFU4PDWNOUQ6V2WQAPZP2Z6LF7SPMY74W7POU",
   }    
 }
  • run7txs.js runs:
    • Reads testKeys.json
    • Fund both accounts using friend bot
    • Send XLM from account0 to account1
    • Send XLM from account1 to account0
    • Soroswap:
      • account0 receives tokens from Soroswap using api.soroswap.finance/api/keys
      • account0 adds liquidity to a pool
      • account0 swaps tokens
      • account0 removes liquidity from a pool
    • SDEX:
      • account0 swaps XLM for another token
      • account0 adds liquidity to a pool
      • account0 removes liquidity from a pool

If needed, create all necessary docker related files to avoid dependency problems (you may need to use soroban-cli for example)

@chopan123
Copy link
Member

I would love to do the scripts on javascript for direct use on a nodejs server... However I'm not sure if there is a package ready to do a script like the needed ones

@esteblock
Copy link
Member Author

Working in #8

@esteblock
Copy link
Member Author

@chopan123 I think that is more elegant to generate n addressses and store them in a json like this

{
  keys: [
    {
      privateKey: 'SBR7XF64HKA7G5RQFPCJGSIYGWIFGYV3C47OAIVVEAYIWPAK5SAYWGH7',
      publicKey: 'GAPNDEZ3GJPQH24NADSNTRH3EPXQUC6SQBDK32NBLZQYXKBXUNNGWBIM'
    },
    {
      privateKey: 'SBDV53O4OPXEFODMFG5FPAUAGOEKEX4ORAFRKXCEJOUT4Q2K5JWIG4XA',
      publicKey: 'GAV5W765QE5MQQRXSDBZQN2AS75KY5KIZLDLLNUJ76LRZSWQVSQ4FCCN'
    }
  ]
}

Like this you will do keys=JsonFromFile.keys, and then keys[0].publicKey, instead of indexing like keys.address0.publicKey

@chopan123
Copy link
Member

I started a script for some addresses to add/remove liquidity, they need more development though, it is on scripts/SDEX/

@esteblock esteblock removed their assignment Dec 6, 2023
@chopan123
Copy link
Member

Done on https://github.com/paltalabs/mercury-client/tree/main/scripts/do-7-txs

it can be called using yarn do7txs <standalone | testnet >

It creates 3 addresses, and do the defined 7 txs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants