GithubHelp home page GithubHelp logo

nami-wallet-api's People

Contributors

felippo001 avatar

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

Watchers

 avatar  avatar  avatar  avatar

nami-wallet-api's Issues

Nami.getAssets() providing empty array and Nami.send() is not working giving error expected instance of BigNum

Nami.send({ address:
'addr1q9zuz87pdpavf4qv887ku2d5u3cvamz8v7mlzqdm6rw62jln442xmqc6emat80hua9a5sdf5jsavm22mkp7c2ka80c2suk45r7',
amount: 20,})
Unhandled Runtime Error
Error: expected instance of BigNum

Call Stack
_assertClass
node_modules/@emurgo/cardano-serialization-lib-browser/cardano_serialization_lib_bg.js (193:0)
Module.min_ada_required
node_modules/@emurgo/cardano-serialization-lib-browser/cardano_serialization_lib_bg.js (341:0)
Object.eval
node_modules/nami-wallet-api/lib/index.js (243:0)
step
node_modules/nami-wallet-api/lib/index.js (52:0)
Object.eval [as next]
node_modules/nami-wallet-api/lib/index.js (33:45)
fulfilled
node_modules/nami-wallet-api/lib/index.js (24:42)

how to achieve this?

We generate datum script using below :

cardano-cli transaction hash-script-data --script-data-file ${datum_name}.datum

It generates the datum script. once we have datum we need to incluide it into transaction
that is generated on cli again

cardano-cli transaction build
--alonzo-era
--tx-in ${utxoin}
--tx-out ${SCRIPT_ADDR}+${LOCK_AMNT}
--tx-out-datum-hash ${hashes[0]}
--metadata-json-file metadata.json \

Please let me know how to do above using nami-wallet-api?

Error: expected instance of Value

hello, here for me on file and line appear an error, look bellow:

erro:  Error: expected instance of Value
    at _assertClass (cardano_serialization_lib_bg.js?a621:193:1)
    at Value.checked_add (cardano_serialization_lib_bg.js?a621:11716:1)
    at addAmounts (coinSelection.js?a40d:572:1)
    at mergeOutputsAmounts (coinSelection.js?a40d:556:1)
    at Object.randomImprove (coinSelection.js?a40d:260:1)
    at Module._txBuilder (transaction.js?aaee:111:1)
    at eval (VM2617 index.js:721:92)
    at Generator.next (<anonymous>)
    at fulfilled (VM2617 index.js:34:24)

the funny thing is that it is returning yes, a Value instance, I have already debugged everything and it always returns a Value instance.

the libs they are in same versions of this package, has anyone ever experienced this? thanks!

Memory leak

<--- Last few GCs --->

When assembling the application, it gives this error, what can I do?

i am using webpack 5 with experiments

[24865:0x7fb27e000000] 164413 ms: Mark-sweep (reduce) 2045.8 (2082.9) -> 2045.5 (2083.4) MB, 7097.3 / 0.0 ms (+ 360.2 ms in 29 steps since start of marking, biggest step 248.7 ms, walltime since start of marking 7516 ms) (average mu = 0.487, current mu[24865:0x7fb27e000000] 171628 ms: Mark-sweep (reduce) 2046.5 (2083.4) -> 2046.0 (2083.9) MB, 7199.6 / 0.0 ms (average mu = 0.323, current mu = 0.002) allocation failure scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
1: 0x1066edbb1 node::Abort() [/usr/local/bin/node]
2: 0x1066edd33 node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
3: 0x10682a993 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
4: 0x10682a93d v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
5: 0x1069542e3 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
6: 0x106953335 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
7: 0x10695b319 v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
8: 0x10695b37a v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
9: 0x1069391ef v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node]
10: 0x106bd6411 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
11: 0x106e73579 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]
Abort trap: 6

how to construct more complex transaction that will include datum

When you are generating a transaction you are sending some assets.
When you send the transaction you can add optional parameters like metadata and/or datum.
datum is used by smart contract since it's the only data that smart contract can see.
how to construct more complex transaction that will include datum?

Memory Leak with this dependency

Hi,

I've tried to use your provided NPM package. Sadly, I've been running into memory leak.

<--- Last few GCs --->

[9052:0x1046c6000] 84325 ms: Mark-sweep (reduce) 2044.5 (2051.0) -> 2044.1 (2052.8) MB, 2973.6 / 0.1 ms (average mu = 0.111, current mu = 0.002) allocation failure scavenge might not succeed
[9052:0x1046c6000] 88877 ms: Mark-sweep (reduce) 2045.2 (2054.8) -> 2044.8 (2054.8) MB, 4547.0 / 0.0 ms (average mu = 0.048, current mu = 0.001) allocation failure scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x1012e4da5 node::Abort() (.cold.1) [/usr/local/bin/node]
2: 0x1000a6239 node::Abort() [/usr/local/bin/node]
3: 0x1000a639f node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
4: 0x1001e9007 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
5: 0x1001e8fa3 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
6: 0x100397e95 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
7: 0x10039995a v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/local/bin/node]
8: 0x100395029 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
9: 0x1003928c1 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
10: 0x1003a115a v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
11: 0x1003a11e1 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
12: 0x10036eb87 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node]
13: 0x1006ed8d8 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
14: 0x100a7a239 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]
15: 0x100a75b11 Builtins_WeakSetConstructor [/usr/local/bin/node]
16: 0x100a0f761 Builtins_JSBuiltinsConstructStub [/usr/local/bin/node]
17: 0x5adb7aad2fd

Integration NAMI wallet api to React APP

