Giter Club home page Giter Club logo

avalanche-wallet-sdk's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

avalanche-wallet-sdk's Issues

Bug/Feature: insufficient funds

Current dev version at least.
Wayt to reproduce bug:
`

  1. create singlekeywallet
  2. make exportX( "1000000000", "C",)
    ... you will get "Insufficient Funds error"

How I fixed it

async exportX(amountAvax: string, destination:ExportChainsX): Promise<string> {
    // const fee: BN = xChain.getDefaultTxFee();
    const amount:BN = new BN(amountAvax);
    // FIX make SingleWallet to update it's uxtos
    const uxtos = await this.swallet.updateUtxosX()
    console.log("destination fro X to ", destination2);//, uxtos);
    return this.swallet.exportXChain(amount, destination2);
  }

I think there should be way to refresh Wallet state after constructing it / I understand the need separate routines which makes network calls and which are not

MaxListenersExceededWarning in walletadapter

Hi the following code was not properly clearing EventEmitter events causing MaxListenersExceededWarning.
wallet.ts line 150
public destroy() {
networkEvents.off('network_change', this.onNetworkChange);
}

I was able to resolve the waring using
networkEvents.removeAllListeners('network_change');
or
networkEvents.removeAllListeners();

I am not familiar with EventEmitter so I just wanted to mainly report the issue.

Cant Send Avax(C)

ReferenceError: fetch is not defined
Ive installed the fetch package and my IDE allows me to scope definition

also event listeners arent working aswell

avalanche in devDependancies

Putting avalanche in devDependancies is not installing this lib with yarn and as a result, the app fails to build. The workaround will be to add avalanche to the app package. Was this intended?

Wallet.d.ts has different version in npm than here in repository

Version 0.10.1 typescript in npm seems to still have importC without parameters
but the code has already importC(chained) version...

Wallet.d.ts ....

`/**
 * Imports atomic X chain utxos to the current actie X chain address
 * @param chainID The chain ID to import from, either `P` or `C`
 */
importX(chainID: AvmImportChainType): Promise<string>;
importP(toAddress?: string): Promise<string>;
importC(): Promise<string>;`

Wallet.updateBalanceX()

I would like to update the X-chain balance of a wallet so that I can access the wallet's balance of various ANT tokens. Since updateBalanceX() is private, the only way to do this seems to be calling updateUtxosX(). However, this function calls updateBalanceX() without awaiting its promise, so I'm not sure how I can tell when it has finished updating the X-chain balance. For my use case, I would prefer if the function did the following:

await this.updateUnknownAssetsX();
await this.updateBalanceX();

I understand that the function is probably written as it currently is because updateBalanceX() is a costly function. Maybe a solution could be to have a boolean parameter waitForBalance for the function updateBalanceX() with the following code:

if (waitForBalance) {
    await this.updateBalanceX();
else {
    this.updateBalanceX();
}

Apologies in advance if there is another solution to this issue that I'm missing.

node-fetch should ship with the non browser version

When attempting to run a terminal based app using version 0.17.2, I get this error:

/@avalabs/avalanche-wallet-sdk/dist/index.js:1596
            const response = yield fetch(input, Object.assign(Object.assign({}, options), { signal: controller.signal }));
                             ^

ReferenceError: fetch is not defined
    at HttpClient.<anonymous> (/@avalabs/avalanche-wallet-sdk/dist/index.js:1596:30)
    at Generator.next (<anonymous>)
    at /@avalabs/avalanche-wallet-sdk/dist/index.js:186:71
    at new Promise (<anonymous>)
    at __awaiter (/@avalabs/avalanche-wallet-sdk/dist/index.js:182:12)
    at HttpClient.fetchWithTimeout (/@avalabs/avalanche-wallet-sdk/dist/index.js:1592:16)
    at HttpClient.post (/@avalabs/avalanche-wallet-sdk/dist/index.js:1576:41)
    at /@avalabs/avalanche-wallet-sdk/dist/index.js:5450:46
    at Generator.next (<anonymous>)
    at /@avalabs/avalanche-wallet-sdk/dist/index.js:186:71
    at new Promise (<anonymous>)
    at __awaiter (/@avalabs/avalanche-wallet-sdk/dist/index.js:182:12)
    at getAddressChains (/@avalabs/avalanche-wallet-sdk/dist/index.js:5441:12)
    at HdScanner.<anonymous> (/@avalabs/avalanche-wallet-sdk/dist/index.js:7347:36)
    at Generator.next (<anonymous>)
    at fulfilled (/@avalabs/avalanche-wallet-sdk/dist/index.js:183:58)

A working solution is to install the CJS module via:

npm install node-fetch@2
Then edit @avalabs/avalanche-wallet-sdk/dist/index.js and add

const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
at the top of the file.

Perhaps node-fetch should be included in the node only version?

Conflicting Peer dependency with Avalanche

I am trying to use both "avalanche": "3.15.5" and "@avalabs/avalanche-wallet-sdk": "0.18.4" for my project.
However, when I try npm ci, it shows this error.
Screenshot (19)

I checked the package.json of avalanche-wallet-sdk and it uses 3.15.2. Since the most recent version of "avalanche" is 3.15.5 I think it should be updated to 3.15.5 . Or, is there anything else I can do to solve this issue?

Enchancement: "Nothing to import" throws Error but maybe it should not

When doing importP etc... it throws Error, but it's merely normal situation not Error condition.
If you want to check that nothing is left accidentally not imported you cannot call Promise.all([multiple imports because it throws Error])

:"Nothing to import.","stack":"Error: Nothing to import.\n at SingletonWallet.<anon...

Error Package subpath

I am getting an error when I run yarn install. It says that package.json is not defined by "exports". The error I am getting is below, when I click the link it takes me to the package.json file.

[!] Error: Package subpath './package.json' is not defined by "exports" in /Users/eddyalvarado_1/Documents/GitHub/plasma-wallet-web3/js/avalanche-wallet-sdk/node_modules/rollup-plugin-typescript2/node_modules/tslib/package.json

MnemonicWallet should support bip39 passphrase

Currently it's only possible to instantiate a MnemonicWallet with a seed phrase. For users that have a bip39 passphrase associated with the mnemonic, the constructor should support an optional passphrase field.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.