Skip to content

Commit

Permalink
Deploy documentation for dev
Browse files Browse the repository at this point in the history
  • Loading branch information
gRoussac committed Jun 16, 2024
1 parent 26e58ae commit 4a212c9
Show file tree
Hide file tree
Showing 164 changed files with 966 additions and 766 deletions.
120 changes: 84 additions & 36 deletions condor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -633,14 +633,20 @@ console.log(transaction_hash);
#### Rust

```rust
use casper_rust_wasm_sdk::types::transaction_params::transaction_str_params::TransactionStrParams;
use casper_rust_wasm_sdk::types::{
addressable_entity_hash::AddressableEntityHash,
transaction_params::{
transaction_builder_params::TransactionBuilderParams,
transaction_str_params::TransactionStrParams,
},
};

pub const CHAIN_NAME: &str = "integration-test";
pub const PUBLIC_KEY: &str =
"0169d8d607f3ba04c578140398ceb1bd5296c653f965256bd7097982b9026c5129";
pub const PAYMENT_AMOUNT: &str = "5000000000";
pub const ENTITY_HASH: &str =
"addressable-entity-5be5b0ef09a7016e11292848d77f539e55791cb07a7012fbc336b1f92a4fe743";
"5be5b0ef09a7016e11292848d77f539e55791cb07a7012fbc336b1f92a4fe743";
pub const ENTRY_POINT: &str = "set_variables";
pub const TTL: &str = "1h";

Expand All @@ -650,7 +656,8 @@ transaction_params.set_initiator_addr(PUBLIC_KEY);
transaction_params.set_ttl(Some(TTL.to_string()));
transaction_params.set_payment_amount(PAYMENT_AMOUNT);

let builder_params = TransactionBuilderParams::new_invocable_entity(ENTITY_HASH, ENTRY_POINT);
let entity_hash = AddressableEntityHash::new(ENTITY_HASH).unwrap();
let builder_params = TransactionBuilderParams::new_invocable_entity(entity_hash, ENTRY_POINT);

let transaction = sdk
.make_transaction(builder_params, transaction_params)
Expand All @@ -661,19 +668,24 @@ println!("{:?}", transaction.timestamp());
#### Typescript

```ts
import { TransactionStrParams, TransactionBuilderParams } from 'casper-sdk';
import {
TransactionStrParams,
TransactionBuilderParams,
AddressableEntityHash,
} from 'casper-sdk';

const chain_name = 'integration-test';
const public_key =
'0169d8d607f3ba04c578140398ceb1bd5296c653f965256bd7097982b9026c5129';
const payment_amount = '5000000000';
const entity_hash =
'addressable-entity-5be5b0ef09a7016e11292848d77f539e55791cb07a7012fbc336b1f92a4fe743';
const entity_hash_hex_string =
'5be5b0ef09a7016e11292848d77f539e55791cb07a7012fbc336b1f92a4fe743';
const entry_point = 'set_variables';

const transaction_params = new TransactionStrParams(chain_name, public_key);
transaction_params.payment_amount = payment_amount;