I am trying to use this
https://github.com/Felippo001/nami-wallet-api
to connect my react app to Nami wallet using cardano-serialisation-lib.

async function loadWasm (){
    try {
      const wasm = await import("@emurgo/cardano-serialization-lib-browser");
      setWasm(wasm);
    } catch (err) {
      console.error(`Unexpected error in loadWasm. [Message: ${err.message}]`);
    }
  };

I am using this to load cardano serialisation lib.
The error I am getting while i npm start
I have already installed node-fetch and also @emurgo/cardano-serialization-lib-browser
Module not found node:http in node-fetch/src

Can't bundle

node-fetch is causing problems with webpack and parcel because of the node: prefix

Uncaught (in promise) Error: Cannot find module 'http' at newRequire (index.bdea7d65.js:61) at newRequire (cardano_serialization_lib.a9c0fc35.js?1638554532050:53) at newRequire (buffer.a8023b95.js?1638554532848:53) at newRequire (buffer.a8023b95.js?1638554532870:53) at newRequire (node-fetch.0d50a49d.js?1638554532871:53) at newRequire (node-fetch.0d50a49d.js?1638554532871:45) at localRequire (node-fetch.0d50a49d.js?1638554532871:83) at Object.drwRt.buffer (index.js:9) at Function.newRequire (node-fetch.0d50a49d.js?1638554532871:71) at runtime-f61b6616eb6f623a.js:1
node v17.1.0
yarn v1.22.17
NixOS
parcel : latest

this is the error message using webpack
ERROR in node:http Module build failed: UnhandledSchemeError: Reading from "node:http" is not handled by plugins (Unhandled scheme). Webpack supports "data:" and "file:" URIs by default. You may need an additional plugin to handle "node:" URIs. at /home/jonathan/Documents/namiTwo/node_modules/webpack/lib/NormalModule.js:825:25 at Hook.eval [as callAsync] (eval at create (/home/jonathan/Documents/namiTwo/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/home/jonathan/Documents/namiTwo/node_modules/tapable/lib/Hook.js:18:14) at Object.processResource (/home/jonathan/Documents/namiTwo/node_modules/webpack/lib/NormalModule.js:822:8) at processResource (/home/jonathan/Documents/namiTwo/node_modules/loader-runner/lib/LoaderRunner.js:220:11) at iteratePitchingLoaders (/home/jonathan/Documents/namiTwo/node_modules/loader-runner/lib/LoaderRunner.js:171:10) at runLoaders (/home/jonathan/Documents/namiTwo/node_modules/loader-runner/lib/LoaderRunner.js:397:2) at NormalModule._doBuild (/home/jonathan/Documents/namiTwo/node_modules/webpack/lib/NormalModule.js:812:3) at NormalModule.build (/home/jonathan/Documents/namiTwo/node_modules/webpack/lib/NormalModule.js:956:15) at /home/jonathan/Documents/namiTwo/node_modules/webpack/lib/Compilation.js:1367:12 @ ./node_modules/node-fetch/src/index.js 9:0-29 52:58-62 @ ./node_modules/nami-wallet-api/lib/index.js 645:98-119 @ ./src/index.js 1:0-38

here's my dependencies in the package.json file
"devDependencies": { "html-loader": "^2.1.2", "html-webpack-plugin": "^5.3.2", "webpack": "^5.64.4", "webpack-cli": "^4.9.1", "webpack-dev-server": "^4.6.0" }, "dependencies": { "nami-wallet-api": "^1.1.9", "node-fetch": "^3.1.0" }

this issue seems similar
parcel-bundler/parcel#7387

USE IN REACT JS

Hi, Can you please tell how it can be use in React Js. When ever i try to download nami-wallet-api in React project it gives me errors for # Blob etc.

Minting issue

unable to mint using this package. can you help me to resolve this issue?

Testnet support

Not sure why, but on testnet I always get a cannot read properties of undefined (reading 'toString') error.

image

Tested on Chrome & Brave browser. Flipping Nami to mainnet, and it does work again.

Nami.getNetworkId is not a function

I'm having a weird issue where everything seems to be loading correctly, however when it comes to running the getNetworkId function it throws this error: TypeError: Nami.getNetworkId is not a function

const WASM_lib = await import('@emurgo/cardano-serialization-lib-browser/cardano_serialization_lib')
const nami_lib = await import('nami-wallet-api')
const Nami = await nami_lib.NamiWalletApi(
    window.cardano.nami,
    process.env.NEXT_PUBLIC_BLOCKFROST_PROJECT_ID,
    WASM_lib
)

await Nami.enable()
console.log('isEnabled', await Nami.isEnabled())

console.log('Nami', Nami);
console.log('Nami.getNetworkId', Nami.getNetworkId);
const networkId = await Nami.getNetworkId();

isEnabled returns as true, Nami shows all the functions including getNetworkId, and logging getNetworkId shows the function.

Screen Shot 2022-02-25 at 4 07 26 pm

Screen Shot 2022-02-25 at 4 10 30 pm

Is there anything obviously wrong with this? Thanks!

INPUTS_EXHAUSTED with full wallet

Getting the following error from a wallet that has enough ada in it? any recommendations?

Uncaught (in promise) Error: INPUTS_EXHAUSTED at randomSelect (coinSelection.js:345) at randomSelect (coinSelection.js:353) at randomSelect (coinSelection.js:353) at randomSelect (coinSelection.js:353) at randomSelect (coinSelection.js:353) at select (coinSelection.js:305) at Object.randomImprove (coinSelection.js:252) at _txBuilder (index.js:476) at eval (index.js:248) at step (index.js:52) [[Prototype]]: Array(0)

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.