fix: renamed the internal wasm_bindgen init function to avoid collision

This commit is contained in:
Russell Wong 2022-03-10 18:58:22 +08:00 committed by Michael Vines
parent 35d1235ed0
commit 7b238b3645
6 changed files with 10 additions and 10 deletions

View File

@ -11,4 +11,4 @@
"pretty:fix": "prettier --write 'tests/*.mjs'", "pretty:fix": "prettier --write 'tests/*.mjs'",
"test": "mocha 'tests/*.mjs'" "test": "mocha 'tests/*.mjs'"
} }
} }

View File

@ -9,7 +9,7 @@ pub mod system_instruction;
/// Initialize Javascript logging and panic handler /// Initialize Javascript logging and panic handler
#[wasm_bindgen] #[wasm_bindgen]
pub fn init() { pub fn solana_program_init() {
use std::sync::Once; use std::sync::Once;
static INIT: Once = Once::new(); static INIT: Once = Once::new();

View File

@ -1,6 +1,6 @@
import { expect } from "chai"; import { expect } from "chai";
import { init, Hash } from "crate"; import { solana_program_init, Hash } from "crate";
init(); solana_program_init();
// TODO: wasm_bindgen doesn't currently support exporting constants // TODO: wasm_bindgen doesn't currently support exporting constants
const HASH_BYTES = 32; const HASH_BYTES = 32;

View File

@ -1,6 +1,6 @@
import { expect } from "chai"; import { expect } from "chai";
import { init, Pubkey } from "crate"; import { solana_program_init, Pubkey } from "crate";
init(); solana_program_init();
// TODO: wasm_bindgen doesn't currently support exporting constants // TODO: wasm_bindgen doesn't currently support exporting constants
const MAX_SEED_LEN = 32; const MAX_SEED_LEN = 32;

View File

@ -1,6 +1,6 @@
import { expect } from "chai"; import { expect } from "chai";
import { init, Keypair } from "crate"; import { solana_program_init, Keypair } from "crate";
init(); solana_program_init();
describe("Keypair", function () { describe("Keypair", function () {
it("works", () => { it("works", () => {

View File

@ -1,6 +1,6 @@
import { expect } from "chai"; import { expect } from "chai";
import { import {
init, solana_program_init,
Pubkey, Pubkey,
Keypair, Keypair,
Hash, Hash,
@ -8,7 +8,7 @@ import {
Instructions, Instructions,
Transaction, Transaction,
} from "crate"; } from "crate";
init(); solana_program_init();
describe("Transaction", function () { describe("Transaction", function () {
it("SystemInstruction::Transfer", () => { it("SystemInstruction::Transfer", () => {