Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #80 from Cerebellum-Network/chore/batch-tx-sample
Browse files Browse the repository at this point in the history
chore(scripts): sending batch transaction example
  • Loading branch information
yahortsaryk authored Jul 4, 2023
2 parents 97dfca2 + f4b07db commit e123fb4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
File renamed without changes.
28 changes: 28 additions & 0 deletions scripts/examples/ddcBucketDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,34 @@ async function main() {
log("ClusterDistributeRevenues", event, "\n");
}

{
log("Batch Transaction example");

const updatedVNodes = [7,8,9];
const tx1 = bucketContract.tx.clusterResetNode(
txOptions,
clusterId,
nodeKey,
updatedVNodes
);

const updatedNodeParams = "{\"url\":\"https://ddc-456.cere.network/storage/1\"}";
const tx2 = bucketContract.tx.nodeSetParams(
txOptions,
nodeKey,
updatedNodeParams
);

const batchTx = api.tx.utility.batchAll([
tx1,
tx2
]);

const result = await sendTx(account, batchTx);
printGas(result);
log(getExplorerUrl(result));
}

log(" ---- \n");

{
Expand Down
4 changes: 2 additions & 2 deletions scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"license": "Apache-2.0",
"scripts": {
"ensure-deps": "yarn --cwd sdk",
"setup-ddc-bucket": "yarn ensure-deps && node ddc-setup/ddcSetup.js",
"deploy-ddc-bucket": "yarn ensure-deps && node deployment/ddcBucketDeploy.js",
"demo-ddc-bucket": "yarn ensure-deps && node examples/ddcBucketDemo.js",
"print-ddc-bucket": "yarn ensure-deps && node examples/ddcBucketPrint.js"
"print-ddc-bucket": "yarn ensure-deps && node examples/ddcBucketPrint.js",
"setup-ddc-bucket": "yarn ensure-deps && node ddc-setup/ddcBucketSetup.js"
}
}
6 changes: 3 additions & 3 deletions scripts/sdk/src/config/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// todo: introduce Dotenv
// todo: introduce DOTENV and allow reading variables from environment

const ACTOR_SEED = "//Alice";

const EXPLORER_URL = "https://explorer.cere.network";
const DDC_BUCKET_CONTRACT_NAME = "ddc_bucket";

const DEVNET_RPC_ENDPOINT = "wss://archive.devnet.cere.network/ws/";
const DEVNET_DDC_BUCKET_ADDR = "6TCrAcm51jYJwNbEc7zYFBvuBaPru9B1cAkU4PpgoTpTy9VZ";
const DEVNET_DDC_BUCKET_ADDR = "";
const DEVNET_CHAIN_NAME = "Cere Devnet";

const TESTNET_RPC_ENDPOINT = "wss://archive.testnet.cere.network/ws/";
const TESTNET_DDC_BUCKET_ADDR = "6TyNotWczZXMaXkF6mJ2cBMS6e1hgu5hFYuTpfg9vtH35gu3";
const TESTNET_DDC_BUCKET_ADDR = "";
const TESTNET_CHAIN_NAME = "Cere Testnet";

const LOCAL_RPC_ENDPOINT = "ws://127.0.0.1:9944/";
Expand Down

0 comments on commit e123fb4

Please sign in to comment.