From 7d3f671c3d14c6a4c2007fc1474bd4aad864345d Mon Sep 17 00:00:00 2001 From: Jack May Date: Wed, 23 Jan 2019 16:14:11 -0800 Subject: [PATCH] fix: update example to new sdk api (#146) --- web3.js/examples/bpf-c-noop/src/noop.c | 23 --------------------- web3.js/examples/bpf-c-noop/src/noop/noop.c | 19 +++++++++++++++++ web3.js/package.json | 2 +- 3 files changed, 20 insertions(+), 24 deletions(-) delete mode 100644 web3.js/examples/bpf-c-noop/src/noop.c create mode 100644 web3.js/examples/bpf-c-noop/src/noop/noop.c diff --git a/web3.js/examples/bpf-c-noop/src/noop.c b/web3.js/examples/bpf-c-noop/src/noop.c deleted file mode 100644 index 6d7e40d082bb33..00000000000000 --- a/web3.js/examples/bpf-c-noop/src/noop.c +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @brief Example C-based BPF program that prints out the parameters - * passed to it - */ - -#include - -extern bool entrypoint(const uint8_t *input) { - SolKeyedAccount ka[1]; - uint64_t ka_len; - const uint8_t *data; - uint64_t data_len; - SolClusterInfo info; - - sol_log("Hello World"); - - if (!sol_deserialize(input, ka, SOL_ARRAY_SIZE(ka), &ka_len, &data, &data_len, &info)) { - return false; - } - sol_log_64(info.tick_height, 0, 0, 0, 0); - sol_log_params(ka, ka_len, data, data_len); - return true; -} diff --git a/web3.js/examples/bpf-c-noop/src/noop/noop.c b/web3.js/examples/bpf-c-noop/src/noop/noop.c new file mode 100644 index 00000000000000..b0f1fa788670c0 --- /dev/null +++ b/web3.js/examples/bpf-c-noop/src/noop/noop.c @@ -0,0 +1,19 @@ +/** + * @brief Example C-based BPF program that prints out the parameters + * passed to it + */ + +#include + +extern bool entrypoint(const uint8_t *input) { + SolKeyedAccount ka[1]; + SolParameters params = (SolParameters) { .ka = ka }; + + sol_log("Hello World"); + + if (!sol_deserialize(input, ¶ms, SOL_ARRAY_SIZE(ka))) { + return false; + } + sol_log_params(¶ms); + return true; +} diff --git a/web3.js/package.json b/web3.js/package.json index f42196792720b7..c76e1796b52b81 100644 --- a/web3.js/package.json +++ b/web3.js/package.json @@ -24,7 +24,7 @@ "bin": { "solana-localnet": "bin/localnet.sh" }, - "testnetDefaultChannel": "beta", + "testnetDefaultChannel": "edge", "files": [ "/bin", "/doc",