stardustcollective / dag4.js Goto Github PK
View Code? Open in Web Editor NEWConstellation Hypergraph JavaScript API
License: MIT License
Constellation Hypergraph JavaScript API
License: MIT License
Hi, is it able to chain pending or future transactions? For example, I want to send Dag from my address to 3 different addresses, I don't want to wait for each transaction to finalize before creating a new one, can I create 3 transactions at the same time which the next tx chaining from the previous and submit all of them to the network?
Hi, is it possible to generate transaction hash before posting it to the network? Not DAG but when working with other blockchains, I sometimes encounter network error when submitting transactions. When that happens, I couldn't track if the transaction was included in the block without the offline txHash.
Hello,
I have been reading all the documentation and following the steps to create a wallet, check balances and send a transaction. But I have not been able to execute the transaction as I always get the same error when executing a simple transaction or even a transferDagBatch. Could you help here? Please
- Error:
[Running] ts-node "c:\Users\elric\dev\DAG-Bridge\src\utils\dagMethods.ts"
- Transfering from Signer: DAG1x6erYwDLvt3zXxZvdHaZcNVhWfFFVC1Qunjd
- Balance: 5 DAGs
c:\Users\elric\dev\DAG-Bridge\node_modules\@stardust-collective\dag4-core\src\cross-platform\clients\fetch.http.ts:70
throw new Error(text);
^
Error
at FetchRestService.<anonymous> (c:\Users\elric\dev\DAG-Bridge\node_modules\@stardust-collective\dag4-core\src\cross-platform\clients\fetch.http.ts:70:19)
at Generator.next (<anonymous>)
at fulfilled (c:\Users\elric\dev\DAG-Bridge\node_modules\@stardust-collective\dag4-core\dist\cjs\cross-platform\clients\fetch.http.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
- Script as proof of concept:
import { dag4 } from "@stardust-collective/dag4";
dag4.account.connect({
networkVersion: "2.0",
testnet: true,
});
dag4.account.loginPrivateKey(DAG_PRIVATE_KEY);
const address = dag4.account.address;
// GET Balance of a Wallet
export async function getBalance(dagAddress: string) {
const { balance } = await dag4.network.getAddressBalance(dagAddress);
return balance;
}
// Send Transaction from wallet to wallet
async function simpleTx() {
const balance = await getBalance(address);
console.log(`- Transfering from Signer: ${address}`);
console.log(` - Balance: ${Number(balance) / 10 ** 8} DAGs\n`);
const toAddress = "DAG6i1i79c56DATYAxzRoynRaLmCG7mWwj7jTXzo";
const amount = 1;
const fee = 0;
await dag4.account.transferDag(toAddress, amount, fee);
}
simpleTx();
SDK Version: "@stardust-collective/dag4": "^2.2.0"
When a network request receives a non-200 response from the cross-platform client, the error returned is not helpful and doesn't indicate the response code that was received. Debugging these issues would be much easier if we returned the response code.
Error thrown at:
https://github.com/StardustCollective/dag4.js/blob/main/packages/dag4-core/src/cross-platform/clients/fetch.http.ts#L62
Example current error output:
/project/node_modules/@stardust-collective/dag4-core/src/cross-platform/clients/fetch.http.ts:70
throw new Error(text);
^
Error
at FetchRestService.<anonymous> (/project/node_modules/@stardust-collective/dag4-core/src/cross-platform/clients/fetch.http.ts:70:19)
at Generator.next (<anonymous>)
at fulfilled (/project/node_modules/@stardust-collective/dag4-core/dist/cjs/cross-platform/clients/fetch.http.js:5:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Expected output example:
/project/node_modules/@stardust-collective/dag4-core/src/cross-platform/clients/fetch.http.ts:70
throw new Error(text);
^
Network Error Response
url: https://be-mainnet.constellationnetwork.io/cluster/info
responseCode: 400
message: Invalid parameter
at FetchRestService.<anonymous> (/project/node_modules/@stardust-collective/dag4-core/src/cross-platform/clients/fetch.http.ts:70:19)
at Generator.next (<anonymous>)
at fulfilled (/project/node_modules/@stardust-collective/dag4-core/dist/cjs/cross-platform/clients/fetch.http.js:5:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Hi!
When trying to send a single Tx or batch Tx to the integrationnet 2.0, I get a tx hash in return but the tx is never pushed to the chain.
Tx hash: 9ff4ced96314104929fb8051a377502dc30e53cbe892022cdc42410976cfebfb
I have been following the documentations and this code used to work before. Could you help here? Please
"@stardust-collective/dag4": "^2.2.0"
Chain configuration:
dag4.account.connect({
networkVersion: "2.0",
beUrl: "https://be-integrationnet.constellationnetwork.io",
l0Url: "https://l0-lb-integrationnet.constellationnetwork.io",
l1Url: "https://l1-lb-integrationnet.constellationnetwork.io",
});
Script:
async function simpleTransfer(to: string, amount: number) {
const address = dag4.account.address;
console.log("sending from :", address);
const res = await dag4.account.transferDag(
to,
amount,
0
);
console.log(res);
}
simpleTransfer("DAG7sx7SSuGNeM88qm4hdpoCnveQE9QCraf4Mj3C", 10);
Hi, according to CoinMarketCap your total supply is 3,711,998,690 DAG. If convert to the smallest unit it is 3,711,998,690 x 1e8, this value is greatly bigger than Javascript MAX_SAFE_INTEGER. It is unsafe to use number bigger than MAX_SAFE_INTEGER
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.