Skip to content

Integration Guide Suggestions #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions 3.-want-to-integrate-or-build/3.1-integration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function main() {
// Wait for crypto to be ready
await cryptoWaitReady();

// PublicGetters need no signature, can be queried by anyone
// PublicGetters need no signature, they can be queried by anyone
const info = await api.parentchainsInfoGetter(INCOGNITEE_SHARD).send();
console.log("[PublicGetter] Parentchains Info:")
console.log(info.toHuman());
Expand All @@ -58,7 +58,8 @@ async function main() {

// const account = localKeyring.addFromSeed("<seed>");

// If you want to shield without using our dApp at app.incognitee.io/pas
// You could send funds to the shard_vault if you want to shield without using our dApp at app.incognitee.io/pas.
// Note: Do **NOT** send funds from a centralized exchange, you need to have the private key to access your shielded funds!!!
const shard_vault = await api.getShardVault()
console.log("Send PAS to this shard vault on L1 for shielding: " + shard_vault.toString());

Expand All @@ -71,42 +72,48 @@ async function main() {
console.log("[TrustedGetter] Previously defined session proxy?:");
console.log(response.toHuman().session_proxies[0]);

// transfer funds privately on L2
// transfer funds privately on L2 to Bob

// The fingerprint let's us verify the business logic if we want.
const fingerprint_hex = await api.getFingerprint();
const fingerprint = bs58.encode(hexToU8a(fingerprint_hex.toString()));
console.log("[TrustedCall] using enclave fingerprint:" + fingerprint);

const bob = "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty"

// send funds to Bob
await api.trustedBalanceTransfer(
account,
INCOGNITEE_SHARD,
fingerprint,
account.address,
"5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
bob,
100000000,
"hello world"
)

// send a message to someone
// send a message to Bob
await api.trustedSendNote(
account,
INCOGNITEE_SHARD,
fingerprint,
account.address,
"5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
bob,
"Hi Bob"
)

// unshield funds to L1
// unshield funds to L1 to Bob's account
await api.balanceUnshieldFunds(
account,
INCOGNITEE_SHARD,
fingerprint,
account.address,
"5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
bob,
100000000
)

// register a session proxy: let delegate sign on behalf of account, but only for non-transfer actions and queries
// Register a session proxy: let delegate sign on behalf of account, but only for non-transfer actions and queries.
// See chapter 5 for more information on session proxies.
const delegateMiniSecret = mnemonicToMiniSecret("secret forest ticket smooth wide mass parent reveal embark impose fiscal company");
const delegate = localKeyring.addFromSeed(delegateMiniSecret);

Expand Down