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

make the Wallet more extensible. #2602

Open
drunkirishcoder opened this issue Dec 14, 2023 · 0 comments
Open

make the Wallet more extensible. #2602

drunkirishcoder opened this issue Dec 14, 2023 · 0 comments

Comments

@drunkirishcoder
Copy link

I would like to implement a wallet that signs remotely and be able to integrate with xrpl. something like

const wallet = new MyRemoteWallet(...)

const res = await client.submitAndWait({
    TransactionType: 'Payment',
    Account: wallet.address,
    Destination: "r...",
    Amount: '1',
  },
  {
    autofill: true,
    wallet,
  })

I can extend my remote wallet from the xrpl wallet, export class MyRemoteWallet extends xrpl.Wallet, but the problem is the sign function is not async, therefore I can't make a remote call from it. though because submitAndWait is async, it should be able to support an async sign function.

essentially if this block of code can be changed to

  let tx =
    typeof transaction === 'string'
      ? // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- converts JsonObject to correct Transaction type
        (decode(transaction) as unknown as Transaction)
      : transaction

  if (autofill) {
    tx = await client.autofill(tx)
  }

  return (await wallet.sign(tx)).tx_blob

everything would work. this change would make extending xrpl with remote wallets much easier.

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

1 participant