Skip to content

SDK to create dapp that interact with the Desmos blockchain

License

Notifications You must be signed in to change notification settings

desmos-labs/desmjs

Repository files navigation

DesmJS

DesmJS is a library containing a set of various packages that make it easy to develop an application on top of the Desmos blockchain.

Packages

DesmJS consists of multiple smaller npm packages each one with a specific functionality.

Package Description Version
@desmoslabs/desmjs Contains the client to interact with the Desmos chain npm version
@desmoslabs/desmjs-types Contains the Desmos Protobuf definitions npm version
@desmoslabs/desmjs-keplr Contains the Keplr signer implementation npm version
@desmoslabs/desmjs-walletconnect-v2 Contains the WalletConnect v2 signer implementation npm version
@desmoslabs/desmjs-web3auth-mobile Contains the Web3Auth Web signer implementation for React Native projects npm version
@desmoslabs/desmjs-web3auth-web Contains the Web3Auth Web signer implementation npm version

Troubleshooting

Address Generation Issue On React Native

If you encounter address generation issues while using the @desmoslabs/desmjs or @desmoslabs/desmjs-web3auth-mobile package, particularly on Android devices, you may be experiencing a problem related to the @noble/hashes library.
The root cause lies in the absence of the setBigUint64 method in the DataView object. This method is crucial for proper SHA2 calculations, but it may not be available on certain Android devices, leading to incorrect address generation when importing an account using mnemonic or private key. By polyfilling the setBigUint64 method, you can overcome this issue without the need for multiple patches.

To implement the polyfill you can copy the following js code into your shim.js file.

if (global.DataView.prototype.setBigUint64 === undefined) {
  global.DataView.prototype.setBigUint64 = function (byteOffset, value, isLE) {
    const _32n = BigInt(32);
    const _u32_max = BigInt(0xffffffff);
    const wh = Number(value.shiftRight(_32n) & _u32_max);
    const wl = Number(value & _u32_max);
    const h = isLE ? 4 : 0;
    const l = isLE ? 0 : 4;
    this.setUint32(byteOffset + h, wh, isLE);
    this.setUint32(byteOffset + l, wl, isLE);
  };
}

About

SDK to create dapp that interact with the Desmos blockchain

Topics

Resources

License

Stars

Watchers

Forks

Languages