let entity_hash = new AddressableEntityHash(entity_hash_formatted_string);
let builder_params = TransactionBuilderParams.newInvocableEntity(
entity_hash,
entry_point
Expand All @@ -700,7 +712,13 @@ let sdk = SDK::new(
Some(Verbosity::High),
);

use casper_rust_wasm_sdk::types::transaction_params::transaction_str_params::TransactionStrParams;
use casper_rust_wasm_sdk::types::{
addressable_entity_hash::AddressableEntityHash,
transaction_params::{
transaction_builder_params::TransactionBuilderParams,
transaction_str_params::TransactionStrParams,
},
};

pub const CHAIN_NAME: &str = "casper-net-1";
pub const PUBLIC_KEY: &str =
Expand All @@ -709,7 +727,7 @@ pub const SECRET_KEY: &str = r#"-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----"#;
pub const PAYMENT_AMOUNT: &str = "5000000000";
pub const ENTITY_HASH: &str =
"addressable-entity-5be5b0ef09a7016e11292848d77f539e55791cb07a7012fbc336b1f92a4fe743";
"5be5b0ef09a7016e11292848d77f539e55791cb07a7012fbc336b1f92a4fe743";
pub const ENTRY_POINT: &str = "set_variables";
pub const TTL: &str = "1h";

Expand All @@ -720,7 +738,8 @@ transaction_params.set_secret_key(SECRET_KEY);
transaction_params.set_ttl(Some(TTL.to_string()));
transaction_params.set_payment_amount(PAYMENT_AMOUNT);

let builder_params = TransactionBuilderParams::new_invocable_entity(ENTITY_HASH, ENTRY_POINT);
let entity_hash = AddressableEntityHash::new(ENTITY_HASH).unwrap();
let builder_params = TransactionBuilderParams::new_invocable_entity(entity_hash, ENTRY_POINT);

let transaction = sdk.transaction(builder_params, transaction_params, None, None).await;
println!(
Expand All @@ -732,16 +751,20 @@ println!(
#### Typescript

```ts
import { TransactionStrParams, TransactionBuilderParams } from 'casper-sdk';
import {
TransactionStrParams,
TransactionBuilderParams,
AddressableEntityHash,
} from 'casper-sdk';

const chain_name = 'casper-net-1';
const public_key =
'0169d8d607f3ba04c578140398ceb1bd5296c653f965256bd7097982b9026c5129';
const secret_key = `-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----`;
const payment_amount = '5000000000';
const entity_hash =
'addressable-entity-5be5b0ef09a7016e11292848d77f539e55791cb07a7012fbc336b1f92a4fe743';
const entity_hash_hex_string =
'5be5b0ef09a7016e11292848d77f539e55791cb07a7012fbc336b1f92a4fe743';
const entry_point = 'set_variables';

const transaction_params = new TransactionStrParams(
Expand All @@ -750,6 +773,8 @@ const transaction_params = new TransactionStrParams(
secret_key
);
transaction_params.payment_amount = payment_amount;

let entity_hash = new AddressableEntityHash(entity_hash_hex_string);
let builder_params = TransactionBuilderParams.newInvocableEntity(
entity_hash,
entry_point
Expand All @@ -773,15 +798,21 @@ console.log(transaction_result_as_json);
Puts a [`Transaction`] to the network for execution.

```rust
use casper_rust_wasm_sdk::types::transaction_params::transaction_str_params::TransactionStrParams;
use casper_rust_wasm_sdk::types::{
addressable_entity_hash::AddressableEntityHash,
transaction_params::{
transaction_builder_params::TransactionBuilderParams,
transaction_str_params::TransactionStrParams,
},
};

pub const CHAIN_NAME: &str = "casper-net-1";
pub const SECRET_KEY: &str = r#"-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----"#;
let initiator_addr: &str = &public_key_from_secret_key(SECRET_KEY).unwrap();
pub const PAYMENT_AMOUNT: &str = "5000000000";
pub const ENTITY_HASH: &str =
"addressable-entity-5be5b0ef09a7016e11292848d77f539e55791cb07a7012fbc336b1f92a4fe743";
"5be5b0ef09a7016e11292848d77f539e55791cb07a7012fbc336b1f92a4fe743";
pub const ENTRY_POINT: &str = "set_variables";
pub const TTL: &str = "1h";

Expand All @@ -792,7 +823,8 @@ transaction_params.set_secret_key(SECRET_KEY);
transaction_params.set_ttl(Some(TTL.to_string())); // optional TTL
transaction_params.set_payment_amount(PAYMENT_AMOUNT);

let builder_params = TransactionBuilderParams::new_invocable_entity(ENTITY_HASH, ENTRY_POINT);
let entity_hash = AddressableEntityHash::new(ENTITY_HASH).unwrap();
let builder_params = TransactionBuilderParams::new_invocable_entity(entity_hash, ENTRY_POINT);

let transaction = Transaction::new_session(builder_params, transaction_params).unwrap();

Expand Down Expand Up @@ -846,15 +878,19 @@ println!(
Puts a [`Transaction`] to the network for execution.

```ts
import { TransactionStrParams, TransactionBuilderParams } from 'casper-sdk';
import {
TransactionStrParams,
TransactionBuilderParams,
AddressableEntityHash,
} from 'casper-sdk';

const chain_name = 'casper-net-1';
const public_key =
'0169d8d607f3ba04c578140398ceb1bd5296c653f965256bd7097982b9026c5129';
const secret_key = `-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----`;
const payment_amount = '5000000000';
const entity_hash =
const entity_hash_formatted_string =
'addressable-entity-5be5b0ef09a7016e11292848d77f539e55791cb07a7012fbc336b1f92a4fe743';
const entry_point = 'set_variables';

Expand All @@ -865,6 +901,9 @@ const transaction_params = new TransactionStrParams(
);
transaction_params.payment_amount = payment_amount;

let entity_hash = AddressableEntityHash.fromFormattedStr(
entity_hash_formatted_string
);
let builder_params = TransactionBuilderParams.newInvocableEntity(
entity_hash,
entry_point
Expand Down Expand Up @@ -1140,11 +1179,10 @@ let install = sdk
.install(transaction_params, transaction_bytes.into(), None)
.await;

let transaction_hash_result = install.as_ref().unwrap().result.transaction_hash;
println!("{:?}", transaction_hash_result);
let transaction_hash = install.as_ref().unwrap().result.transaction_hash;
println!("{:?}", transaction_hash);

let transaction_hash = TransactionHash::from(transaction_hash_result);
let transaction_hash_as_string = transaction_hash.to_string();
let transaction_hash_as_string = transaction_hash.to_hex_string();
println!("wait transaction_hash {}", transaction_hash_as_string);
let event_parse_result: EventParseResult = sdk
.wait_transaction(DEFAULT_EVENT_ADDRESS, &transaction_hash_as_string, None)
Expand All @@ -1155,7 +1193,12 @@ println!("{:?}", event_parse_result);
let finalized_approvals = true;

let get_transaction = sdk
.get_transaction(transaction_hash, Some(finalized_approvals), None, None)
.get_transaction(
transaction_hash.into(),
Some(finalized_approvals),
None,
None,
)
.await
.unwrap();
let result = json_pretty_print(
Expand All @@ -1164,8 +1207,7 @@ let result = json_pretty_print(
);
println!("approvals {result}");

let transaction_hash = get_transaction.result.transaction.hash();
let result = TransactionHash::from(transaction_hash).to_string();
let result = transaction_hash.to_hex_string();
println!("processed transaction hash {result}");
```

Expand Down Expand Up @@ -1249,8 +1291,11 @@ async function loadFile() {

```rust
use casper_rust_wasm_sdk::types::{
transaction_hash::TransactionHash,
transaction_params::transaction_str_params::TransactionStrParams,
addressable_entity_hash::AddressableEntityHash,
transaction_params::{
transaction_builder_params::TransactionBuilderParams,
transaction_str_params::TransactionStrParams,
},
};

pub const CHAIN_NAME: &str = "casper-net-1";
Expand All @@ -1259,7 +1304,7 @@ pub const PUBLIC_KEY: &str =
pub const SECRET_KEY: &str = r#"-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----"#;
pub const ENTITY_HASH: &str =
"addressable-entity-5be5b0ef09a7016e11292848d77f539e55791cb07a7012fbc336b1f92a4fe743";
"5be5b0ef09a7016e11292848d77f539e55791cb07a7012fbc336b1f92a4fe743";
pub const ENTRYPOINT_MINT: &str = "mint";
pub const TOKEN_OWNER: &str =
"account-hash-878985c8c07064e09e67cc349dd21219b8e41942a0adc4bfa378cf0eace32611";
Expand All @@ -1276,8 +1321,9 @@ let args = Vec::from([
]);
transaction_params.set_session_args_simple(args);

let entity_hash = AddressableEntityHash::new(ENTITY_HASH).unwrap();
let builder_params =
TransactionBuilderParams::new_invocable_entity(ENTITY_HASH, ENTRYPOINT_MINT);
TransactionBuilderParams::new_invocable_entity(entity_hash, ENTRYPOINT_MINT);

let call_entrypoint = sdk
.call_entrypoint(builder_params, transaction_params, None)
Expand All @@ -1287,8 +1333,8 @@ let transaction_hash_result = call_entrypoint
.unwrap()
.result
.transaction_hash;
let transaction_hash_string = TransactionHash::from(transaction_hash_result).to_string();
println!("watch transaction_hash {transaction_hash_string}");
let transaction_hash = transaction_hash_result.to_hex_string();
println!("watch transaction_hash {transaction_hash}");
```

- <strong>Typescript</strong>
Expand All @@ -1299,12 +1345,13 @@ import {
TransactionStrParams,
publicKeyFromSecretKey,
Bytes,
AddressableEntityHash,
} from 'casper-sdk';

const chain_name = 'casper-net-1';
const secret_key = '';
const initiator_addr = publicKeyFromSecretKey(secret_key);
const entity_hash =
const entity_hash_formatted_string =
'addressable-entity-5be5b0ef09a7016e11292848d77f539e55791cb07a7012fbc336b1f92a4fe743';
const entry_point = 'mint';
const payment_amount = '5000000000';
Expand All @@ -1314,6 +1361,7 @@ const transaction_params = new TransactionStrParams(chain_name, initiator_addr,
transaction_params.session_args_simple = ["token_meta_data:String='test_meta_data'", `token_owner:Key='${token_owner}'`];
transaction_params.payment_amount = payment_amount;

let entity_hash = AddressableEntityHash.fromFormattedStr(entity_hash_formatted_string);
let builder_params = TransactionBuilderParams.newInvocableEntity(entity_hash, entry_point);

const call_entrypoint_result = await sdk.call_entrypoint(
Expand Down Expand Up @@ -2071,20 +2119,20 @@ let install = sdk
.install_deploy(deploy_params, session_params, PAYMENT_AMOUNT_CONTRACT_CEP78, None)
.await;

let deploy_hash_result = install.as_ref().unwrap().result.deploy_hash;
println!("{:?}", deploy_hash_result);
let deploy_hash = install.as_ref().unwrap().result.deploy_hash;
let deploy_hash_string = deploy_hash.to_hex_string();
println!("{:?}", deploy_hash_string);

let event_parse_result = sdk
.wait_deploy(DEFAULT_EVENT_ADDRESS, &deploy_hash_result)
.wait_deploy(DEFAULT_EVENT_ADDRESS, &deploy_hash_string)
.await
.unwrap();
let deploy_processed = event_parse_result.body.unwrap().deploy_processed.unwrap();
println!("{:?}", deploy_processed);

let finalized_approvals = true;
let deploy_hash = DeployHash::from(deploy_hash_result);
let get_deploy = sdk
.get_deploy(deploy_hash, Some(finalized_approvals), None, None)
.get_deploy(deploy_hash.into(), Some(finalized_approvals), None, None)
.await;
let get_deploy = get_deploy.unwrap();
let result = &get_deploy.result.execution_results.get(0).unwrap().result;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `call_entrypoint` mod in crate `casper_rust_wasm_sdk`."><title>casper_rust_wasm_sdk::call_entrypoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-081576b923113409.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="casper_rust_wasm_sdk" data-themes="" data-resource-suffix="" data-rustdoc-version="1.79.0 (129f3b996 2024-06-10)" data-channel="1.79.0" data-search-js="search-bf21c90c8c1d92b1.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-e32f0c247825364d.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-09095024cf37855e.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../casper_rust_wasm_sdk/index.html">casper_rust_wasm_sdk</a><span class="version">2.0.0</span></h2></div><h2 class="location"><a href="#">Module call_entrypoint</a></h2><div class="sidebar-elems"><h2><a href="../index.html">In crate casper_rust_wasm_sdk</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../casper_rust_wasm_sdk/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Type ‘S’ or ‘/’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings">Settings</a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../index.html">casper_rust_wasm_sdk</a>::<wbr><a class="mod" href="#">call_entrypoint</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../src/casper_rust_wasm_sdk/sdk/contract/call_entrypoint.rs.html#1-270">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div></section></div></main></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `call_entrypoint` mod in crate `casper_rust_wasm_sdk`."><title>casper_rust_wasm_sdk::call_entrypoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-081576b923113409.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="casper_rust_wasm_sdk" data-themes="" data-resource-suffix="" data-rustdoc-version="1.79.0 (129f3b996 2024-06-10)" data-channel="1.79.0" data-search-js="search-bf21c90c8c1d92b1.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-e32f0c247825364d.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-09095024cf37855e.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../casper_rust_wasm_sdk/index.html">casper_rust_wasm_sdk</a><span class="version">2.0.0</span></h2></div><h2 class="location"><a href="#">Module call_entrypoint</a></h2><div class="sidebar-elems"><h2><a href="../index.html">In crate casper_rust_wasm_sdk</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../casper_rust_wasm_sdk/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Type ‘S’ or ‘/’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings">Settings</a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../index.html">casper_rust_wasm_sdk</a>::<wbr><a class="mod" href="#">call_entrypoint</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../src/casper_rust_wasm_sdk/sdk/contract/call_entrypoint.rs.html#1-262">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div></section></div></main></body></html>
Loading

0 comments on commit 4a212c9

Please sign in to comment.