aleph-im / aleph-js

Aleph.im Javascript API
https://aleph.im
30 stars 14 forks source link

Signing a message on solana fixed #49

Closed leirbag95 closed 2 years ago

leirbag95 commented 2 years ago

The method used to sign a message from a provider (provider_sign(provider, message)) was the following:

await provider._sendRequest('signTransaction', {
  message: base58.encode(buffer)
})

This method does not work when a user wants to sign directly from a wallet, especially with phantom. So I checked that the provider is an instanceOf of a known structure and provide a class abstraction for every method I want to use (cleaner approach, but more boilerplate).

I was inspired by the TS SDK: https://github.com/aleph-im/aleph-sdk-ts/blob/main/src/providers/JsonRPCWallet.ts

leirbag95 commented 2 years ago

Can you provide the list of wallets this was tested on ?

3 kinds of wallet: 2V4DBUdN6DksieeJoVrYaCyjcCreBgmN6tW4fFP4mg3z with 0.10 splToken 4NQCytpkZSPDPw5jN57ceMzc65dwfMALxA8xud5f9tFz with empty balance GhD9sSJSxjGy4ftZtSs9ZPohYkccmTq8nzvwwzLRx3C4 with empty balance too