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

Unable to Stream Money between XRP & ETH Uplink #51

Open
rangesh- opened this issue Jan 29, 2020 · 2 comments
Open

Unable to Stream Money between XRP & ETH Uplink #51

rangesh- opened this issue Jan 29, 2020 · 2 comments

Comments

@rangesh-
Copy link

I am trying to use stream money between XRP and Eth using Kavalabs Switch ILP Sdk, but unfortunately I am not able to do the same and please find the code and error logs below, Ideally the anticipated behavior is successful stream of money , but that does not happen .

I did refer the post from Interledger[(https://forum.interledger.org/t/interoperability-prototype-with-moneyd/382/14 )].

Error Logs :

Error: Error verifying tx: tecNO_DST
at E:\xpring\node_modules@kava-labs\ilp-plugin-xrp-paychan\src\utils\channel.ts:194:35
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at E:\xpring\node_modules@kava-labs\ilp-plugin-xrp-paychan\src\account.ts:401:7
at XrpAccount.openChannel (E:\xpring\node_modules@kava-labs\ilp-plugin-xrp-paychan\src\account.ts:378:26)
at ReducerQueue.tryToRunAnother (E:\xpring\node_modules@kava-labs\ilp-plugin-xrp-paychan\src\utils\queue.ts:70:22)

Code Snippet :

const { connect } = require('@kava-labs/switch-api')
const BigNumber = require('bignumber.js')
async function run() {
const sdk = await connect()
const config = sdk.serializeConfig()

const ethUplink = await sdk.add({
settlerType: 'machinomy',
privateKey: '9d24bf515935e301664aa98639965003321305856bd9caed7bc650f9bc28786d'
});
console.log('**** example-js ****: addING uplink machinomy')
const xrpUplink = await sdk.add({
settlerType: 'xrp-paychan',
secret: 'shiHikLxrjCS6rtuJsLF9cegZQdkk'
});
xrpUplink.balance$.subscribe(amount => {
console.log('XRP interledger balance:', amount.toString())
});

await sdk.deposit({
    /** Uplink to deposit to */
    uplink: xrpUplink,
  
    /**
     * Amount to deposit, in the unit of exchange
     * (e.g. in this case, ether; not gwei or wei)
     */
    amount: new BigNumber(20),
  
    /**
     * Callback to authorize the fee and amount to be transferred from layer 1, after it's calculated,
     * which must return a Promise
     */
    authorize: async ({ fee }) => {
      console.log('Fee:', fee.amount.toString())
  
      // Resolve the Promise continue with the deposit...
      return
  
      // ...or reject the Promise to cancel it:
      throw new Error('Fee too high!')
    }
  })
  ethUplink.balance$.subscribe(amount => {
    console.log('Interledger balance:', amount.toString())
  })

await sdk.streamMoney({
/** Amount to send in units of exchange of the source uplink */
amount: new BigNumber(10),

/** Sending uplink */
source: xrpUplink,

/** Receiving uplink */
dest: ethUplink,

/** Optionally, specify a maximum slippage margin against the most recently fetched exchange rate */
slippage: 0.02

})

}

run().catch(err => console.error(err))

@kincaidoneil
Copy link
Contributor

Hello @rangesh-,

Kava's connector may not work, but you could try running your own local connector using connector-config. It requires running Redis, and you'd need to configure/pass these environment variables:

  • CONNECTOR_ENV=test
  • ILP_ADDRESS=test.<your_name>
  • REDIS_HOST=127.0.0.1, REDIS_PORT=6379, REDIS_PASS=<redis password>,
  • XRP_SECRET=<XRP testnet account secret> (make sure to use a different account from the one with ilp-sdk)
  • XRP_SERVER=wss://s1.ripple.com
  • ETHEREUM_PRIVATE_KEY=<ETH private key> -- Ethereum account with funds on Kovan testnet (make sure to use a different one from ilp-sdk)
  • ETHEREUM_PROVIDER -- You may need to create an Infura account and pass in the provider URL for the Kovan testnet here

Then, you could try connecting ilp-sdk in local mode to connect to your local connector?

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

3 participants
@rangesh- @kincaidoneil and others