chat_contract¶
In [ ]:
open rust
open rust.rust_operators
In [ ]:
//// test
open testing
chat_contract¶
state¶
In [ ]:
type state =
{
version : u32
account_set : near.iterable_set near.account_id
alias_set : near.iterable_set sm'.std_string
account_map : near.lookup_map near.account_id sm'.std_string
alias_map : near.lookup_map sm'.std_string (mapm.hash_map near.account_id (u64 * u32))
}
In [ ]:
//// test
///! rust -c
()
Installed near-sandbox into /home/runner/work/polyglot/polyglot/workspace/target/release/build/near-sandbox-utils-c39df2faf0b47791/out/.near/near-sandbox-1.40.0_7dd0b5993577f592be15eb102e5a3da37be66271/near-sandbox 00:00:04 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209301725971 } 00:00:04 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:04 i #4 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901219866631; tokens_burnt = 90121986663100000000 } 00:00:04 w #5 spiral_wasm.run / Error error / { retry = 1; error = "{ receipt_outcomes_len = 1; retry = 1; receipt_failures = [] }" } 00:00:06 i #8 near_workspaces.print_usd / { retry = 2; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209301725971 } 00:00:06 i #9 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:06 i #10 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901219866631; tokens_burnt = 90121986663100000000 } 00:00:06 w #11 spiral_wasm.run / Error error / { retry = 2; error = "{ receipt_outcomes_len = 1; retry = 2; receipt_failures = [] }" } 00:00:09 i #14 near_workspaces.print_usd / { retry = 3; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209301725971 } 00:00:09 i #15 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:09 i #16 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901219866631; tokens_burnt = 90121986663100000000 } 00:00:09 w #17 spiral_wasm.run / Error error / { retry = 3; error = "{ receipt_outcomes_len = 1; retry = 3; receipt_failures = [] }" } 00:00:11 i #20 near_workspaces.print_usd / { retry = 4; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209301725971 } 00:00:11 i #21 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:11 i #22 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901219866631; tokens_burnt = 90121986663100000000 } 00:00:11 w #23 spiral_wasm.run / Error error / { retry = 4; error = "{ receipt_outcomes_len = 1; retry = 4; receipt_failures = [] }" } 00:00:14 i #26 near_workspaces.print_usd / { retry = 5; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209301725971 } 00:00:14 i #27 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:14 i #28 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901219866631; tokens_burnt = 90121986663100000000 } 00:00:14 w #29 spiral_wasm.run / Error error / { retry = 5; error = "{ receipt_outcomes_len = 1; retry = 5; receipt_failures = [] }" } 00:00:16 i #32 near_workspaces.print_usd / { retry = 6; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209301725971 } 00:00:16 i #33 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:16 i #34 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901219866631; tokens_burnt = 90121986663100000000 } 00:00:16 w #35 spiral_wasm.run / Error error / { retry = 6; error = "{ receipt_outcomes_len = 1; retry = 6; receipt_failures = [] }" } 00:00:19 i #38 near_workspaces.print_usd / { retry = 7; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209301725971 } 00:00:19 i #39 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:19 i #40 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901219866631; tokens_burnt = 90121986663100000000 } 00:00:19 w #41 spiral_wasm.run / Error error / { retry = 7; error = "{ receipt_outcomes_len = 1; retry = 7; receipt_failures = [] }" } 00:00:21 i #44 near_workspaces.print_usd / { retry = 8; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209301725971 } 00:00:21 i #45 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:21 i #46 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901219866631; tokens_burnt = 90121986663100000000 } 00:00:21 w #47 spiral_wasm.run / Error error / { retry = 8; error = "{ receipt_outcomes_len = 1; retry = 8; receipt_failures = [] }" } 00:00:24 i #50 near_workspaces.print_usd / { retry = 9; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209301725971 } 00:00:24 i #51 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:24 i #52 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901219866631; tokens_burnt = 90121986663100000000 } 00:00:24 w #53 spiral_wasm.run / Error error / { retry = 9; error = "{ receipt_outcomes_len = 1; retry = 9; receipt_failures = [] }" } 00:00:27 i #56 near_workspaces.print_usd / { retry = 10; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209301725971 } 00:00:27 i #57 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:27 i #58 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901219866631; tokens_burnt = 90121986663100000000 } 00:00:27 w #59 spiral_wasm.run / Error error / { retry = 10; error = "{ receipt_outcomes_len = 1; retry = 10; receipt_failures = [] }" } 00:00:29 i #62 near_workspaces.print_usd / { retry = 11; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209301725971 } 00:00:29 i #63 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:29 i #64 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901219866631; tokens_burnt = 90121986663100000000 } 00:00:29 w #65 spiral_wasm.run / Error error / { retry = 11; error = "{ receipt_outcomes_len = 1; retry = 11; receipt_failures = [] }" } 00:00:32 i #68 near_workspaces.print_usd / { retry = 12; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209301725971 } 00:00:32 i #69 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:32 i #70 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901219866631; tokens_burnt = 90121986663100000000 } 00:00:32 w #71 spiral_wasm.run / Error error / { retry = 12; error = "{ receipt_outcomes_len = 1; retry = 12; receipt_failures = [] }" } 00:00:34 i #74 near_workspaces.print_usd / { retry = 13; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209301725971 } 00:00:34 i #75 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:34 i #76 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901219866631; tokens_burnt = 90121986663100000000 } 00:00:34 w #77 spiral_wasm.run / Error error / { retry = 13; error = "{ receipt_outcomes_len = 1; retry = 13; receipt_failures = [] }" } 00:00:37 i #80 near_workspaces.print_usd / { retry = 14; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209301725971 } 00:00:37 i #81 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:37 i #82 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901219866631; tokens_burnt = 90121986663100000000 } 00:00:37 w #83 spiral_wasm.run / Error error / { retry = 14; error = "{ receipt_outcomes_len = 1; retry = 14; receipt_failures = [] }" } 00:00:39 i #86 near_workspaces.print_usd / { retry = 15; total_gas_burnt_usd = +0.000808; total_gas_burnt = 1209301725971 } 00:00:39 i #87 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:39 i #88 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000602; tokens_burnt_usd = +0.000602; gas_burnt = 901219866631; tokens_burnt = 90121986663100000000 } 00:00:39 w #89 spiral_wasm.run / Error error / { retry = 15; error = "{ receipt_outcomes_len = 1; retry = 15; receipt_failures = [] }" }
In [ ]:
//// test
///! rust -c
trace Verbose (fun () => "") id
00:00:02 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.000884; total_gas_burnt = 1322985651339 } 00:00:02 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:02 i #4 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000678; tokens_burnt_usd = +0.000678; gas_burnt = 1014903791999; tokens_burnt = 101490379199900000000 } 00:00:02 w #5 spiral_wasm.run / Error error / { retry = 1; error = "{ receipt_outcomes_len = 1; retry = 1; receipt_failures = [] }" } 00:00:05 i #8 near_workspaces.print_usd / { retry = 2; total_gas_burnt_usd = +0.000884; total_gas_burnt = 1322985651339 } 00:00:05 i #9 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:05 i #10 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000678; tokens_burnt_usd = +0.000678; gas_burnt = 1014903791999; tokens_burnt = 101490379199900000000 } 00:00:05 w #11 spiral_wasm.run / Error error / { retry = 2; error = "{ receipt_outcomes_len = 1; retry = 2; receipt_failures = [] }" } 00:00:07 i #14 near_workspaces.print_usd / { retry = 3; total_gas_burnt_usd = +0.000884; total_gas_burnt = 1322985651339 } 00:00:07 i #15 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:07 i #16 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000678; tokens_burnt_usd = +0.000678; gas_burnt = 1014903791999; tokens_burnt = 101490379199900000000 } 00:00:07 w #17 spiral_wasm.run / Error error / { retry = 3; error = "{ receipt_outcomes_len = 1; retry = 3; receipt_failures = [] }" } 00:00:10 i #20 near_workspaces.print_usd / { retry = 4; total_gas_burnt_usd = +0.000884; total_gas_burnt = 1322985651339 } 00:00:10 i #21 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:10 i #22 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000678; tokens_burnt_usd = +0.000678; gas_burnt = 1014903791999; tokens_burnt = 101490379199900000000 } 00:00:10 w #23 spiral_wasm.run / Error error / { retry = 4; error = "{ receipt_outcomes_len = 1; retry = 4; receipt_failures = [] }" } 00:00:12 i #26 near_workspaces.print_usd / { retry = 5; total_gas_burnt_usd = +0.000884; total_gas_burnt = 1322985651339 } 00:00:12 i #27 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:12 i #28 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000678; tokens_burnt_usd = +0.000678; gas_burnt = 1014903791999; tokens_burnt = 101490379199900000000 } 00:00:12 w #29 spiral_wasm.run / Error error / { retry = 5; error = "{ receipt_outcomes_len = 1; retry = 5; receipt_failures = [] }" } 00:00:15 i #32 near_workspaces.print_usd / { retry = 6; total_gas_burnt_usd = +0.000884; total_gas_burnt = 1322985651339 } 00:00:15 i #33 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:15 i #34 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000678; tokens_burnt_usd = +0.000678; gas_burnt = 1014903791999; tokens_burnt = 101490379199900000000 } 00:00:15 w #35 spiral_wasm.run / Error error / { retry = 6; error = "{ receipt_outcomes_len = 1; retry = 6; receipt_failures = [] }" } 00:00:17 i #38 near_workspaces.print_usd / { retry = 7; total_gas_burnt_usd = +0.000884; total_gas_burnt = 1322985651339 } 00:00:17 i #39 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:17 i #40 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000678; tokens_burnt_usd = +0.000678; gas_burnt = 1014903791999; tokens_burnt = 101490379199900000000 } 00:00:17 w #41 spiral_wasm.run / Error error / { retry = 7; error = "{ receipt_outcomes_len = 1; retry = 7; receipt_failures = [] }" } 00:00:20 i #44 near_workspaces.print_usd / { retry = 8; total_gas_burnt_usd = +0.000884; total_gas_burnt = 1322985651339 } 00:00:20 i #45 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:20 i #46 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000678; tokens_burnt_usd = +0.000678; gas_burnt = 1014903791999; tokens_burnt = 101490379199900000000 } 00:00:20 w #47 spiral_wasm.run / Error error / { retry = 8; error = "{ receipt_outcomes_len = 1; retry = 8; receipt_failures = [] }" } 00:00:22 i #50 near_workspaces.print_usd / { retry = 9; total_gas_burnt_usd = +0.000884; total_gas_burnt = 1322985651339 } 00:00:22 i #51 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:22 i #52 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000678; tokens_burnt_usd = +0.000678; gas_burnt = 1014903791999; tokens_burnt = 101490379199900000000 } 00:00:22 w #53 spiral_wasm.run / Error error / { retry = 9; error = "{ receipt_outcomes_len = 1; retry = 9; receipt_failures = [] }" } 00:00:25 i #56 near_workspaces.print_usd / { retry = 10; total_gas_burnt_usd = +0.000884; total_gas_burnt = 1322985651339 } 00:00:25 i #57 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:25 i #58 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000678; tokens_burnt_usd = +0.000678; gas_burnt = 1014903791999; tokens_burnt = 101490379199900000000 } 00:00:25 w #59 spiral_wasm.run / Error error / { retry = 10; error = "{ receipt_outcomes_len = 1; retry = 10; receipt_failures = [] }" } 00:00:27 i #62 near_workspaces.print_usd / { retry = 11; total_gas_burnt_usd = +0.000884; total_gas_burnt = 1322985651339 } 00:00:27 i #63 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:27 i #64 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000678; tokens_burnt_usd = +0.000678; gas_burnt = 1014903791999; tokens_burnt = 101490379199900000000 } 00:00:27 w #65 spiral_wasm.run / Error error / { retry = 11; error = "{ receipt_outcomes_len = 1; retry = 11; receipt_failures = [] }" } 00:00:30 i #68 near_workspaces.print_usd / { retry = 12; total_gas_burnt_usd = +0.000884; total_gas_burnt = 1322985651339 } 00:00:30 i #69 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:30 i #70 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000678; tokens_burnt_usd = +0.000678; gas_burnt = 1014903791999; tokens_burnt = 101490379199900000000 } 00:00:30 w #71 spiral_wasm.run / Error error / { retry = 12; error = "{ receipt_outcomes_len = 1; retry = 12; receipt_failures = [] }" } 00:00:33 i #74 near_workspaces.print_usd / { retry = 13; total_gas_burnt_usd = +0.000884; total_gas_burnt = 1322985651339 } 00:00:33 i #75 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:33 i #76 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000678; tokens_burnt_usd = +0.000678; gas_burnt = 1014903791999; tokens_burnt = 101490379199900000000 } 00:00:33 w #77 spiral_wasm.run / Error error / { retry = 13; error = "{ receipt_outcomes_len = 1; retry = 13; receipt_failures = [] }" } 00:00:35 i #80 near_workspaces.print_usd / { retry = 14; total_gas_burnt_usd = +0.000884; total_gas_burnt = 1322985651339 } 00:00:35 i #81 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:35 i #82 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000678; tokens_burnt_usd = +0.000678; gas_burnt = 1014903791999; tokens_burnt = 101490379199900000000 } 00:00:35 w #83 spiral_wasm.run / Error error / { retry = 14; error = "{ receipt_outcomes_len = 1; retry = 14; receipt_failures = [] }" } 00:00:38 i #86 near_workspaces.print_usd / { retry = 15; total_gas_burnt_usd = +0.000884; total_gas_burnt = 1322985651339 } 00:00:38 i #87 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:38 i #88 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000678; tokens_burnt_usd = +0.000678; gas_burnt = 1014903791999; tokens_burnt = 101490379199900000000 } 00:00:38 w #89 spiral_wasm.run / Error error / { retry = 15; error = "{ receipt_outcomes_len = 1; retry = 15; receipt_failures = [] }" }
new¶
In [ ]:
inl new () : state =
{
version = 2
account_set = "account_set" |> sm'.byte_slice |> near.new_iterable_set
alias_set = "alias_set" |> sm'.byte_slice |> near.new_iterable_set
account_map = "account_map" |> sm'.byte_slice |> near.new_lookup_map
alias_map = "alias_map" |> sm'.byte_slice |> near.new_lookup_map
}
In [ ]:
//// test
///! rust -c
inl state = new ()
trace Verbose (fun () => "chat_contract") fun () => { state = state |> sm'.format_debug }
trace Verbose (fun () => "") id
00:00:00 v #1 chat_contract / { state = (2, IterableSet { elements: Vector { len: 0, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 0, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:02 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.001333; total_gas_burnt = 1995747432444 } 00:00:02 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:02 i #4 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.001127; tokens_burnt_usd = +0.001127; gas_burnt = 1687665573104; tokens_burnt = 168766557310400000000 } 00:00:02 w #5 spiral_wasm.run / Error error / { retry = 1; error = "{ receipt_outcomes_len = 1; retry = 1; receipt_failures = [] }" } 00:00:00 v #1 chat_contract / { state = (2, IterableSet { elements: Vector { len: 0, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 0, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:05 i #8 near_workspaces.print_usd / { retry = 2; total_gas_burnt_usd = +0.001333; total_gas_burnt = 1995747432444 } 00:00:05 i #9 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:05 i #10 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.001127; tokens_burnt_usd = +0.001127; gas_burnt = 1687665573104; tokens_burnt = 168766557310400000000 } 00:00:05 w #11 spiral_wasm.run / Error error / { retry = 2; error = "{ receipt_outcomes_len = 1; retry = 2; receipt_failures = [] }" } 00:00:00 v #1 chat_contract / { state = (2, IterableSet { elements: Vector { len: 0, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 0, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:07 i #14 near_workspaces.print_usd / { retry = 3; total_gas_burnt_usd = +0.001333; total_gas_burnt = 1995747432444 } 00:00:07 i #15 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:07 i #16 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.001127; tokens_burnt_usd = +0.001127; gas_burnt = 1687665573104; tokens_burnt = 168766557310400000000 } 00:00:07 w #17 spiral_wasm.run / Error error / { retry = 3; error = "{ receipt_outcomes_len = 1; retry = 3; receipt_failures = [] }" } 00:00:00 v #1 chat_contract / { state = (2, IterableSet { elements: Vector { len: 0, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 0, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:10 i #20 near_workspaces.print_usd / { retry = 4; total_gas_burnt_usd = +0.001333; total_gas_burnt = 1995747432444 } 00:00:10 i #21 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:10 i #22 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.001127; tokens_burnt_usd = +0.001127; gas_burnt = 1687665573104; tokens_burnt = 168766557310400000000 } 00:00:10 w #23 spiral_wasm.run / Error error / { retry = 4; error = "{ receipt_outcomes_len = 1; retry = 4; receipt_failures = [] }" } 00:00:00 v #1 chat_contract / { state = (2, IterableSet { elements: Vector { len: 0, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 0, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:12 i #26 near_workspaces.print_usd / { retry = 5; total_gas_burnt_usd = +0.001333; total_gas_burnt = 1995747432444 } 00:00:12 i #27 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:12 i #28 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.001127; tokens_burnt_usd = +0.001127; gas_burnt = 1687665573104; tokens_burnt = 168766557310400000000 } 00:00:12 w #29 spiral_wasm.run / Error error / { retry = 5; error = "{ receipt_outcomes_len = 1; retry = 5; receipt_failures = [] }" } 00:00:00 v #1 chat_contract / { state = (2, IterableSet { elements: Vector { len: 0, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 0, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:15 i #32 near_workspaces.print_usd / { retry = 6; total_gas_burnt_usd = +0.001333; total_gas_burnt = 1995747432444 } 00:00:15 i #33 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:15 i #34 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.001127; tokens_burnt_usd = +0.001127; gas_burnt = 1687665573104; tokens_burnt = 168766557310400000000 } 00:00:15 w #35 spiral_wasm.run / Error error / { retry = 6; error = "{ receipt_outcomes_len = 1; retry = 6; receipt_failures = [] }" } 00:00:00 v #1 chat_contract / { state = (2, IterableSet { elements: Vector { len: 0, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 0, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:17 i #38 near_workspaces.print_usd / { retry = 7; total_gas_burnt_usd = +0.001333; total_gas_burnt = 1995747432444 } 00:00:17 i #39 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:17 i #40 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.001127; tokens_burnt_usd = +0.001127; gas_burnt = 1687665573104; tokens_burnt = 168766557310400000000 } 00:00:17 w #41 spiral_wasm.run / Error error / { retry = 7; error = "{ receipt_outcomes_len = 1; retry = 7; receipt_failures = [] }" } 00:00:00 v #1 chat_contract / { state = (2, IterableSet { elements: Vector { len: 0, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 0, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:20 i #44 near_workspaces.print_usd / { retry = 8; total_gas_burnt_usd = +0.001333; total_gas_burnt = 1995747432444 } 00:00:20 i #45 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:20 i #46 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.001127; tokens_burnt_usd = +0.001127; gas_burnt = 1687665573104; tokens_burnt = 168766557310400000000 } 00:00:20 w #47 spiral_wasm.run / Error error / { retry = 8; error = "{ receipt_outcomes_len = 1; retry = 8; receipt_failures = [] }" } 00:00:00 v #1 chat_contract / { state = (2, IterableSet { elements: Vector { len: 0, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 0, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:22 i #50 near_workspaces.print_usd / { retry = 9; total_gas_burnt_usd = +0.001333; total_gas_burnt = 1995747432444 } 00:00:22 i #51 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:22 i #52 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.001127; tokens_burnt_usd = +0.001127; gas_burnt = 1687665573104; tokens_burnt = 168766557310400000000 } 00:00:22 w #53 spiral_wasm.run / Error error / { retry = 9; error = "{ receipt_outcomes_len = 1; retry = 9; receipt_failures = [] }" } 00:00:00 v #1 chat_contract / { state = (2, IterableSet { elements: Vector { len: 0, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 0, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:25 i #56 near_workspaces.print_usd / { retry = 10; total_gas_burnt_usd = +0.001333; total_gas_burnt = 1995747432444 } 00:00:25 i #57 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:25 i #58 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.001127; tokens_burnt_usd = +0.001127; gas_burnt = 1687665573104; tokens_burnt = 168766557310400000000 } 00:00:25 w #59 spiral_wasm.run / Error error / { retry = 10; error = "{ receipt_outcomes_len = 1; retry = 10; receipt_failures = [] }" } 00:00:00 v #1 chat_contract / { state = (2, IterableSet { elements: Vector { len: 0, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 0, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:27 i #62 near_workspaces.print_usd / { retry = 11; total_gas_burnt_usd = +0.001333; total_gas_burnt = 1995747432444 } 00:00:27 i #63 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:27 i #64 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.001127; tokens_burnt_usd = +0.001127; gas_burnt = 1687665573104; tokens_burnt = 168766557310400000000 } 00:00:27 w #65 spiral_wasm.run / Error error / { retry = 11; error = "{ receipt_outcomes_len = 1; retry = 11; receipt_failures = [] }" } 00:00:00 v #1 chat_contract / { state = (2, IterableSet { elements: Vector { len: 0, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 0, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:29 i #68 near_workspaces.print_usd / { retry = 12; total_gas_burnt_usd = +0.001333; total_gas_burnt = 1995747432444 } 00:00:29 i #69 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:29 i #70 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.001127; tokens_burnt_usd = +0.001127; gas_burnt = 1687665573104; tokens_burnt = 168766557310400000000 } 00:00:29 w #71 spiral_wasm.run / Error error / { retry = 12; error = "{ receipt_outcomes_len = 1; retry = 12; receipt_failures = [] }" } 00:00:00 v #1 chat_contract / { state = (2, IterableSet { elements: Vector { len: 0, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 0, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:32 i #74 near_workspaces.print_usd / { retry = 13; total_gas_burnt_usd = +0.001482; total_gas_burnt = 2218929994944 } 00:00:32 i #75 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:32 i #76 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.001127; tokens_burnt_usd = +0.001127; gas_burnt = 1687665573104; tokens_burnt = 168766557310400000000 } 00:00:32 i #77 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000149; tokens_burnt_usd = +0.000000; gas_burnt = 223182562500; tokens_burnt = 0 }
is_valid_alias¶
In [ ]:
inl is_valid_alias (alias : sm'.std_string) : bool =
inl alias' = alias |> sm'.from_std_string
inl alias_len = alias' |> sm'.length
alias_len > 0i32
&& alias_len < 64
&& (alias' |> sm'.starts_with "-" |> not)
&& (alias' |> sm'.ends_with "-" |> not)
&& (alias' |> sm'.as_str |> sm'.chars |> iter.all (fun c => (c |> sm'.char_is_alphanumeric) || c = '-'))
In [ ]:
//// test
///! rust -c
""
|> sm'.to_std_string
|> is_valid_alias
|> _assert_eq false
00:00:02 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.000822; total_gas_burnt = 1230881306750 } 00:00:02 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:02 i #4 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000616; tokens_burnt_usd = +0.000616; gas_burnt = 922799447410; tokens_burnt = 92279944741000000000 } 00:00:02 w #5 spiral_wasm.run / Error error / { retry = 1; error = "{ receipt_outcomes_len = 1; retry = 1; receipt_failures = [] }" } 00:00:05 i #8 near_workspaces.print_usd / { retry = 2; total_gas_burnt_usd = +0.000822; total_gas_burnt = 1230881306750 } 00:00:05 i #9 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:05 i #10 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000616; tokens_burnt_usd = +0.000616; gas_burnt = 922799447410; tokens_burnt = 92279944741000000000 } 00:00:05 w #11 spiral_wasm.run / Error error / { retry = 2; error = "{ receipt_outcomes_len = 1; retry = 2; receipt_failures = [] }" } 00:00:07 i #14 near_workspaces.print_usd / { retry = 3; total_gas_burnt_usd = +0.000822; total_gas_burnt = 1230881306750 } 00:00:07 i #15 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:07 i #16 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000616; tokens_burnt_usd = +0.000616; gas_burnt = 922799447410; tokens_burnt = 92279944741000000000 } 00:00:07 w #17 spiral_wasm.run / Error error / { retry = 3; error = "{ receipt_outcomes_len = 1; retry = 3; receipt_failures = [] }" } 00:00:10 i #20 near_workspaces.print_usd / { retry = 4; total_gas_burnt_usd = +0.000822; total_gas_burnt = 1230881306750 } 00:00:10 i #21 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:10 i #22 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000616; tokens_burnt_usd = +0.000616; gas_burnt = 922799447410; tokens_burnt = 92279944741000000000 } 00:00:10 w #23 spiral_wasm.run / Error error / { retry = 4; error = "{ receipt_outcomes_len = 1; retry = 4; receipt_failures = [] }" } 00:00:12 i #26 near_workspaces.print_usd / { retry = 5; total_gas_burnt_usd = +0.000822; total_gas_burnt = 1230881306750 } 00:00:12 i #27 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:12 i #28 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000616; tokens_burnt_usd = +0.000616; gas_burnt = 922799447410; tokens_burnt = 92279944741000000000 } 00:00:12 w #29 spiral_wasm.run / Error error / { retry = 5; error = "{ receipt_outcomes_len = 1; retry = 5; receipt_failures = [] }" } 00:00:15 i #32 near_workspaces.print_usd / { retry = 6; total_gas_burnt_usd = +0.000822; total_gas_burnt = 1230881306750 } 00:00:15 i #33 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:15 i #34 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000616; tokens_burnt_usd = +0.000616; gas_burnt = 922799447410; tokens_burnt = 92279944741000000000 } 00:00:15 w #35 spiral_wasm.run / Error error / { retry = 6; error = "{ receipt_outcomes_len = 1; retry = 6; receipt_failures = [] }" } 00:00:17 i #38 near_workspaces.print_usd / { retry = 7; total_gas_burnt_usd = +0.000822; total_gas_burnt = 1230881306750 } 00:00:17 i #39 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:17 i #40 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000616; tokens_burnt_usd = +0.000616; gas_burnt = 922799447410; tokens_burnt = 92279944741000000000 } 00:00:17 w #41 spiral_wasm.run / Error error / { retry = 7; error = "{ receipt_outcomes_len = 1; retry = 7; receipt_failures = [] }" } 00:00:20 i #44 near_workspaces.print_usd / { retry = 8; total_gas_burnt_usd = +0.000822; total_gas_burnt = 1230881306750 } 00:00:20 i #45 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:20 i #46 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000616; tokens_burnt_usd = +0.000616; gas_burnt = 922799447410; tokens_burnt = 92279944741000000000 } 00:00:20 w #47 spiral_wasm.run / Error error / { retry = 8; error = "{ receipt_outcomes_len = 1; retry = 8; receipt_failures = [] }" } 00:00:22 i #50 near_workspaces.print_usd / { retry = 9; total_gas_burnt_usd = +0.000822; total_gas_burnt = 1230881306750 } 00:00:22 i #51 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:22 i #52 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000616; tokens_burnt_usd = +0.000616; gas_burnt = 922799447410; tokens_burnt = 92279944741000000000 } 00:00:22 w #53 spiral_wasm.run / Error error / { retry = 9; error = "{ receipt_outcomes_len = 1; retry = 9; receipt_failures = [] }" } 00:00:25 i #56 near_workspaces.print_usd / { retry = 10; total_gas_burnt_usd = +0.000822; total_gas_burnt = 1230881306750 } 00:00:25 i #57 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:25 i #58 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000616; tokens_burnt_usd = +0.000616; gas_burnt = 922799447410; tokens_burnt = 92279944741000000000 } 00:00:25 w #59 spiral_wasm.run / Error error / { retry = 10; error = "{ receipt_outcomes_len = 1; retry = 10; receipt_failures = [] }" } 00:00:27 i #62 near_workspaces.print_usd / { retry = 11; total_gas_burnt_usd = +0.000822; total_gas_burnt = 1230881306750 } 00:00:27 i #63 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:27 i #64 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000616; tokens_burnt_usd = +0.000616; gas_burnt = 922799447410; tokens_burnt = 92279944741000000000 } 00:00:27 w #65 spiral_wasm.run / Error error / { retry = 11; error = "{ receipt_outcomes_len = 1; retry = 11; receipt_failures = [] }" } 00:00:30 i #68 near_workspaces.print_usd / { retry = 12; total_gas_burnt_usd = +0.000822; total_gas_burnt = 1230881306750 } 00:00:30 i #69 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:30 i #70 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000616; tokens_burnt_usd = +0.000616; gas_burnt = 922799447410; tokens_burnt = 92279944741000000000 } 00:00:30 w #71 spiral_wasm.run / Error error / { retry = 12; error = "{ receipt_outcomes_len = 1; retry = 12; receipt_failures = [] }" } 00:00:33 i #74 near_workspaces.print_usd / { retry = 13; total_gas_burnt_usd = +0.000822; total_gas_burnt = 1230881306750 } 00:00:33 i #75 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:33 i #76 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000616; tokens_burnt_usd = +0.000616; gas_burnt = 922799447410; tokens_burnt = 92279944741000000000 } 00:00:33 w #77 spiral_wasm.run / Error error / { retry = 13; error = "{ receipt_outcomes_len = 1; retry = 13; receipt_failures = [] }" } 00:00:35 i #80 near_workspaces.print_usd / { retry = 14; total_gas_burnt_usd = +0.000822; total_gas_burnt = 1230881306750 } 00:00:35 i #81 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:35 i #82 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000616; tokens_burnt_usd = +0.000616; gas_burnt = 922799447410; tokens_burnt = 92279944741000000000 } 00:00:35 w #83 spiral_wasm.run / Error error / { retry = 14; error = "{ receipt_outcomes_len = 1; retry = 14; receipt_failures = [] }" } 00:00:38 i #86 near_workspaces.print_usd / { retry = 15; total_gas_burnt_usd = +0.000822; total_gas_burnt = 1230881306750 } 00:00:38 i #87 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:38 i #88 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000616; tokens_burnt_usd = +0.000616; gas_burnt = 922799447410; tokens_burnt = 92279944741000000000 } 00:00:38 w #89 spiral_wasm.run / Error error / { retry = 15; error = "{ receipt_outcomes_len = 1; retry = 15; receipt_failures = [] }" }
In [ ]:
//// test
///! rust -c
"a-"
|> sm'.to_std_string
|> is_valid_alias
|> _assert_eq false
00:00:02 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.000824; total_gas_burnt = 1232870661341 } 00:00:02 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:02 i #4 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000618; tokens_burnt_usd = +0.000618; gas_burnt = 924788802001; tokens_burnt = 92478880200100000000 } 00:00:02 w #5 spiral_wasm.run / Error error / { retry = 1; error = "{ receipt_outcomes_len = 1; retry = 1; receipt_failures = [] }" } 00:00:05 i #8 near_workspaces.print_usd / { retry = 2; total_gas_burnt_usd = +0.000824; total_gas_burnt = 1232870661341 } 00:00:05 i #9 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:05 i #10 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000618; tokens_burnt_usd = +0.000618; gas_burnt = 924788802001; tokens_burnt = 92478880200100000000 } 00:00:05 w #11 spiral_wasm.run / Error error / { retry = 2; error = "{ receipt_outcomes_len = 1; retry = 2; receipt_failures = [] }" } 00:00:07 i #14 near_workspaces.print_usd / { retry = 3; total_gas_burnt_usd = +0.000824; total_gas_burnt = 1232870661341 } 00:00:07 i #15 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:07 i #16 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000618; tokens_burnt_usd = +0.000618; gas_burnt = 924788802001; tokens_burnt = 92478880200100000000 } 00:00:07 w #17 spiral_wasm.run / Error error / { retry = 3; error = "{ receipt_outcomes_len = 1; retry = 3; receipt_failures = [] }" } 00:00:10 i #20 near_workspaces.print_usd / { retry = 4; total_gas_burnt_usd = +0.000824; total_gas_burnt = 1232870661341 } 00:00:10 i #21 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:10 i #22 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000618; tokens_burnt_usd = +0.000618; gas_burnt = 924788802001; tokens_burnt = 92478880200100000000 } 00:00:10 w #23 spiral_wasm.run / Error error / { retry = 4; error = "{ receipt_outcomes_len = 1; retry = 4; receipt_failures = [] }" } 00:00:12 i #26 near_workspaces.print_usd / { retry = 5; total_gas_burnt_usd = +0.000824; total_gas_burnt = 1232870661341 } 00:00:12 i #27 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:12 i #28 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000618; tokens_burnt_usd = +0.000618; gas_burnt = 924788802001; tokens_burnt = 92478880200100000000 } 00:00:12 w #29 spiral_wasm.run / Error error / { retry = 5; error = "{ receipt_outcomes_len = 1; retry = 5; receipt_failures = [] }" } 00:00:15 i #32 near_workspaces.print_usd / { retry = 6; total_gas_burnt_usd = +0.000824; total_gas_burnt = 1232870661341 } 00:00:15 i #33 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:15 i #34 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000618; tokens_burnt_usd = +0.000618; gas_burnt = 924788802001; tokens_burnt = 92478880200100000000 } 00:00:15 w #35 spiral_wasm.run / Error error / { retry = 6; error = "{ receipt_outcomes_len = 1; retry = 6; receipt_failures = [] }" } 00:00:17 i #38 near_workspaces.print_usd / { retry = 7; total_gas_burnt_usd = +0.000824; total_gas_burnt = 1232870661341 } 00:00:17 i #39 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:17 i #40 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000618; tokens_burnt_usd = +0.000618; gas_burnt = 924788802001; tokens_burnt = 92478880200100000000 } 00:00:17 w #41 spiral_wasm.run / Error error / { retry = 7; error = "{ receipt_outcomes_len = 1; retry = 7; receipt_failures = [] }" } 00:00:20 i #44 near_workspaces.print_usd / { retry = 8; total_gas_burnt_usd = +0.000824; total_gas_burnt = 1232870661341 } 00:00:20 i #45 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:20 i #46 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000618; tokens_burnt_usd = +0.000618; gas_burnt = 924788802001; tokens_burnt = 92478880200100000000 } 00:00:20 w #47 spiral_wasm.run / Error error / { retry = 8; error = "{ receipt_outcomes_len = 1; retry = 8; receipt_failures = [] }" } 00:00:22 i #50 near_workspaces.print_usd / { retry = 9; total_gas_burnt_usd = +0.000824; total_gas_burnt = 1232870661341 } 00:00:22 i #51 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:22 i #52 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000618; tokens_burnt_usd = +0.000618; gas_burnt = 924788802001; tokens_burnt = 92478880200100000000 } 00:00:22 w #53 spiral_wasm.run / Error error / { retry = 9; error = "{ receipt_outcomes_len = 1; retry = 9; receipt_failures = [] }" } 00:00:25 i #56 near_workspaces.print_usd / { retry = 10; total_gas_burnt_usd = +0.000824; total_gas_burnt = 1232870661341 } 00:00:25 i #57 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:25 i #58 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000618; tokens_burnt_usd = +0.000618; gas_burnt = 924788802001; tokens_burnt = 92478880200100000000 } 00:00:25 w #59 spiral_wasm.run / Error error / { retry = 10; error = "{ receipt_outcomes_len = 1; retry = 10; receipt_failures = [] }" } 00:00:27 i #62 near_workspaces.print_usd / { retry = 11; total_gas_burnt_usd = +0.000824; total_gas_burnt = 1232870661341 } 00:00:27 i #63 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:27 i #64 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000618; tokens_burnt_usd = +0.000618; gas_burnt = 924788802001; tokens_burnt = 92478880200100000000 } 00:00:27 w #65 spiral_wasm.run / Error error / { retry = 11; error = "{ receipt_outcomes_len = 1; retry = 11; receipt_failures = [] }" } 00:00:30 i #68 near_workspaces.print_usd / { retry = 12; total_gas_burnt_usd = +0.000824; total_gas_burnt = 1232870661341 } 00:00:30 i #69 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:30 i #70 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000618; tokens_burnt_usd = +0.000618; gas_burnt = 924788802001; tokens_burnt = 92478880200100000000 } 00:00:30 w #71 spiral_wasm.run / Error error / { retry = 12; error = "{ receipt_outcomes_len = 1; retry = 12; receipt_failures = [] }" } 00:00:33 i #74 near_workspaces.print_usd / { retry = 13; total_gas_burnt_usd = +0.000824; total_gas_burnt = 1232870661341 } 00:00:33 i #75 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:33 i #76 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000618; tokens_burnt_usd = +0.000618; gas_burnt = 924788802001; tokens_burnt = 92478880200100000000 } 00:00:33 w #77 spiral_wasm.run / Error error / { retry = 13; error = "{ receipt_outcomes_len = 1; retry = 13; receipt_failures = [] }" } 00:00:35 i #80 near_workspaces.print_usd / { retry = 14; total_gas_burnt_usd = +0.000824; total_gas_burnt = 1232870661341 } 00:00:35 i #81 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:35 i #82 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000618; tokens_burnt_usd = +0.000618; gas_burnt = 924788802001; tokens_burnt = 92478880200100000000 } 00:00:35 w #83 spiral_wasm.run / Error error / { retry = 14; error = "{ receipt_outcomes_len = 1; retry = 14; receipt_failures = [] }" } 00:00:38 i #86 near_workspaces.print_usd / { retry = 15; total_gas_burnt_usd = +0.000824; total_gas_burnt = 1232870661341 } 00:00:38 i #87 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:38 i #88 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000618; tokens_burnt_usd = +0.000618; gas_burnt = 924788802001; tokens_burnt = 92478880200100000000 } 00:00:38 w #89 spiral_wasm.run / Error error / { retry = 15; error = "{ receipt_outcomes_len = 1; retry = 15; receipt_failures = [] }" }
In [ ]:
//// test
///! rust -c
"a-a"
|> sm'.to_std_string
|> is_valid_alias
|> _assert_eq true
00:00:02 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.000825; total_gas_burnt = 1234468778320 } 00:00:02 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:02 i #4 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000619; tokens_burnt_usd = +0.000619; gas_burnt = 926386918980; tokens_burnt = 92638691898000000000 } 00:00:02 w #5 spiral_wasm.run / Error error / { retry = 1; error = "{ receipt_outcomes_len = 1; retry = 1; receipt_failures = [] }" } 00:00:05 i #8 near_workspaces.print_usd / { retry = 2; total_gas_burnt_usd = +0.000825; total_gas_burnt = 1234468778320 } 00:00:05 i #9 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:05 i #10 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000619; tokens_burnt_usd = +0.000619; gas_burnt = 926386918980; tokens_burnt = 92638691898000000000 } 00:00:05 w #11 spiral_wasm.run / Error error / { retry = 2; error = "{ receipt_outcomes_len = 1; retry = 2; receipt_failures = [] }" } 00:00:07 i #14 near_workspaces.print_usd / { retry = 3; total_gas_burnt_usd = +0.000825; total_gas_burnt = 1234468778320 } 00:00:07 i #15 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:07 i #16 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000619; tokens_burnt_usd = +0.000619; gas_burnt = 926386918980; tokens_burnt = 92638691898000000000 } 00:00:07 w #17 spiral_wasm.run / Error error / { retry = 3; error = "{ receipt_outcomes_len = 1; retry = 3; receipt_failures = [] }" } 00:00:10 i #20 near_workspaces.print_usd / { retry = 4; total_gas_burnt_usd = +0.000825; total_gas_burnt = 1234468778320 } 00:00:10 i #21 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:10 i #22 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000619; tokens_burnt_usd = +0.000619; gas_burnt = 926386918980; tokens_burnt = 92638691898000000000 } 00:00:10 w #23 spiral_wasm.run / Error error / { retry = 4; error = "{ receipt_outcomes_len = 1; retry = 4; receipt_failures = [] }" } 00:00:12 i #26 near_workspaces.print_usd / { retry = 5; total_gas_burnt_usd = +0.000825; total_gas_burnt = 1234468778320 } 00:00:12 i #27 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:12 i #28 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000619; tokens_burnt_usd = +0.000619; gas_burnt = 926386918980; tokens_burnt = 92638691898000000000 } 00:00:12 w #29 spiral_wasm.run / Error error / { retry = 5; error = "{ receipt_outcomes_len = 1; retry = 5; receipt_failures = [] }" } 00:00:15 i #32 near_workspaces.print_usd / { retry = 6; total_gas_burnt_usd = +0.000825; total_gas_burnt = 1234468778320 } 00:00:15 i #33 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:15 i #34 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000619; tokens_burnt_usd = +0.000619; gas_burnt = 926386918980; tokens_burnt = 92638691898000000000 } 00:00:15 w #35 spiral_wasm.run / Error error / { retry = 6; error = "{ receipt_outcomes_len = 1; retry = 6; receipt_failures = [] }" } 00:00:17 i #38 near_workspaces.print_usd / { retry = 7; total_gas_burnt_usd = +0.000825; total_gas_burnt = 1234468778320 } 00:00:17 i #39 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:17 i #40 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000619; tokens_burnt_usd = +0.000619; gas_burnt = 926386918980; tokens_burnt = 92638691898000000000 } 00:00:17 w #41 spiral_wasm.run / Error error / { retry = 7; error = "{ receipt_outcomes_len = 1; retry = 7; receipt_failures = [] }" } 00:00:20 i #44 near_workspaces.print_usd / { retry = 8; total_gas_burnt_usd = +0.000825; total_gas_burnt = 1234468778320 } 00:00:20 i #45 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:20 i #46 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000619; tokens_burnt_usd = +0.000619; gas_burnt = 926386918980; tokens_burnt = 92638691898000000000 } 00:00:20 w #47 spiral_wasm.run / Error error / { retry = 8; error = "{ receipt_outcomes_len = 1; retry = 8; receipt_failures = [] }" } 00:00:22 i #50 near_workspaces.print_usd / { retry = 9; total_gas_burnt_usd = +0.000825; total_gas_burnt = 1234468778320 } 00:00:22 i #51 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:22 i #52 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000619; tokens_burnt_usd = +0.000619; gas_burnt = 926386918980; tokens_burnt = 92638691898000000000 } 00:00:22 w #53 spiral_wasm.run / Error error / { retry = 9; error = "{ receipt_outcomes_len = 1; retry = 9; receipt_failures = [] }" } 00:00:25 i #56 near_workspaces.print_usd / { retry = 10; total_gas_burnt_usd = +0.000825; total_gas_burnt = 1234468778320 } 00:00:25 i #57 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:25 i #58 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000619; tokens_burnt_usd = +0.000619; gas_burnt = 926386918980; tokens_burnt = 92638691898000000000 } 00:00:25 w #59 spiral_wasm.run / Error error / { retry = 10; error = "{ receipt_outcomes_len = 1; retry = 10; receipt_failures = [] }" } 00:00:27 i #62 near_workspaces.print_usd / { retry = 11; total_gas_burnt_usd = +0.000825; total_gas_burnt = 1234468778320 } 00:00:27 i #63 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:27 i #64 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000619; tokens_burnt_usd = +0.000619; gas_burnt = 926386918980; tokens_burnt = 92638691898000000000 } 00:00:27 w #65 spiral_wasm.run / Error error / { retry = 11; error = "{ receipt_outcomes_len = 1; retry = 11; receipt_failures = [] }" } 00:00:30 i #68 near_workspaces.print_usd / { retry = 12; total_gas_burnt_usd = +0.000825; total_gas_burnt = 1234468778320 } 00:00:30 i #69 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:30 i #70 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000619; tokens_burnt_usd = +0.000619; gas_burnt = 926386918980; tokens_burnt = 92638691898000000000 } 00:00:30 w #71 spiral_wasm.run / Error error / { retry = 12; error = "{ receipt_outcomes_len = 1; retry = 12; receipt_failures = [] }" } 00:00:32 i #74 near_workspaces.print_usd / { retry = 13; total_gas_burnt_usd = +0.000825; total_gas_burnt = 1234468778320 } 00:00:32 i #75 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:32 i #76 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000619; tokens_burnt_usd = +0.000619; gas_burnt = 926386918980; tokens_burnt = 92638691898000000000 } 00:00:32 w #77 spiral_wasm.run / Error error / { retry = 13; error = "{ receipt_outcomes_len = 1; retry = 13; receipt_failures = [] }" } 00:00:35 i #80 near_workspaces.print_usd / { retry = 14; total_gas_burnt_usd = +0.000825; total_gas_burnt = 1234468778320 } 00:00:35 i #81 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:35 i #82 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000619; tokens_burnt_usd = +0.000619; gas_burnt = 926386918980; tokens_burnt = 92638691898000000000 } 00:00:35 w #83 spiral_wasm.run / Error error / { retry = 14; error = "{ receipt_outcomes_len = 1; retry = 14; receipt_failures = [] }" } 00:00:37 i #86 near_workspaces.print_usd / { retry = 15; total_gas_burnt_usd = +0.000825; total_gas_burnt = 1234468778320 } 00:00:37 i #87 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:37 i #88 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000619; tokens_burnt_usd = +0.000619; gas_burnt = 926386918980; tokens_burnt = 92638691898000000000 } 00:00:37 w #89 spiral_wasm.run / Error error / { retry = 15; error = "{ receipt_outcomes_len = 1; retry = 15; receipt_failures = [] }" }
generate_cid¶
In [ ]:
inl generate_cid (content : am'.vec u8) : sm'.std_string =
!\($'" fn encode_u64(value: u64) -> Vec<u8> { //"') : ()
!\($'" let mut buffer = unsigned_varint::encode::u64_buffer(); //"') : ()
!\($'" unsigned_varint::encode::u64(value, &mut buffer).to_vec() //"') : ()
!\($'" } //"') : ()
!\($'" fn sha256_hash(content: &[u8]) -> Vec<u8> { //"') : ()
!\($'" let mut hasher: sha2::Sha256 = sha2::Digest::new(); //"') : ()
!\($'" sha2::Digest::update(&mut hasher, content); //"') : ()
!\($'" sha2::Digest::finalize(hasher).to_vec() //"') : ()
!\($'" } //"') : ()
!\($'" let version: u8 = 1; //"') : ()
!\($'" let codec_raw: u64 = 0x55; //"') : ()
!\($'" let codec_bytes = encode_u64(codec_raw); //"') : ()
!\($'" let hash_result = sha256_hash(&!content); //"') : ()
!\($'" let multihash = std::iter::once(0x12) //"') : ()
!\($'" .chain(std::iter::once(32)) //"') : ()
!\($'" .chain(hash_result.into_iter()) //"') : ()
!\($'" .collect(); //"') : ()
!\($'" let cid_bytes = [vec\![version], codec_bytes, multihash].concat(); //"') : ()
!\($'" let result = multibase::encode(multibase::Base::Base32Lower, &cid_bytes); //"') : ()
!\($'"result"')
In [ ]:
//// test
///! rust -c -d multibase sha2 unsigned-varint
;[]
|> am'.to_vec
|> generate_cid
|> sm'.from_std_string
|> _assert_eq "bafkreihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku"
00:00:02 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.001025; total_gas_burnt = 1534910153045 } 00:00:02 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:02 i #4 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000670; tokens_burnt_usd = +0.000670; gas_burnt = 1003645731205; tokens_burnt = 100364573120500000000 } 00:00:02 i #5 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000149; tokens_burnt_usd = +0.000000; gas_burnt = 223182562500; tokens_burnt = 0 }
claim_alias¶
In [ ]:
inl claim_alias (state : rust.ref (rust.mut' state)) (alias : sm'.std_string) : () =
inl account_set : rust.ref (rust.mut' (near.iterable_set near.account_id)) =
!\($'$"&mut !state.1"')
inl alias_set : rust.ref (rust.mut' (near.iterable_set sm'.std_string)) =
!\($'$"&mut !state.2"')
inl account_map : rust.ref (rust.mut' (near.lookup_map near.account_id sm'.std_string)) =
!\($'$"&mut !state.3"')
inl alias_map : rust.ref (rust.mut' (near.lookup_map sm'.std_string (mapm.hash_map near.account_id (u64 * u32)))) =
!\($'$"&mut !state.4"')
inl signer_account_id = near.signer_account_id ()
inl predecessor_account_id = near.predecessor_account_id ()
inl block_timestamp = near.block_timestamp ()
trace Debug
fun () => "chat_contract.claim_alias"
fun () => {
alias
block_timestamp
signer_account_id = signer_account_id |> sm'.to_string
predecessor_account_id = predecessor_account_id |> sm'.to_string
}
if alias |> is_valid_alias |> not
then near.panic_str "chat_contract.claim_alias / invalid alias" . true
else false
|> ignore
inl account_alias =
account_map
|> near.lookup_get signer_account_id
|> optionm'.cloned
match account_alias |> optionm'.unbox with
| Some account_alias when account_alias =. alias =>
trace Warning
fun () => "chat_contract.claim_alias / alias already claimed"
fun () => { account_alias = account_alias |> sm'.format_debug }
| account_alias' =>
trace Debug
fun () => "chat_contract.claim_alias"
fun () => { account_alias = account_alias |> sm'.format_debug }
match account_alias' with
| Some account_alias =>
!\($'" !alias_map //"') : ()
!\($'" .get_mut(&!account_alias) //"') : ()
!\($'" .unwrap() //"') : ()
!\\(signer_account_id, $'" .remove(&$0); //"') : ()
| None => ()
!\\((signer_account_id, alias), $'" !account_map.insert($0.clone(), $1.clone()); //"') : ()
account_set |> near.iterable_set_insert signer_account_id |> ignore
alias_set |> near.iterable_set_insert alias |> ignore
!\\(alias, $'" let new_alias_account_map = match !alias_map.get(&$0) { //"') : ()
!\($'" None => { //"') : ()
!\($'" let mut new_map = std::collections::HashMap::new(); //"') : ()
!\\((signer_account_id, block_timestamp), $'" new_map.insert($0, ($1, 0u32)); //"') : ()
!\($'" new_map //"') : ()
!\($'" } //"') : ()
!\($'" Some(accounts) => { //"') : ()
!\($'" let mut accounts_vec = accounts.iter().collect::<Vec<_>>(); //"') : ()
!\($'" accounts_vec.sort_unstable_by_key(|(_, (_, index))| index); //"') : ()
!\($'" let mut new_map = accounts_vec //"') : ()
!\($'" .iter() //"') : ()
!\($'" .enumerate() //"') : ()
!\($'" .map(|(i, (signer_account_id, (timestamp, _)))| { //"') : ()
!\($'" ((*signer_account_id).clone(), (*timestamp, i as u32)) //"') : ()
!\($'" }) //"') : ()
!\($'" .collect::<std::collections::HashMap<_, _>>(); //"') : ()
!\\(signer_account_id, $'" new_map.insert($0, (!block_timestamp, accounts_vec.len() as u32)); //"') : ()
!\($'" new_map //"') : ()
!\($'" } //"') : ()
!\($'" }; //"') : ()
!\\(alias, $'" !alias_map.insert($0, new_alias_account_map); //"') : ()
In [ ]:
//// test
///! rust -c
inl state = new ()
inl version = state.version
inl account_set = state.account_set
inl alias_set = state.alias_set
inl account_map = state.account_map
inl alias_map = state.alias_map
inl version = join version
inl account_set = join account_set
inl alias_set = join alias_set
inl account_map = join account_map
inl alias_map = join alias_map
inl state : rust.ref (rust.mut' state) =
!\\(
version,
$'$"&mut ($0, !account_set, !alias_set, !account_map, !alias_map)"'
)
"alias1"
|> sm'.to_std_string
|> claim_alias state
trace Verbose
fun () => "chat_contract"
fun () => { state = state |> sm'.format_debug }
trace Debug (fun () => "") id
00:00:00 d #1 chat_contract.claim_alias / { alias = "alias1"; block_timestamp = 1730878046168277540; signer_account_id = "dev-20241106072724-47779973369499"; predecessor_account_id = "dev-20241106072724-47779973369499" } 00:00:00 d #2 chat_contract.claim_alias / { account_alias = None } 00:00:00 v #3 chat_contract / { state = (2, IterableSet { elements: Vector { len: 1, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 1, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:02 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.002553; total_gas_burnt = 3821674356414 } 00:00:02 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:02 i #4 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.002347; tokens_burnt_usd = +0.002347; gas_burnt = 3513592497074; tokens_burnt = 351359249707400000000 } 00:00:02 w #5 spiral_wasm.run / Error error / { retry = 1; error = "{ receipt_outcomes_len = 1; retry = 1; receipt_failures = [] }" } 00:00:00 d #1 chat_contract.claim_alias / { alias = "alias1"; block_timestamp = 1730878048705871484; signer_account_id = "dev-20241106072727-67903429627766"; predecessor_account_id = "dev-20241106072727-67903429627766" } 00:00:00 d #2 chat_contract.claim_alias / { account_alias = None } 00:00:00 v #3 chat_contract / { state = (2, IterableSet { elements: Vector { len: 1, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 1, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:05 i #8 near_workspaces.print_usd / { retry = 2; total_gas_burnt_usd = +0.002553; total_gas_burnt = 3821674356414 } 00:00:05 i #9 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:05 i #10 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.002347; tokens_burnt_usd = +0.002347; gas_burnt = 3513592497074; tokens_burnt = 351359249707400000000 } 00:00:05 w #11 spiral_wasm.run / Error error / { retry = 2; error = "{ receipt_outcomes_len = 1; retry = 2; receipt_failures = [] }" } 00:00:00 d #1 chat_contract.claim_alias / { alias = "alias1"; block_timestamp = 1730878051219618675; signer_account_id = "dev-20241106072729-45785339583994"; predecessor_account_id = "dev-20241106072729-45785339583994" } 00:00:00 d #2 chat_contract.claim_alias / { account_alias = None } 00:00:00 v #3 chat_contract / { state = (2, IterableSet { elements: Vector { len: 1, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 1, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:07 i #14 near_workspaces.print_usd / { retry = 3; total_gas_burnt_usd = +0.002702; total_gas_burnt = 4044856918914 } 00:00:07 i #15 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:07 i #16 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.002347; tokens_burnt_usd = +0.002347; gas_burnt = 3513592497074; tokens_burnt = 351359249707400000000 } 00:00:07 i #17 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000149; tokens_burnt_usd = +0.000000; gas_burnt = 223182562500; tokens_burnt = 0 }
In [ ]:
//// test
///! rust \"-c=-e=\\\"chat_contract.claim_alias / invalid alias\\\"\"
""
|> sm'.to_std_string
|> claim_alias (
inl state = new ()
inl version = state.version
inl account_set = state.account_set
inl alias_set = state.alias_set
inl account_map = state.account_map
inl alias_map = state.alias_map
!\\(version, $'$"&mut ($0, !account_set, !alias_set, !account_map, !alias_map)"')
)
trace Debug (fun () => "") id
00:00:02 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.001164; total_gas_burnt = 1742684239585 } 00:00:02 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:02 i #4 near_workspaces.print_usd / outcome / { is_success = false; gas_burnt_usd = +0.000958; tokens_burnt_usd = +0.000958; gas_burnt = 1434602380245; tokens_burnt = 143460238024500000000 } 00:00:02 c #5 spiral_wasm.run / Ok (Some error) / { retry = 1; error = { receipt_outcomes_len = 1; retry = 1; receipt_failures = [ ExecutionOutcome { transaction_hash: HEeZDHFA8oS1maVdquedhXdatFwFxvCrRS9HWfvckajj, block_hash: qghywJ92YuZ1PobhT27Z8wMFL9jUbGEUe7DiaXxdokW, logs: [], receipt_ids: [ CTobRx4J9cwQfbs4sA38MtM7tAxz6hQAPW8P1fseiaqC, ], gas_burnt: NearGas { inner: 1434602380245, }, tokens_burnt: NearToken { inner: 143460238024500000000, }, executor_id: AccountId( "dev-20241106072745-82647124336079", ), status: Failure(ActionError(ActionError { index: Some(0), kind: FunctionCallError(ExecutionError("Smart contract panicked: chat_contract.claim_alias / invalid alias")) })), }, ] } }
In [ ]:
//// test
///! rust -cd borsh
inl state' = new ()
inl state = state'
inl version = state.version
inl account_set = state.account_set
inl alias_set = state.alias_set
inl account_map = state.account_map
inl alias_map = state.alias_map
inl version = join version
inl account_set = join account_set
inl alias_set = join alias_set
inl account_map = join account_map
inl alias_map = join alias_map
inl state =
!\\(
(version, account_set, alias_set),
$'$"&mut ($0, $1, $2, !account_map, !alias_map)"'
)
"alias1"
|> sm'.to_std_string
|> claim_alias state
"alias1"
|> sm'.to_std_string
|> claim_alias state
"alias1"
|> sm'.to_std_string
|> claim_alias state
inl account_set' : rust.ref (near.iterable_set near.account_id) =
!\($'$"&!state.1"')
inl alias_set' : rust.ref (near.iterable_set sm'.std_string) =
!\($'$"&!state.2"')
inl account_set' =
account_set'
|> iter.iter_ref''
|> iter.cloned
|> iter_collect
inl alias_set' =
alias_set'
|> iter.iter_ref''
|> iter.cloned
|> iter_collect
|> am'.vec_map sm'.from_std_string
trace Verbose
fun () => "chat_contract"
fun () => {
account_set' = account_set' |> sm'.format_debug
alias_set' = alias_set' |> sm'.format_debug
state = state |> sm'.format_debug
}
trace Debug (fun () => "") id
account_set'
|> am'.vec_len
|> convert
|> _assert_eq 1u32
alias_set'
|> am'.from_vec_base
|> _assert_eq' ;[ "alias1" ]
00:00:00 d #1 chat_contract.claim_alias / { alias = "alias1"; block_timestamp = 1730878083086558174; signer_account_id = "dev-20241106072801-10954652652078"; predecessor_account_id = "dev-20241106072801-10954652652078" } 00:00:00 d #2 chat_contract.claim_alias / { account_alias = None } 00:00:00 d #3 chat_contract.claim_alias / { alias = "alias1"; block_timestamp = 1730878083086558174; signer_account_id = "dev-20241106072801-10954652652078"; predecessor_account_id = "dev-20241106072801-10954652652078" } 00:00:00 d #4 chat_contract.claim_alias / { account_alias = Some("alias1") } 00:00:00 d #5 chat_contract.claim_alias / { alias = "alias1"; block_timestamp = 1730878083086558174; signer_account_id = "dev-20241106072801-10954652652078"; predecessor_account_id = "dev-20241106072801-10954652652078" } 00:00:00 d #6 chat_contract.claim_alias / { account_alias = Some("alias1") } 00:00:00 v #7 chat_contract / { account_set' = [AccountId("dev-20241106072801-10954652652078")]; alias_set' = ["alias1"]; state = (2, IterableSet { elements: Vector { len: 1, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 1, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:02 i #2 near_workspaces.print_usd / { retry = 1; total_gas_burnt_usd = +0.004424; total_gas_burnt = 6622978407675 } 00:00:02 i #3 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:02 i #4 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.004218; tokens_burnt_usd = +0.004218; gas_burnt = 6314896548335; tokens_burnt = 631489654833500000000 } 00:00:02 w #5 spiral_wasm.run / Error error / { retry = 1; error = "{ receipt_outcomes_len = 1; retry = 1; receipt_failures = [] }" } 00:00:00 d #1 chat_contract.claim_alias / { alias = "alias1"; block_timestamp = 1730878085618334194; signer_account_id = "dev-20241106072804-65032513253163"; predecessor_account_id = "dev-20241106072804-65032513253163" } 00:00:00 d #2 chat_contract.claim_alias / { account_alias = None } 00:00:00 d #3 chat_contract.claim_alias / { alias = "alias1"; block_timestamp = 1730878085618334194; signer_account_id = "dev-20241106072804-65032513253163"; predecessor_account_id = "dev-20241106072804-65032513253163" } 00:00:00 d #4 chat_contract.claim_alias / { account_alias = Some("alias1") } 00:00:00 d #5 chat_contract.claim_alias / { alias = "alias1"; block_timestamp = 1730878085618334194; signer_account_id = "dev-20241106072804-65032513253163"; predecessor_account_id = "dev-20241106072804-65032513253163" } 00:00:00 d #6 chat_contract.claim_alias / { account_alias = Some("alias1") } 00:00:00 v #7 chat_contract / { account_set' = [AccountId("dev-20241106072804-65032513253163")]; alias_set' = ["alias1"]; state = (2, IterableSet { elements: Vector { len: 1, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 1, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:05 i #8 near_workspaces.print_usd / { retry = 2; total_gas_burnt_usd = +0.004424; total_gas_burnt = 6622978407675 } 00:00:05 i #9 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:05 i #10 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.004218; tokens_burnt_usd = +0.004218; gas_burnt = 6314896548335; tokens_burnt = 631489654833500000000 } 00:00:05 w #11 spiral_wasm.run / Error error / { retry = 2; error = "{ receipt_outcomes_len = 1; retry = 2; receipt_failures = [] }" } 00:00:00 d #1 chat_contract.claim_alias / { alias = "alias1"; block_timestamp = 1730878088179486334; signer_account_id = "dev-20241106072806-34544535744328"; predecessor_account_id = "dev-20241106072806-34544535744328" } 00:00:00 d #2 chat_contract.claim_alias / { account_alias = None } 00:00:00 d #3 chat_contract.claim_alias / { alias = "alias1"; block_timestamp = 1730878088179486334; signer_account_id = "dev-20241106072806-34544535744328"; predecessor_account_id = "dev-20241106072806-34544535744328" } 00:00:00 d #4 chat_contract.claim_alias / { account_alias = Some("alias1") } 00:00:00 d #5 chat_contract.claim_alias / { alias = "alias1"; block_timestamp = 1730878088179486334; signer_account_id = "dev-20241106072806-34544535744328"; predecessor_account_id = "dev-20241106072806-34544535744328" } 00:00:00 d #6 chat_contract.claim_alias / { account_alias = Some("alias1") } 00:00:00 v #7 chat_contract / { account_set' = [AccountId("dev-20241106072806-34544535744328")]; alias_set' = ["alias1"]; state = (2, IterableSet { elements: Vector { len: 1, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 1, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:07 i #14 near_workspaces.print_usd / { retry = 3; total_gas_burnt_usd = +0.004424; total_gas_burnt = 6622978407675 } 00:00:07 i #15 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:07 i #16 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.004218; tokens_burnt_usd = +0.004218; gas_burnt = 6314896548335; tokens_burnt = 631489654833500000000 } 00:00:07 w #17 spiral_wasm.run / Error error / { retry = 3; error = "{ receipt_outcomes_len = 1; retry = 3; receipt_failures = [] }" } 00:00:00 d #1 chat_contract.claim_alias / { alias = "alias1"; block_timestamp = 1730878090669368818; signer_account_id = "dev-20241106072809-17379174613476"; predecessor_account_id = "dev-20241106072809-17379174613476" } 00:00:00 d #2 chat_contract.claim_alias / { account_alias = None } 00:00:00 d #3 chat_contract.claim_alias / { alias = "alias1"; block_timestamp = 1730878090669368818; signer_account_id = "dev-20241106072809-17379174613476"; predecessor_account_id = "dev-20241106072809-17379174613476" } 00:00:00 d #4 chat_contract.claim_alias / { account_alias = Some("alias1") } 00:00:00 d #5 chat_contract.claim_alias / { alias = "alias1"; block_timestamp = 1730878090669368818; signer_account_id = "dev-20241106072809-17379174613476"; predecessor_account_id = "dev-20241106072809-17379174613476" } 00:00:00 d #6 chat_contract.claim_alias / { account_alias = Some("alias1") } 00:00:00 v #7 chat_contract / { account_set' = [AccountId("dev-20241106072809-17379174613476")]; alias_set' = ["alias1"]; state = (2, IterableSet { elements: Vector { len: 1, prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 115, 101, 116, 109] } }, IterableSet { elements: Vector { len: 1, prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 118] }, index: LookupMap { prefix: [97, 108, 105, 97, 115, 95, 115, 101, 116, 109] } }, LookupMap { prefix: [97, 99, 99, 111, 117, 110, 116, 95, 109, 97, 112] }, LookupMap { prefix: [97, 108, 105, 97, 115, 95, 109, 97, 112] }) } 00:00:10 i #20 near_workspaces.print_usd / { retry = 4; total_gas_burnt_usd = +0.004573; total_gas_burnt = 6846160970175 } 00:00:10 i #21 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000206; tokens_burnt_usd = +0.000206; gas_burnt = 308081859340; tokens_burnt = 30808185934000000000 } 00:00:10 i #22 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.004218; tokens_burnt_usd = +0.004218; gas_burnt = 6314896548335; tokens_burnt = 631489654833500000000 } 00:00:10 i #23 near_workspaces.print_usd / outcome / { is_success = true; gas_burnt_usd = +0.000149; tokens_burnt_usd = +0.000000; gas_burnt = 223182562500; tokens_burnt = 0 }
get_account_info¶
In [ ]:
inl get_account_info
(state : rust.ref state)
(account_id : near.account_id)
: optionm'.option' (sm'.std_string * (u64 * u32))
=
inl account_map : rust.ref (near.lookup_map near.account_id sm'.std_string) =
!\($'$"&!state.3"')
inl alias_map : rust.ref (near.lookup_map sm'.std_string (mapm.hash_map near.account_id (u64 * u32))) =
!\($'$"&!state.4"')
!\\(account_id, $'"let result = !account_map.get(&$0).and_then(|alias| { //"') : ()
!\($'" !alias_map //"') : ()
!\($'" .get(alias) //"') : ()
!\($'" .map(|accounts| { //"') : ()
!\($'" let result = (alias.clone(), *accounts.get(&!account_id).unwrap()); //"') : ()
!\($'" (result.0, result.1.0, result.1.1) //"') : ()
!\($'" }) //"') : ()
!\($'"}); //"') : ()
inl result = !\($'"result"')
trace Debug
fun () => "chat_contract.get_account_info"
fun () => { account_id result }
trace Debug (fun () => "") id
result
main¶
In [ ]:
///! _
inl main () =
!\($'"} //"') : ()
!\($'"#[near_sdk::near_bindgen] //"') : ()
!\($'"#[derive( //"') : ()
!\($'" near_sdk::PanicOnDefault, //"') : ()
!\($'" borsh::BorshDeserialize, //"') : ()
!\($'" borsh::BorshSerialize, //"') : ()
!\($'")] //"') : ()
!\($'"pub struct State ( //"') : ()
!\($'"/*"') : ()
(null () : rust.type_emit state) |> ignore
!\($'"*/ )"') : ()
inl new_ () =
!\($'"#[init] //"') : ()
!\($'"pub fn new() -> Self { // 1"') : ()
(!\($'"true; /*"') : bool) |> ignore
(null () : rust.type_emit ()) |> ignore
(!\($'"true; */"') : bool) |> ignore
inl result = new ()
$'let _result = !result in _result |> (fun x -> Fable.Core.RustInterop.emitRustExpr x $"Self($0) // x") // 2' : ()
!\($'"} // 2."') : ()
!\($'"} // 1."') : ()
2
inl is_valid_alias () =
!\($'"fn is_valid_alias(alias: String) -> bool { //"') : ()
inl alias = !\($'$"alias"')
inl result = alias |> is_valid_alias
$'let _result = !result in _result |> (fun x -> Fable.Core.RustInterop.emitRustExpr x "$0 }") // 2' : ()
!\($'"} //"') : ()
1
inl generate_cid () =
!\($'"pub fn generate_cid( //"') : ()
!\($'" &self, //"') : ()
!\($'" content: Vec<u8>, //"') : ()
!\($'") -> String { //"') : ()
inl content = !\($'$"content"')
inl result = generate_cid content
$'let _result = !result in _result |> (fun x -> Fable.Core.RustInterop.emitRustExpr x "$0 }") // 2' : ()
!\($'"} //"') : ()
2
inl generate_cid_borsh () =
!\($'"#[result_serializer(borsh)] //"') : ()
!\($'"pub fn generate_cid_borsh( //"') : ()
!\($'" &self, //"') : ()
!\($'" #[serializer(borsh)] content: Vec<u8>, //"') : ()
!\($'") -> String { //"') : ()
!\($'" self.generate_cid(content) //"') : ()
!\($'"} //"') : ()
1
inl claim_alias () =
!\($'"pub fn claim_alias( //"') : ()
!\($'" &mut self, //"') : ()
!\($'" alias: String, //"') : ()
!\($'") { //"') : ()
inl state = !\($'$"&mut self.0"')
inl alias = !\($'$"alias"')
inl result = claim_alias state alias
trace Debug (fun () => "") (join id)
!\($'"} //"') : ()
!\($'"} //"') : ()
!\($'"} //"') : ()
3
inl get_account_info () =
!\($'"pub fn get_account_info( //"') : ()
!\($'" &self, //"') : ()
!\($'" account_id: near_sdk::AccountId, //"') : ()
!\($'") -> Option<(String, u64, u32)> { //"') : ()
inl state = !\($'$"&self.0"')
inl account_id : near.account_id = !\($'$"account_id"')
inl result = account_id |> get_account_info state
$'let _result = !result in _result |> (fun x -> Fable.Core.RustInterop.emitRustExpr x "$0 } // 4") // 3' : ()
!\($'"} // 2"') : ()
!\($'"} // 1"') : ()
2
inl get_alias_map () =
!\($'"pub fn get_alias_map( //"') : ()
!\($'" &self, //"') : ()
!\($'" alias: String, //"') : ()
!\($'") -> Option<std::collections::HashMap<near_sdk::AccountId, (u64, u32)>> { //"') : ()
inl alias_map : rust.ref (near.lookup_map sm'.std_string (mapm.hash_map near.account_id (u64 * u32))) =
!\($'$"&self.0.4"')
inl alias : sm'.std_string = !\($'$"alias"')
trace Debug
fun () => "chat_contract.get_alias_map"
fun () => { alias }
trace Debug (fun () => "") (join id)
!\\(alias, $'" !alias_map.get(&$0).cloned() //"') : ()
!\($'"} //"') : ()
!\($'"} //"') : ()
2
inl get_alias_map_borsh () =
!\($'"#[result_serializer(borsh)] //"') : ()
!\($'"pub fn get_alias_map_borsh( //"') : ()
!\($'" &self, //"') : ()
!\($'" #[serializer(borsh)] alias: String, //"') : ()
!\($'") -> Option<std::collections::HashMap<near_sdk::AccountId, (u64, u32)>> { //"') : ()
!\($'" self.get_alias_map(alias) //"') : ()
!\($'"} //"') : ()
1
inl fns =
[
new_
is_valid_alias
generate_cid
generate_cid_borsh
claim_alias
get_account_info
get_alias_map
get_alias_map_borsh
]
inl rec loop acc fns i =
match fns with
| [] => acc
| x :: xs =>
!\($'"#[near_sdk::near_bindgen] //"') : ()
!\($'"impl State { //"') : ()
inl n = x ()
!\($'"} /* c"') : ()
inl rec loop' i' =
if i' <> 1 // <= n
then (!\($'"true; */ // ???? / i: !i / i\': !i' / acc: !acc / n: !n"') : bool) |> ignore
else
(!\($'"true; // ??? / i: !i / i\': !i' / acc: !acc / n: !n"') : bool) |> ignore
loop' (i' + 1)
loop' 1u8
loop (acc + n) xs (i + 1)
inl n = loop 0u8 fns 1u8
// !\($'"/* a"') : ()
// !\($'"} // b"') : ()
!\($'"fn _main() //"') : ()
!\($'"{ { //"') : ()
inl rec loop' i' =
if i' <= n
then
(!\($'"true; { (); // ?? / i\': !i' / n: !n"') : bool) |> ignore
loop' (i' + 1)
else
(!\($'"true; { { (); // ? / i\': !i' / n: !n"') : bool) |> ignore
// (!\($'"true; */ // ?? / i\': !i' / n: !n"') : bool) |> ignore
loop' 1u8
inl main () =
$'!main |> ignore' : ()