dfuse-io / client-js Goto Github PK
View Code? Open in Web Editor NEWdfuse JavaScript/TypeScript Client Library for dfuse API
Home Page: https://docs.dfuse.io
License: MIT License
dfuse JavaScript/TypeScript Client Library for dfuse API
Home Page: https://docs.dfuse.io
License: MIT License
Summary
The data returned from the streamActionTraces() method doesn't match the format expected by the declared Typescript interfaces.
Steps to Reproduce
Call the streamActionTraces() method with the with_dbops
option set to true.
Expected Results
When an inbound message is received of type InboundMessageType.ACTION_TRACE, the message should conform to the ActionTraceInboundMessage interface declaration.
Actual Results
The dbOps
key is undefined. The message contains a dbops
key instead which is an array of objects similar to the following:
{
"op": "UPD",
"action_idx": 3,
"opayer": "sampleuser24",
"npayer": "sampleuser24",
"path": "mycontract11//mytable12345/",
"old": "000000000000000050c8102afb43affa97f89a5c881300000000000004454f53000000006d3301000000000001",
"new": "000000000000000050c8102afb43affa97f89a5c881300000000000004454f53000000004de500000000000001"
}
…which is different than the DbOp type declaration in the @dfuse/client library:
export declare type DbOp<T> = {
op?: string;
action_idx: number;
account?: string;
table?: string;
scope?: string;
key?: string;
old?: DbRow<T>;
new?: DbRow<T>;
};
Can you guys make the apiRequest method public to reuse the same client to do HTTP request to proxy methods of a nodeos thru the dfuse endpoint?
It would keep the token updated
https://github.com/dfuse-io/client-js/blob/master/src/client/client.ts#L396
Brief:
Trying to test my dfuse install, using examples/check-balance.ts
with the following config (recommended here):
export NETWORK=0.0.0.0:8080 // using real IP
const client = createDfuseClient({
apiKey: "web_abcdef123456789",
network: DFUSE_API_NETWORK,
authUrl: "null://",
secure: false
})
Error:
An error occurred DfuseApiError: Unable to correctly decode provided token.
at DefaultHttpClient.<anonymous> (/newvolume/client-js/examples/node_modules/@dfuse/client/dist/lib/client/http-client.js:164:24)
at Generator.next (<anonymous>)
at fulfilled (/newvolume/client-js/examples/node_modules/@dfuse/client/dist/lib/client/http-client.js:5:58)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
description: 'Unable to correctly decode provided token.',
cause: undefined,
code: 'auth_invalid_token_error',
trace_id: 'ee76f63a26b30c06a541b0aa9a6ca0f9',
details: {
reason: 'rpc error: code = Unauthenticated desc = invalid token provided: illegal base64 data at input byte 1',
token: ''
}
}
Example completed.
Hi!
I am writing an app which needs to be up to date with eos blockchain and I am wondering, if I need to handle websockets closing on my end.
In other words:
If websockets close for graphql query do they automatically reconnects if I use your library or I need to manually establish connection again?
Example query:
const stream = await dfuseClient.graphql(`subscription {
searchTransactionsForward(query: "receiver:eosio.token action:transfer", irreversibleOnly: false) {
cursor
trace {
matchingActions {
json
}
}
}
}`, (message) => {
if (message.type === "data") {
console.log(message.data);
} else {
console.log(message);
}
});
Hi, I'm using this client in a node.js script and my script never terminates because the refresh-scheduler has an open handle. (the setTimeout in @dfuse/client/dist/lib/client/refresh-scheduler.js:27)
Is there a proper way to tell the client to cleanup / disconnect / release resources?
Today I tried to run queries which were working for couple of months on EOS network in my code and they all throw error:
signing method (alg) is unavailable.
Example query which generates this error:
const dfuseClient = createDfuseClient({
network: "eos.dfuse.eosnation.io",
apiKey: "<web api key here>",
streamClientOptions: {
socketOptions: {
onClose: (data) => {
console.log(data);
},
onError: (data) => {
console.log(data);
}
}
}
});
const graphQLSubscriptionForAllIncomingTransactionsToEosioToken = `
subscription($cursor: String!) {
searchTransactionsForward(query: "receiver:eosio.token action:transfer -data.quantity:'0.0001 EOS'", irreversibleOnly: false) {
cursor
undo
trace {
matchingActions { json }
}
}
}
`;
// error is thrown exactly by below instruction
const stream = await dfuseClient.graphql(graphQLSubscriptionForAllIncomingTransactionsToEosioToken, (message) => {
if (message.type === "data") {
console.log(message.data);
console.log(message.data.searchTransactionsForward.undo);
} else {
console.log(message);
}
});
Hi!
I am building application which synchronizes live with EOS blockchain. I established graphQL connection like this using dfuse-js:
this.dFuseClient.graphql(graphQLQuery, async (message) => { // do something });
My connection hang up after a few days and I am wondering how can I prevent it in the future?
I think terminal message I got was:
console.log(message); // { type: 'complete' }
and just in case one error message before I got:
console.log(message); // { type: 'error', errors: [ { message: 'graphql: hammer search result: rpc error: code = Unavailable desc = transport is closing (trace_id: 4bba6b2d211cb515713be5698c2014e1)' } ], terminal: true }
What should I do in such situation?
How can I make sure connection was closed so I can re establish it?
Or how to make sure connection won't hang up?
I get this message
ERROR in ./node_modules/@dfuse/client/dist/dfuse-client.umd.js
Module not found: Error: Can't resolve 'fs' in '/Users/mwawrusch/Dev/roji/roji-shop/node_modules/@dfuse/client/dist'
in version "@dfuse/client": "0.2.0-rc.28",
It worked in version 0.2.0-rc.01 - don't know yet where it broke in between
Hi!
I have got small dapp which tracks transactions on EOS network and it is very important for me to not receive over your library duplicated data and I am pretty sure I do.
After library hangs connection for a moment with error:
{
type: 'error',
errors: [
{
message: 'graphql: hammer search result: rpc error: code = Unknown desc = Internal server error (trace_id:
56c9fe4be60757f244e32b37e56ce125)'
}
],
terminal: true
}
I receive the same data I already received before error being thrown.
This is very dangerous for my app. I plan to receive and send from my contract money in form of EOS and other tokens to users.
Please advice what to do.
We're getting prod errors in the Everipedia.org site for browsers which do not support the spread operator (...
).
After running this repo locally, it appears that dfuse-client.umd.js
contains this syntax, which should not land in user's browsers untranspiled.
None of the other dist
outputs contain this, so I'm going to borrow their build syntax and PR this 🙌
ApiRequest obfuscates nodeos like erros if used to fetch or push a transaction using dfuse endpoint
The reason is the handling of DfuseApiError class
https://github.com/dfuse-io/client-js/blob/master/src/client/http-client.ts#L235
Example nodeos error and the "error" field with "code" and "what" is obfuscated.
{"code":500,"message":"Internal Service Error","error":{"code":3090005,"name":"irrelevant_auth_exception","what":"Irrelevant authority included","details":[{"message":"action declares irrelevant authority '{"actor":"pixeos1issue","permission":"issue"}'; minimum authority is {"actor":"pixeos1issue","permission":"active"}","file":"authorization_manager.cpp","line_number":534,"method":"check_authorization"}]}}
From https://docs.dfuse.io/eosio/public-apis/getting-started/quickstart-javascript/ it says you need an API key to use this library.
The dfuse community edition may be implemented such than an API key is not required. So this parameter should be optional.
const client = createDfuseClient({
apiKey: process.env.DFUSE_API_KEY,
network: 'mainnet.eos.dfuse.io'
});
Documentation would need to be updated accordingly.
As Dfuse partnered with WAX, it would be nice to just be able to write wax
like you can currently do with mainnet
, jungle
, and kylin
.
The host is mainnet.wax.dfuse.io
// i want to do
createDfuseClient({
apiKey: DFUSE_API_KEY,
network: `wax`,
httpClientOptions: {
fetch: nodeFetch
}
});
// I have to do
createDfuseClient({
apiKey: DFUSE_API_KEY,
network: `mainnet.wax.dfuse.io`,
httpClientOptions: {
fetch: nodeFetch
}
});
stateKeyAccounts returns StateKeyAccountsResponse defined as:
export declare type StateKeyAccountsResponse = {
block_num: number;
accounts: string[];
};
But actually, the response is as:
{
block_num: 102695260,
account_names: [ 'eos' ]
}
I'm deploying an app to the serverless Now platform where access to the $HOME directory is not allowed (/tmp is). I am therefore running into an issue because api-token-store.js
on line 146 tries to write to the home directory:
super(`${homeDirectory}/.dfuse/${sha256sum.update(apiKey).digest("hex")}/token.json`);
would it be possible to pass an option to the createDfuseClient
function indicating where an acceptable location for such storage may be?
if I submitted a PR would it have a reasonable chance of being accepted?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.