Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: typescript types #13

Merged
merged 2 commits into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
##### with npm

```bash
npm i mina-singer-wasm
npm i @chainsafe/mina-signer-wasm
```
##### with yarn
```bash
yarn add mina-singer-wasm
yarn add @chainsafe/mina-signer-wasm
```

## Initialization
Expand Down
2 changes: 1 addition & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::io::Write;

#[wasm_bindgen(typescript_custom_section)]
const CLIENT_OPTIONS: &'static str = r#"
interface ClientOptions {
export interface ClientOptions {
network: "mainnet" | "testnet";
}
"#;
Expand Down
6 changes: 3 additions & 3 deletions src/keypair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use mina_signer::PubKey;

#[wasm_bindgen(typescript_custom_section)]
const KEYPAIR: &'static str = r#"
type PublicKey = string;
export type PublicKey = string;

type PrivateKey = string;
export type PrivateKey = string;

interface Keypair {
export interface Keypair {
privateKey: PrivateKey;
publicKey: PublicKey;
}
Expand Down
2 changes: 1 addition & 1 deletion src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use mina_signer::NetworkId;

#[wasm_bindgen(typescript_custom_section)]
const MESSAGE: &'static str = r#"
interface Message {
export interface Message {
publicKey: PublicKey;
message: string;
}
Expand Down
2 changes: 1 addition & 1 deletion src/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use num_traits::identities::One;

#[wasm_bindgen(typescript_custom_section)]
const PAYMENT: &'static str = r#"
interface Payment {
export interface Payment {
to: PublicKey;
from: PublicKey;
fee: UInt64;
Expand Down
4 changes: 2 additions & 2 deletions src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use num_traits::Num;

#[wasm_bindgen(typescript_custom_section)]
const SIGNATURE: &'static str = r#"
interface Signature {
export interface Signature {
field: string;
scalar: string;
}

interface Signed<SignableData> {
export interface Signed<SignableData> {
signature: Signature;
data: SignableData;
}
Expand Down
2 changes: 1 addition & 1 deletion src/stake_delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use num_traits::identities::One;

#[wasm_bindgen(typescript_custom_section)]
const STAKE_DELEGATION: &'static str = r#"
interface StakeDelegation {
export interface StakeDelegation {
to: PublicKey;
from: PublicKey;
fee: UInt64;
Expand Down
4 changes: 2 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use wasm_bindgen::JsError;

#[wasm_bindgen(typescript_custom_section)]
const UNITS: &'static str = r#"
type UInt32 = number | bigint | string;
export type UInt32 = number | bigint | string;

type UInt64 = number | bigint | string;
export type UInt64 = number | bigint | string;
"#;

pub(crate) fn map_js_err<T: Display>(err: T) -> JsError {
Expand Down