ci: docker_tag=ext - Ajouter build WebAssembly dans le workflow CI
Some checks failed
Build and Push Docker image (ext) / docker (push) Failing after 38s

This commit is contained in:
4NK CI Bot 2025-09-21 09:43:09 +00:00
parent 4c3328b3db
commit 2bfee359e0
6 changed files with 657 additions and 352 deletions

View File

@ -37,6 +37,17 @@ jobs:
ssh-private-key: | ssh-private-key: |
${{ secrets.SSH_PRIVATE_KEY }} ${{ secrets.SSH_PRIVATE_KEY }}
- name: Build WebAssembly
run: |
set -euo pipefail
# Install Rust and wasm-pack
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source ~/.cargo/env
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# Build the WebAssembly package
npm run build_wasm
- name: Extract docker tag from commit message (optional) - name: Extract docker tag from commit message (optional)
id: tag id: tag
run: | run: |

View File

@ -1,7 +1,7 @@
{ {
"name": "sdk_client", "name": "sdk_client",
"type": "module", "type": "module",
"version": "0.1.0", "version": "0.1.3",
"files": [ "files": [
"sdk_client_bg.wasm", "sdk_client_bg.wasm",
"sdk_client.js", "sdk_client.js",

145
pkg/sdk_client.d.ts vendored
View File

@ -6,14 +6,11 @@ export function get_member(): Member;
export function restore_device(device: any): void; export function restore_device(device: any): void;
export function create_device_from_sp_wallet(sp_wallet: string): string; export function create_device_from_sp_wallet(sp_wallet: string): string;
export function create_new_device(birthday: number, network_str: string): string; export function create_new_device(birthday: number, network_str: string): string;
export function scan_blocks(tip_height: number, blindbit_url: string): Promise<void>;
export function is_paired(): boolean; export function is_paired(): boolean;
export function pair_device(process_id: string, sp_addresses: string[]): void; export function pair_device(process_id: string, sp_addresses: string[]): void;
export function unpair_device(): void; export function unpair_device(): void;
export function dump_wallet(): string; export function dump_wallet(): string;
export function reset_process_cache(): void;
export function dump_process_cache(): string;
export function set_process_cache(processes: any): void;
export function add_to_process_cache(process_id: string, process: string): void;
export function reset_shared_secrets(): void; export function reset_shared_secrets(): void;
export function set_shared_secrets(secrets: string): void; export function set_shared_secrets(secrets: string): void;
export function get_pairing_process_id(): string; export function get_pairing_process_id(): string;
@ -21,8 +18,11 @@ export function dump_device(): Device;
export function dump_neutered_device(): Device; export function dump_neutered_device(): Device;
export function reset_device(): void; export function reset_device(): void;
export function get_txid(transaction: string): string; export function get_txid(transaction: string): string;
export function get_prevouts(transaction: string): string[];
export function get_opreturn(transaction: string): string;
export function process_commit_new_state(process: Process, state_id: string, new_tip: string): Process;
export function parse_new_tx(new_tx_msg: string, block_height: number, members_list: OutPointMemberMap): ApiReturn; export function parse_new_tx(new_tx_msg: string, block_height: number, members_list: OutPointMemberMap): ApiReturn;
export function parse_cipher(cipher_msg: string, members_list: OutPointMemberMap): ApiReturn; export function parse_cipher(cipher_msg: string, members_list: OutPointMemberMap, processes: OutPointProcessMap): ApiReturn;
export function get_outputs(): any; export function get_outputs(): any;
export function get_available_amount(): bigint; export function get_available_amount(): bigint;
/** /**
@ -50,15 +50,15 @@ export function decode_value(value: Uint8Array): any;
export function hash_value(value: any, commited_in: string, label: string): string; export function hash_value(value: any, commited_in: string, label: string): string;
/** /**
* Generate a merkle proof for a specific attribute in a process state. * Generate a merkle proof for a specific attribute in a process state.
* *
* This function creates a merkle proof that proves the existence of a specific attribute * This function creates a merkle proof that proves the existence of a specific attribute
* in a given state of a process. The proof can be used to verify that the attribute * in a given state of a process. The proof can be used to verify that the attribute
* was indeed part of the state without revealing the entire state. * was indeed part of the state without revealing the entire state.
* *
* # Arguments * # Arguments
* * `process_state` - The process state object as a JavaScript value * * `process_state` - The process state object as a JavaScript value
* * `attribute_name` - The name of the attribute to generate a proof for * * `attribute_name` - The name of the attribute to generate a proof for
* *
* # Returns * # Returns
* A MerkleProofResult object containing: * A MerkleProofResult object containing:
* * `proof` - The merkle proof as a hex string * * `proof` - The merkle proof as a hex string
@ -66,7 +66,7 @@ export function hash_value(value: any, commited_in: string, label: string): stri
* * `attribute` - The attribute name that was proven * * `attribute` - The attribute name that was proven
* * `attribute_index` - The index of the attribute in the merkle tree * * `attribute_index` - The index of the attribute in the merkle tree
* * `total_leaves_count` - The total number of leaves in the merkle tree * * `total_leaves_count` - The total number of leaves in the merkle tree
* *
* # Errors * # Errors
* * "Failed to deserialize process state" - If the process state cannot be deserialized from JsValue * * "Failed to deserialize process state" - If the process state cannot be deserialized from JsValue
* * "Attribute not found in state" - If the attribute doesn't exist in the state * * "Attribute not found in state" - If the attribute doesn't exist in the state
@ -74,18 +74,18 @@ export function hash_value(value: any, commited_in: string, label: string): stri
export function get_merkle_proof(process_state: any, attribute_name: string): MerkleProofResult; export function get_merkle_proof(process_state: any, attribute_name: string): MerkleProofResult;
/** /**
* Validate a merkle proof for a specific attribute. * Validate a merkle proof for a specific attribute.
* *
* This function verifies that a merkle proof is valid and proves the existence * This function verifies that a merkle proof is valid and proves the existence
* of a specific attribute in a given state. It checks that the proof correctly * of a specific attribute in a given state. It checks that the proof correctly
* leads to the claimed root when combined with the attribute hash. * leads to the claimed root when combined with the attribute hash.
* *
* # Arguments * # Arguments
* * `proof_result` - a JsValue expected to contain a MerkleProofResult with the proof and metadata * * `proof_result` - a JsValue expected to contain a MerkleProofResult with the proof and metadata
* * `hash` - The hash of the attribute data as a hex string (the leaf value) * * `hash` - The hash of the attribute data as a hex string (the leaf value)
* *
* # Returns * # Returns
* A boolean indicating whether the proof is valid * A boolean indicating whether the proof is valid
* *
* # Errors * # Errors
* * "serde_wasm_bindgen deserialization error" - If the proof is not a valid MerkleProofResult * * "serde_wasm_bindgen deserialization error" - If the proof is not a valid MerkleProofResult
* * "Invalid proof format" - If the proof cannot be parsed * * "Invalid proof format" - If the proof cannot be parsed
@ -105,6 +105,7 @@ export interface UserDiff {
notify_user: boolean; notify_user: boolean;
need_validation: boolean; need_validation: boolean;
validation_status: DiffStatus; validation_status: DiffStatus;
storages: string[];
} }
export interface UpdatedProcess { export interface UpdatedProcess {
@ -138,14 +139,73 @@ export interface MerkleProofResult {
total_leaves_count: number; total_leaves_count: number;
} }
export interface Prd {
prd_type: PrdType;
process_id: OutPoint;
sender: OutPoint | null;
keys: Record<string, number[]>;
pcd_commitments: PcdCommitments;
validation_tokens: Proof[];
roles: Roles;
public_data: Pcd;
payload: string;
proof: Proof | null;
}
export type PrdType = "None" | "Connect" | "Message" | "Update" | "List" | "Response" | "Confirm" | "TxProposal" | "Request";
export interface Device { export interface Device {
sp_wallet: SpWallet; sp_wallet: SpWallet;
pairing_process_commitment: OutPoint | null; pairing_process_commitment: OutPoint | null;
paired_member: Member; paired_member: Member;
} }
export type OutPointProcessMap = Record<OutPoint, Process>;
export type OutPointMemberMap = Record<OutPoint, Member>;
export interface HandshakeMessage {
sp_address: string;
peers_list: OutPointMemberMap;
processes_list: OutPointProcessMap;
chain_tip: number;
}
export interface NewTxMessage {
transaction: string;
tweak_data: string | null;
error: AnkError | null;
}
export interface FaucetMessage {
sp_address: string;
commitment: string;
error: AnkError | null;
}
/**
* Message sent to the server to commit some state in a transaction
* Client must first send a commit message with empty validation_tokens
* Relay will ignore a commit message for an update he\'s not aware of that also bears validation_tokens
*/
export interface CommitMessage {
process_id: OutPoint;
pcd_commitment: PcdCommitments;
roles: Roles;
public_data: Pcd;
validation_tokens: Proof[];
error: AnkError | null;
}
export type AnkFlag = "NewTx" | "Faucet" | "Cipher" | "Commit" | "Handshake" | "Sync" | "Unknown";
export type TsUnsignedTransaction = SilentPaymentUnsignedTransaction; export type TsUnsignedTransaction = SilentPaymentUnsignedTransaction;
export interface SecretsStore {
shared_secrets: Record<SilentPaymentAddress, AnkSharedSecretHash>;
unconfirmed_secrets: AnkSharedSecretHash[];
}
/** /**
* A process is basically a succession of states * A process is basically a succession of states
* The latest state MUST be an empty state with only the commited_in field set at the last unspent outpoint * The latest state MUST be an empty state with only the commited_in field set at the last unspent outpoint
@ -187,62 +247,3 @@ export interface Member {
sp_addresses: string[]; sp_addresses: string[];
} }
export type OutPointProcessMap = Record<OutPoint, Process>;
export type OutPointMemberMap = Record<OutPoint, Member>;
export interface SecretsStore {
shared_secrets: Record<SilentPaymentAddress, AnkSharedSecretHash>;
unconfirmed_secrets: AnkSharedSecretHash[];
}
export interface Prd {
prd_type: PrdType;
process_id: OutPoint;
sender: Member;
keys: Record<string, number[]>;
pcd_commitments: PcdCommitments;
validation_tokens: Proof[];
roles: Roles;
public_data: Pcd;
payload: string;
proof: Proof | null;
}
export type PrdType = "None" | "Connect" | "Message" | "Update" | "List" | "Response" | "Confirm" | "TxProposal" | "Request";
export interface HandshakeMessage {
sp_address: string;
peers_list: OutPointMemberMap;
processes_list: OutPointProcessMap;
chain_tip: number;
}
export interface NewTxMessage {
transaction: string;
tweak_data: string | null;
error: AnkError | null;
}
export interface FaucetMessage {
sp_address: string;
commitment: string;
error: AnkError | null;
}
/**
* Message sent to the server to commit some state in a transaction
* Client must first send a commit message with empty validation_tokens
* Relay will ignore a commit message for an update he\'s not aware of that also bears validation_tokens
*/
export interface CommitMessage {
process_id: OutPoint;
pcd_commitment: PcdCommitments;
roles: Roles;
public_data: Pcd;
validation_tokens: Proof[];
error: AnkError | null;
}
export type AnkFlag = "NewTx" | "Faucet" | "Cipher" | "Commit" | "Handshake" | "Sync" | "Unknown";

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -7,14 +7,11 @@ export const get_member: () => [number, number, number];
export const restore_device: (a: any) => [number, number]; export const restore_device: (a: any) => [number, number];
export const create_device_from_sp_wallet: (a: number, b: number) => [number, number, number, number]; export const create_device_from_sp_wallet: (a: number, b: number) => [number, number, number, number];
export const create_new_device: (a: number, b: number, c: number) => [number, number, number, number]; export const create_new_device: (a: number, b: number, c: number) => [number, number, number, number];
export const scan_blocks: (a: number, b: number, c: number) => any;
export const is_paired: () => [number, number, number]; export const is_paired: () => [number, number, number];
export const pair_device: (a: number, b: number, c: number, d: number) => [number, number]; export const pair_device: (a: number, b: number, c: number, d: number) => [number, number];
export const unpair_device: () => [number, number]; export const unpair_device: () => [number, number];
export const dump_wallet: () => [number, number, number, number]; export const dump_wallet: () => [number, number, number, number];
export const reset_process_cache: () => [number, number];
export const dump_process_cache: () => [number, number, number, number];
export const set_process_cache: (a: any) => [number, number];
export const add_to_process_cache: (a: number, b: number, c: number, d: number) => [number, number];
export const reset_shared_secrets: () => [number, number]; export const reset_shared_secrets: () => [number, number];
export const set_shared_secrets: (a: number, b: number) => [number, number]; export const set_shared_secrets: (a: number, b: number) => [number, number];
export const get_pairing_process_id: () => [number, number, number, number]; export const get_pairing_process_id: () => [number, number, number, number];
@ -22,8 +19,11 @@ export const dump_device: () => [number, number, number];
export const dump_neutered_device: () => [number, number, number]; export const dump_neutered_device: () => [number, number, number];
export const reset_device: () => [number, number]; export const reset_device: () => [number, number];
export const get_txid: (a: number, b: number) => [number, number, number, number]; export const get_txid: (a: number, b: number) => [number, number, number, number];
export const get_prevouts: (a: number, b: number) => [number, number, number, number];
export const get_opreturn: (a: number, b: number) => [number, number, number, number];
export const process_commit_new_state: (a: any, b: number, c: number, d: number, e: number) => [number, number, number];
export const parse_new_tx: (a: number, b: number, c: number, d: any) => [number, number, number]; export const parse_new_tx: (a: number, b: number, c: number, d: any) => [number, number, number];
export const parse_cipher: (a: number, b: number, c: any) => [number, number, number]; export const parse_cipher: (a: number, b: number, c: any, d: any) => [number, number, number];
export const get_outputs: () => [number, number, number]; export const get_outputs: () => [number, number, number];
export const get_available_amount: () => [bigint, number, number]; export const get_available_amount: () => [bigint, number, number];
export const create_transaction: (a: number, b: number, c: number) => [number, number, number]; export const create_transaction: (a: number, b: number, c: number) => [number, number, number];
@ -63,7 +63,11 @@ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) =>
export const __wbindgen_exn_store: (a: number) => void; export const __wbindgen_exn_store: (a: number) => void;
export const __externref_table_alloc: () => number; export const __externref_table_alloc: () => number;
export const __wbindgen_export_4: WebAssembly.Table; export const __wbindgen_export_4: WebAssembly.Table;
export const __wbindgen_export_5: WebAssembly.Table;
export const __externref_table_dealloc: (a: number) => void; export const __externref_table_dealloc: (a: number) => void;
export const __wbindgen_free: (a: number, b: number, c: number) => void; export const __wbindgen_free: (a: number, b: number, c: number) => void;
export const __externref_drop_slice: (a: number, b: number) => void; export const __externref_drop_slice: (a: number, b: number) => void;
export const closure681_externref_shim: (a: number, b: number, c: any) => void;
export const wasm_bindgen__convert__closures_____invoke__hc142e2252e76ee8b: (a: number, b: number) => void;
export const closure1281_externref_shim: (a: number, b: number, c: any, d: any) => void;
export const __wbindgen_start: () => void; export const __wbindgen_start: () => void;