From 26d216082305ade53f075d6e4d73caf707bf77fb Mon Sep 17 00:00:00 2001 From: Rigidity Date: Tue, 25 Feb 2025 00:57:53 -0500 Subject: [PATCH] Split bindings into multiple files --- bindings.json | 1758 --------------------------------- bindings/address.json | 21 + bindings/bls.json | 146 +++ bindings/clvm.json | 351 +++++++ bindings/clvm_types.json | 35 + bindings/coin.json | 41 + bindings/conditions.json | 259 +++++ bindings/mnemonic.json | 45 + bindings/program.json | 169 ++++ bindings/puzzles.json | 130 +++ bindings/secp.json | 124 +++ bindings/simulator.json | 111 +++ bindings/utils.json | 70 ++ bindings/vaults.json | 280 ++++++ crates/bindy-macro/src/lib.rs | 39 +- napi/index.d.ts | 682 ++++++------- napi/index.js | 108 +- 17 files changed, 2204 insertions(+), 2165 deletions(-) create mode 100644 bindings/address.json create mode 100644 bindings/bls.json create mode 100644 bindings/clvm.json create mode 100644 bindings/clvm_types.json create mode 100644 bindings/coin.json create mode 100644 bindings/conditions.json create mode 100644 bindings/mnemonic.json create mode 100644 bindings/program.json create mode 100644 bindings/puzzles.json create mode 100644 bindings/secp.json create mode 100644 bindings/simulator.json create mode 100644 bindings/utils.json create mode 100644 bindings/vaults.json diff --git a/bindings.json b/bindings.json index d2d20c35..df608b32 100644 --- a/bindings.json +++ b/bindings.json @@ -1,1764 +1,6 @@ { "entrypoint": "chia_sdk_bindings", "pymodule": "chia_wallet_sdk", - "bindings": { - "Constants": { - "type": "class", - "methods": { - "default_metadata_updater_hash": { - "type": "static", - "return": "TreeHash" - } - } - }, - "Clvm": { - "type": "class", - "methods": { - "new": { - "type": "constructor" - }, - "add_coin_spend": { - "args": { - "coin_spend": "CoinSpend" - } - }, - "spend_coin": { - "args": { - "coin": "Coin", - "spend": "Spend" - } - }, - "coin_spends": { - "return": "Vec" - }, - "deserialize": { - "args": { - "value": "SerializedProgram" - }, - "return": "Program" - }, - "deserialize_with_backrefs": { - "args": { - "value": "SerializedProgram" - }, - "return": "Program" - }, - "pair": { - "args": { - "first": "Program", - "rest": "Program" - }, - "return": "Program" - }, - "nil": { - "return": "Program" - }, - "string": { - "args": { - "value": "String" - }, - "return": "Program" - }, - "bool": { - "args": { - "value": "bool" - }, - "return": "Program" - }, - "atom": { - "args": { - "value": "Bytes" - }, - "return": "Program" - }, - "list": { - "args": { - "value": "Vec" - }, - "return": "Program" - }, - "delegated_spend": { - "args": { - "conditions": "Vec" - }, - "return": "Spend" - }, - "standard_spend": { - "args": { - "synthetic_key": "PublicKey", - "spend": "Spend" - }, - "return": "Spend" - }, - "spend_standard_coin": { - "args": { - "coin": "Coin", - "synthetic_key": "PublicKey", - "spend": "Spend" - } - }, - "spend_cat_coins": { - "args": { - "cat_spends": "Vec" - } - }, - "mint_nfts": { - "args": { - "parent_coin_id": "Bytes32", - "nft_mints": "Vec" - }, - "return": "MintedNfts" - }, - "spend_nft": { - "args": { - "nft": "Nft", - "inner_spend": "Spend" - } - }, - "mint_vault": { - "args": { - "parent_coin_id": "Bytes32", - "custody_hash": "TreeHash", - "memos": "Program" - }, - "return": "VaultMint" - }, - "mips_spend": { - "args": { - "coin": "Coin", - "delegated_spend": "Spend" - }, - "return": "MipsSpend" - }, - "nft_metadata": { - "args": { - "value": "NftMetadata" - }, - "return": "Program" - }, - "remark": { - "args": { - "rest": "Program" - }, - "return": "Program" - }, - "agg_sig_parent": { - "args": { - "public_key": "PublicKey", - "message": "Bytes" - }, - "return": "Program" - }, - "agg_sig_puzzle": { - "args": { - "public_key": "PublicKey", - "message": "Bytes" - }, - "return": "Program" - }, - "agg_sig_amount": { - "args": { - "public_key": "PublicKey", - "message": "Bytes" - }, - "return": "Program" - }, - "agg_sig_puzzle_amount": { - "args": { - "public_key": "PublicKey", - "message": "Bytes" - }, - "return": "Program" - }, - "agg_sig_parent_amount": { - "args": { - "public_key": "PublicKey", - "message": "Bytes" - }, - "return": "Program" - }, - "agg_sig_parent_puzzle": { - "args": { - "public_key": "PublicKey", - "message": "Bytes" - }, - "return": "Program" - }, - "agg_sig_unsafe": { - "args": { - "public_key": "PublicKey", - "message": "Bytes" - }, - "return": "Program" - }, - "agg_sig_me": { - "args": { - "public_key": "PublicKey", - "message": "Bytes" - }, - "return": "Program" - }, - "create_coin": { - "args": { - "puzzle_hash": "Bytes32", - "amount": "u64", - "memos": "Option" - }, - "return": "Program" - }, - "reserve_fee": { - "args": { - "amount": "u64" - }, - "return": "Program" - }, - "create_coin_announcement": { - "args": { - "message": "Bytes" - }, - "return": "Program" - }, - "create_puzzle_announcement": { - "args": { - "message": "Bytes" - }, - "return": "Program" - }, - "assert_coin_announcement": { - "args": { - "announcement_id": "Bytes32" - }, - "return": "Program" - }, - "assert_puzzle_announcement": { - "args": { - "announcement_id": "Bytes32" - }, - "return": "Program" - }, - "assert_concurrent_spend": { - "args": { - "coin_id": "Bytes32" - }, - "return": "Program" - }, - "assert_concurrent_puzzle": { - "args": { - "puzzle_hash": "Bytes32" - }, - "return": "Program" - }, - "assert_seconds_relative": { - "args": { - "seconds": "u64" - }, - "return": "Program" - }, - "assert_seconds_absolute": { - "args": { - "seconds": "u64" - }, - "return": "Program" - }, - "assert_height_relative": { - "args": { - "height": "u32" - }, - "return": "Program" - }, - "assert_height_absolute": { - "args": { - "height": "u32" - }, - "return": "Program" - }, - "assert_before_seconds_relative": { - "args": { - "seconds": "u64" - }, - "return": "Program" - }, - "assert_before_seconds_absolute": { - "args": { - "seconds": "u64" - }, - "return": "Program" - }, - "assert_before_height_relative": { - "args": { - "height": "u32" - }, - "return": "Program" - }, - "assert_before_height_absolute": { - "args": { - "height": "u32" - }, - "return": "Program" - }, - "assert_my_coin_id": { - "args": { - "coin_id": "Bytes32" - }, - "return": "Program" - }, - "assert_my_parent_id": { - "args": { - "parent_id": "Bytes32" - }, - "return": "Program" - }, - "assert_my_puzzle_hash": { - "args": { - "puzzle_hash": "Bytes32" - }, - "return": "Program" - }, - "assert_my_amount": { - "args": { - "amount": "u64" - }, - "return": "Program" - }, - "assert_my_birth_seconds": { - "args": { - "seconds": "u64" - }, - "return": "Program" - }, - "assert_my_birth_height": { - "args": { - "height": "u32" - }, - "return": "Program" - }, - "assert_ephemeral": { - "return": "Program" - }, - "send_message": { - "args": { - "mode": "u8", - "message": "Bytes", - "data": "Vec" - }, - "return": "Program" - }, - "receive_message": { - "args": { - "mode": "u8", - "message": "Bytes", - "data": "Vec" - }, - "return": "Program" - }, - "softfork": { - "args": { - "cost": "u64", - "rest": "Program" - }, - "return": "Program" - } - } - }, - "Program": { - "type": "class", - "methods": { - "serialize": { - "return": "SerializedProgram" - }, - "serialize_with_backrefs": { - "return": "SerializedProgram" - }, - "run": { - "args": { - "solution": "Program", - "max_cost": "u64", - "mempool_mode": "bool" - }, - "return": "Output" - }, - "curry": { - "args": { - "args": "Vec" - }, - "return": "Program" - }, - "uncurry": { - "return": "Option" - }, - "tree_hash": { - "return": "TreeHash" - }, - "length": { - "return": "u32" - }, - "first": { - "return": "Program" - }, - "rest": { - "return": "Program" - }, - "to_string": { - "type": "to_string", - "return": "Option" - }, - "to_bool": { - "return": "Option" - }, - "to_atom": { - "return": "Option" - }, - "to_list": { - "return": "Option>" - }, - "to_pair": { - "return": "Option" - }, - "puzzle": { - "return": "Puzzle" - }, - "parse_nft_metadata": { - "return": "Option" - }, - "parse_remark": { - "return": "Option" - }, - "parse_agg_sig_parent": { - "return": "Option" - }, - "parse_agg_sig_puzzle": { - "return": "Option" - }, - "parse_agg_sig_amount": { - "return": "Option" - }, - "parse_agg_sig_puzzle_amount": { - "return": "Option" - }, - "parse_agg_sig_parent_amount": { - "return": "Option" - }, - "parse_agg_sig_parent_puzzle": { - "return": "Option" - }, - "parse_agg_sig_unsafe": { - "return": "Option" - }, - "parse_agg_sig_me": { - "return": "Option" - }, - "parse_create_coin": { - "return": "Option" - }, - "parse_reserve_fee": { - "return": "Option" - }, - "parse_create_coin_announcement": { - "return": "Option" - }, - "parse_create_puzzle_announcement": { - "return": "Option" - }, - "parse_assert_coin_announcement": { - "return": "Option" - }, - "parse_assert_puzzle_announcement": { - "return": "Option" - }, - "parse_assert_concurrent_spend": { - "return": "Option" - }, - "parse_assert_concurrent_puzzle": { - "return": "Option" - }, - "parse_assert_seconds_relative": { - "return": "Option" - }, - "parse_assert_seconds_absolute": { - "return": "Option" - }, - "parse_assert_height_relative": { - "return": "Option" - }, - "parse_assert_height_absolute": { - "return": "Option" - }, - "parse_assert_before_seconds_relative": { - "return": "Option" - }, - "parse_assert_before_seconds_absolute": { - "return": "Option" - }, - "parse_assert_before_height_relative": { - "return": "Option" - }, - "parse_assert_before_height_absolute": { - "return": "Option" - }, - "parse_assert_my_coin_id": { - "return": "Option" - }, - "parse_assert_my_parent_id": { - "return": "Option" - }, - "parse_assert_my_puzzle_hash": { - "return": "Option" - }, - "parse_assert_my_amount": { - "return": "Option" - }, - "parse_assert_my_birth_seconds": { - "return": "Option" - }, - "parse_assert_my_birth_height": { - "return": "Option" - }, - "parse_assert_ephemeral": { - "return": "Option" - }, - "parse_send_message": { - "return": "Option" - }, - "parse_receive_message": { - "return": "Option" - }, - "parse_softfork": { - "return": "Option" - } - } - }, - "Puzzle": { - "type": "class", - "new": true, - "fields": { - "puzzle_hash": "Bytes32", - "program": "Program", - "mod_hash": "Bytes32", - "args": "Option" - }, - "methods": { - "parse_nft": { - "return": "Option" - }, - "parse_child_nft": { - "args": { - "parent_coin": "Coin", - "parent_puzzle": "Program", - "parent_solution": "Program" - }, - "return": "Option" - } - } - }, - "Simulator": { - "type": "class", - "methods": { - "new": { - "type": "constructor" - }, - "new_coin": { - "args": { - "puzzle_hash": "Bytes32", - "amount": "u64" - }, - "return": "Coin" - }, - "bls": { - "args": { - "amount": "u64" - }, - "return": "BlsPairWithCoin" - }, - "spend_coins": { - "args": { - "coin_spends": "Vec", - "secret_keys": "Vec" - } - } - } - }, - "Output": { - "type": "class", - "new": true, - "fields": { - "value": "Program", - "cost": "u64" - } - }, - "Pair": { - "type": "class", - "new": true, - "fields": { - "first": "Program", - "rest": "Program" - } - }, - "CurriedProgram": { - "type": "class", - "new": true, - "fields": { - "program": "Program", - "args": "Vec" - } - }, - "Address": { - "type": "class", - "new": true, - "fields": { - "puzzle_hash": "Bytes32", - "prefix": "String" - }, - "methods": { - "encode": { - "return": "String" - }, - "decode": { - "type": "factory", - "args": { - "address": "String" - } - } - } - }, - "Mnemonic": { - "type": "class", - "methods": { - "new": { - "type": "constructor", - "args": { - "mnemonic": "String" - } - }, - "from_entropy": { - "type": "factory", - "args": { - "entropy": "Bytes" - } - }, - "generate": { - "type": "factory", - "args": { - "use_24": "bool" - } - }, - "verify": { - "type": "static", - "args": { - "mnemonic": "String" - }, - "return": "bool" - }, - "to_string": { - "type": "to_string", - "return": "String" - }, - "to_entropy": { - "return": "Bytes" - }, - "to_seed": { - "args": { - "password": "String" - }, - "return": "Bytes" - } - } - }, - "Coin": { - "type": "class", - "new": true, - "fields": { - "parent_coin_info": "Bytes32", - "puzzle_hash": "Bytes32", - "amount": "u64" - }, - "methods": { - "coin_id": { - "return": "Bytes32" - } - } - }, - "CoinSpend": { - "type": "class", - "new": true, - "fields": { - "coin": "Coin", - "puzzle_reveal": "SerializedProgram", - "solution": "SerializedProgram" - } - }, - "SpendBundle": { - "type": "class", - "new": true, - "fields": { - "coin_spends": "Vec", - "aggregated_signature": "Signature" - } - }, - "Spend": { - "type": "class", - "new": true, - "fields": { - "puzzle": "Program", - "solution": "Program" - } - }, - "SecretKey": { - "type": "class", - "methods": { - "from_seed": { - "type": "factory", - "args": { - "seed": "Bytes" - } - }, - "from_bytes": { - "type": "factory", - "args": { - "bytes": "Bytes32" - } - }, - "to_bytes": { - "return": "Bytes32" - }, - "public_key": { - "return": "PublicKey" - }, - "sign": { - "args": { - "message": "Bytes" - }, - "return": "Signature" - }, - "derive_unhardened": { - "args": { - "index": "u32" - }, - "return": "SecretKey" - }, - "derive_hardened": { - "args": { - "index": "u32" - }, - "return": "SecretKey" - }, - "derive_unhardened_path": { - "args": { - "path": "Vec" - }, - "return": "SecretKey" - }, - "derive_hardened_path": { - "args": { - "path": "Vec" - }, - "return": "SecretKey" - }, - "derive_synthetic": { - "return": "SecretKey" - }, - "derive_synthetic_hidden": { - "args": { - "hidden_puzzle_hash": "Bytes32" - }, - "return": "SecretKey" - } - } - }, - "PublicKey": { - "type": "class", - "methods": { - "infinity": { - "type": "factory" - }, - "aggregate": { - "type": "factory", - "args": { - "public_keys": "Vec" - } - }, - "from_bytes": { - "type": "factory", - "args": { - "bytes": "Bytes48" - } - }, - "to_bytes": { - "return": "Bytes48" - }, - "fingerprint": { - "return": "u32" - }, - "is_infinity": { - "return": "bool" - }, - "is_valid": { - "return": "bool" - }, - "derive_unhardened": { - "args": { - "index": "u32" - }, - "return": "PublicKey" - }, - "derive_unhardened_path": { - "args": { - "path": "Vec" - }, - "return": "PublicKey" - }, - "derive_synthetic": { - "return": "PublicKey" - }, - "derive_synthetic_hidden": { - "args": { - "hidden_puzzle_hash": "Bytes32" - }, - "return": "PublicKey" - } - } - }, - "Signature": { - "type": "class", - "methods": { - "infinity": { - "type": "factory" - }, - "aggregate": { - "type": "factory", - "args": { - "signatures": "Vec" - } - }, - "from_bytes": { - "type": "factory", - "args": { - "bytes": "Bytes96" - } - }, - "to_bytes": { - "return": "Bytes96" - }, - "is_infinity": { - "return": "bool" - }, - "is_valid": { - "return": "bool" - } - } - }, - "K1SecretKey": { - "type": "class", - "methods": { - "from_bytes": { - "type": "factory", - "args": { - "bytes": "Bytes32" - } - }, - "to_bytes": { - "return": "Bytes32" - }, - "public_key": { - "return": "K1PublicKey" - }, - "sign_prehashed": { - "args": { - "prehashed": "Bytes32" - }, - "return": "K1Signature" - } - } - }, - "K1PublicKey": { - "type": "class", - "methods": { - "from_bytes": { - "type": "factory", - "args": { - "bytes": "BytesImpl<33>" - } - }, - "to_bytes": { - "return": "BytesImpl<33>" - }, - "fingerprint": { - "return": "u32" - }, - "verify_prehashed": { - "args": { - "prehashed": "Bytes32", - "signature": "K1Signature" - }, - "return": "bool" - } - } - }, - "K1Signature": { - "type": "class", - "methods": { - "from_bytes": { - "type": "factory", - "args": { - "bytes": "BytesImpl<64>" - } - }, - "to_bytes": { - "return": "BytesImpl<64>" - } - } - }, - "R1SecretKey": { - "type": "class", - "methods": { - "from_bytes": { - "type": "factory", - "args": { - "bytes": "Bytes32" - } - }, - "to_bytes": { - "return": "Bytes32" - }, - "public_key": { - "return": "R1PublicKey" - }, - "sign_prehashed": { - "args": { - "prehashed": "Bytes32" - }, - "return": "R1Signature" - } - } - }, - "R1PublicKey": { - "type": "class", - "methods": { - "from_bytes": { - "type": "factory", - "args": { - "bytes": "BytesImpl<33>" - } - }, - "to_bytes": { - "return": "BytesImpl<33>" - }, - "fingerprint": { - "return": "u32" - }, - "verify_prehashed": { - "args": { - "prehashed": "Bytes32", - "signature": "R1Signature" - }, - "return": "bool" - } - } - }, - "R1Signature": { - "type": "class", - "methods": { - "from_bytes": { - "type": "factory", - "args": { - "bytes": "BytesImpl<64>" - } - }, - "to_bytes": { - "return": "BytesImpl<64>" - } - } - }, - "BlsPair": { - "type": "class", - "new": true, - "fields": { - "sk": "SecretKey", - "pk": "PublicKey" - }, - "methods": { - "from_seed": { - "type": "factory", - "args": { - "seed": "u64" - } - }, - "many_from_seed": { - "type": "static", - "args": { - "seed": "u64", - "count": "u32" - }, - "return": "Vec" - } - } - }, - "BlsPairWithCoin": { - "type": "class", - "new": true, - "fields": { - "sk": "SecretKey", - "pk": "PublicKey", - "puzzle_hash": "Bytes32", - "coin": "Coin" - } - }, - "K1Pair": { - "type": "class", - "new": true, - "fields": { - "sk": "K1SecretKey", - "pk": "K1PublicKey" - }, - "methods": { - "from_seed": { - "type": "factory", - "args": { - "seed": "u64" - } - }, - "many_from_seed": { - "type": "static", - "args": { - "seed": "u64", - "count": "u32" - }, - "return": "Vec" - } - } - }, - "R1Pair": { - "type": "class", - "new": true, - "fields": { - "sk": "R1SecretKey", - "pk": "R1PublicKey" - }, - "methods": { - "from_seed": { - "type": "factory", - "args": { - "seed": "u64" - } - }, - "many_from_seed": { - "type": "static", - "args": { - "seed": "u64", - "count": "u32" - }, - "return": "Vec" - } - } - }, - "from_hex": { - "type": "function", - "args": { - "value": "String" - }, - "return": "Bytes" - }, - "to_hex": { - "type": "function", - "args": { - "value": "Bytes" - }, - "return": "String" - }, - "bytes_equal": { - "type": "function", - "args": { - "lhs": "Bytes", - "rhs": "Bytes" - }, - "return": "bool" - }, - "tree_hash_atom": { - "type": "function", - "args": { - "atom": "Bytes32" - }, - "return": "Bytes32" - }, - "tree_hash_pair": { - "type": "function", - "args": { - "first": "Bytes32", - "rest": "Bytes32" - }, - "return": "Bytes32" - }, - "sha256": { - "type": "function", - "args": { - "value": "Bytes" - }, - "return": "Bytes32" - }, - "curry_tree_hash": { - "type": "function", - "args": { - "program": "Bytes32", - "args": "Vec" - }, - "return": "Bytes32" - }, - "generate_bytes": { - "type": "function", - "args": { - "bytes": "u32" - }, - "return": "Bytes" - }, - "LineageProof": { - "type": "class", - "new": true, - "fields": { - "parent_parent_coin_info": "Bytes32", - "parent_inner_puzzle_hash": "Option", - "parent_amount": "u64" - } - }, - "Cat": { - "type": "class", - "new": true, - "fields": { - "coin": "Coin", - "lineage_proof": "Option", - "asset_id": "Bytes32", - "p2_puzzle_hash": "Bytes32" - } - }, - "CatSpend": { - "type": "class", - "new": true, - "fields": { - "cat": "Cat", - "spend": "Spend" - } - }, - "Nft": { - "type": "class", - "new": true, - "fields": { - "coin": "Coin", - "lineage_proof": "LineageProof", - "info": "NftInfo" - } - }, - "NftInfo": { - "type": "class", - "new": true, - "fields": { - "launcher_id": "Bytes32", - "metadata": "Program", - "metadata_updater_puzzle_hash": "Bytes32", - "current_owner": "Option", - "royalty_puzzle_hash": "Bytes32", - "royalty_ten_thousandths": "u16", - "p2_puzzle_hash": "Bytes32" - } - }, - "ParsedNft": { - "type": "class", - "new": true, - "fields": { - "info": "NftInfo", - "p2_puzzle": "Program" - } - }, - "NftMetadata": { - "type": "class", - "new": true, - "fields": { - "edition_number": "u64", - "edition_total": "u64", - "data_uris": "Vec", - "data_hash": "Option", - "metadata_uris": "Vec", - "metadata_hash": "Option", - "license_uris": "Vec", - "license_hash": "Option" - } - }, - "NftMint": { - "type": "class", - "new": true, - "fields": { - "metadata": "Program", - "metadata_updater_puzzle_hash": "Bytes32", - "p2_puzzle_hash": "Bytes32", - "royalty_puzzle_hash": "Bytes32", - "royalty_ten_thousandths": "u16", - "owner": "Option" - } - }, - "DidOwner": { - "type": "class", - "new": true, - "fields": { - "did_id": "Bytes32", - "inner_puzzle_hash": "Bytes32" - } - }, - "MintedNfts": { - "type": "class", - "new": true, - "fields": { - "nfts": "Vec", - "parent_conditions": "Vec" - } - }, - "standard_puzzle_hash": { - "type": "function", - "args": { - "synthetic_key": "PublicKey" - }, - "return": "Bytes32" - }, - "cat_puzzle_hash": { - "type": "function", - "args": { - "asset_id": "Bytes32", - "inner_puzzle_hash": "Bytes32" - }, - "return": "Bytes32" - }, - "Remark": { - "type": "class", - "new": true, - "fields": { - "rest": "Program" - } - }, - "AggSigParent": { - "type": "class", - "new": true, - "fields": { - "public_key": "PublicKey", - "message": "Bytes" - } - }, - "AggSigPuzzle": { - "type": "class", - "new": true, - "fields": { - "public_key": "PublicKey", - "message": "Bytes" - } - }, - "AggSigAmount": { - "type": "class", - "new": true, - "fields": { - "public_key": "PublicKey", - "message": "Bytes" - } - }, - "AggSigPuzzleAmount": { - "type": "class", - "new": true, - "fields": { - "public_key": "PublicKey", - "message": "Bytes" - } - }, - "AggSigParentAmount": { - "type": "class", - "new": true, - "fields": { - "public_key": "PublicKey", - "message": "Bytes" - } - }, - "AggSigParentPuzzle": { - "type": "class", - "new": true, - "fields": { - "public_key": "PublicKey", - "message": "Bytes" - } - }, - "AggSigUnsafe": { - "type": "class", - "new": true, - "fields": { - "public_key": "PublicKey", - "message": "Bytes" - } - }, - "AggSigMe": { - "type": "class", - "new": true, - "fields": { - "public_key": "PublicKey", - "message": "Bytes" - } - }, - "CreateCoin": { - "type": "class", - "new": true, - "fields": { - "puzzle_hash": "Bytes32", - "amount": "u64", - "memos": "Option" - } - }, - "ReserveFee": { - "type": "class", - "new": true, - "fields": { - "amount": "u64" - } - }, - "CreateCoinAnnouncement": { - "type": "class", - "new": true, - "fields": { - "message": "Bytes" - } - }, - "CreatePuzzleAnnouncement": { - "type": "class", - "new": true, - "fields": { - "message": "Bytes" - } - }, - "AssertCoinAnnouncement": { - "type": "class", - "new": true, - "fields": { - "announcement_id": "Bytes32" - } - }, - "AssertPuzzleAnnouncement": { - "type": "class", - "new": true, - "fields": { - "announcement_id": "Bytes32" - } - }, - "AssertConcurrentSpend": { - "type": "class", - "new": true, - "fields": { - "coin_id": "Bytes32" - } - }, - "AssertConcurrentPuzzle": { - "type": "class", - "new": true, - "fields": { - "puzzle_hash": "Bytes32" - } - }, - "AssertSecondsRelative": { - "type": "class", - "new": true, - "fields": { - "seconds": "u64" - } - }, - "AssertSecondsAbsolute": { - "type": "class", - "new": true, - "fields": { - "seconds": "u64" - } - }, - "AssertHeightRelative": { - "type": "class", - "new": true, - "fields": { - "height": "u32" - } - }, - "AssertHeightAbsolute": { - "type": "class", - "new": true, - "fields": { - "height": "u32" - } - }, - "AssertBeforeSecondsRelative": { - "type": "class", - "new": true, - "fields": { - "seconds": "u64" - } - }, - "AssertBeforeSecondsAbsolute": { - "type": "class", - "new": true, - "fields": { - "seconds": "u64" - } - }, - "AssertBeforeHeightRelative": { - "type": "class", - "new": true, - "fields": { - "height": "u32" - } - }, - "AssertBeforeHeightAbsolute": { - "type": "class", - "new": true, - "fields": { - "height": "u32" - } - }, - "AssertMyCoinId": { - "type": "class", - "new": true, - "fields": { - "coin_id": "Bytes32" - } - }, - "AssertMyParentId": { - "type": "class", - "new": true, - "fields": { - "parent_id": "Bytes32" - } - }, - "AssertMyPuzzleHash": { - "type": "class", - "new": true, - "fields": { - "puzzle_hash": "Bytes32" - } - }, - "AssertMyAmount": { - "type": "class", - "new": true, - "fields": { - "amount": "u64" - } - }, - "AssertMyBirthSeconds": { - "type": "class", - "new": true, - "fields": { - "seconds": "u64" - } - }, - "AssertMyBirthHeight": { - "type": "class", - "new": true, - "fields": { - "height": "u32" - } - }, - "AssertEphemeral": { - "type": "class", - "new": true - }, - "SendMessage": { - "type": "class", - "new": true, - "fields": { - "mode": "u8", - "message": "Bytes", - "data": "Vec" - } - }, - "ReceiveMessage": { - "type": "class", - "new": true, - "fields": { - "mode": "u8", - "message": "Bytes", - "data": "Vec" - } - }, - "Softfork": { - "type": "class", - "new": true, - "fields": { - "cost": "u64", - "rest": "Program" - } - }, - "Vault": { - "type": "class", - "new": true, - "fields": { - "coin": "Coin", - "launcher_id": "Bytes32", - "proof": "LineageProof", - "custody_hash": "TreeHash" - }, - "methods": { - "child": { - "args": { - "custody_hash": "TreeHash" - }, - "return": "Vault" - } - } - }, - "MemberConfig": { - "type": "class", - "fields": { - "top_level": "bool", - "nonce": "u32", - "restrictions": "Vec" - }, - "methods": { - "new": { - "type": "constructor" - }, - "with_top_level": { - "args": { - "top_level": "bool" - }, - "return": "MemberConfig" - }, - "with_nonce": { - "args": { - "nonce": "u32" - }, - "return": "MemberConfig" - }, - "with_restrictions": { - "args": { - "restrictions": "Vec" - }, - "return": "MemberConfig" - } - } - }, - "m_of_n_hash": { - "type": "function", - "args": { - "config": "MemberConfig", - "required": "u32", - "items": "Vec" - }, - "return": "TreeHash" - }, - "k1_member_hash": { - "type": "function", - "args": { - "config": "MemberConfig", - "public_key": "K1PublicKey", - "fast_forward": "bool" - }, - "return": "TreeHash" - }, - "r1_member_hash": { - "type": "function", - "args": { - "config": "MemberConfig", - "public_key": "R1PublicKey", - "fast_forward": "bool" - }, - "return": "TreeHash" - }, - "bls_member_hash": { - "type": "function", - "args": { - "config": "MemberConfig", - "public_key": "PublicKey" - }, - "return": "TreeHash" - }, - "passkey_member_hash": { - "type": "function", - "args": { - "config": "MemberConfig", - "public_key": "R1PublicKey", - "fast_forward": "bool" - }, - "return": "TreeHash" - }, - "singleton_member_hash": { - "type": "function", - "args": { - "config": "MemberConfig", - "launcher_id": "Bytes32" - }, - "return": "TreeHash" - }, - "fixed_member_hash": { - "type": "function", - "args": { - "config": "MemberConfig", - "fixed_puzzle_hash": "Bytes32" - }, - "return": "TreeHash" - }, - "custom_member_hash": { - "type": "function", - "args": { - "config": "MemberConfig", - "inner_hash": "TreeHash" - }, - "return": "TreeHash" - }, - "Restriction": { - "type": "class", - "new": true, - "fields": { - "kind": "RestrictionKind", - "puzzle_hash": "TreeHash" - } - }, - "RestrictionKind": { - "type": "enum", - "values": [ - "MemberCondition", - "DelegatedPuzzleHash", - "DelegatedPuzzleWrapper" - ] - }, - "timelock_restriction": { - "type": "function", - "args": { - "timelock": "u64" - }, - "return": "Restriction" - }, - "force_1_of_2_restriction": { - "type": "function", - "args": { - "left_side_subtree_hash": "Bytes32", - "nonce": "u32", - "member_validator_list_hash": "Bytes32", - "delegated_puzzle_validator_list_hash": "Bytes32" - }, - "return": "Restriction" - }, - "prevent_condition_opcode_restriction": { - "type": "function", - "args": { - "condition_opcode": "u16" - }, - "return": "Restriction" - }, - "prevent_multiple_create_coins_restriction": { - "type": "function", - "return": "Restriction" - }, - "prevent_side_effects_restriction": { - "type": "function", - "return": "Vec" - }, - "MipsSpend": { - "type": "class", - "methods": { - "spend": { - "args": { - "custody_hash": "TreeHash" - }, - "return": "Spend" - }, - "spend_vault": { - "args": { - "vault": "Vault" - } - }, - "m_of_n": { - "args": { - "config": "MemberConfig", - "required": "u32", - "items": "Vec" - } - }, - "k1_member": { - "args": { - "config": "MemberConfig", - "public_key": "K1PublicKey", - "signature": "K1Signature", - "fast_forward": "bool" - } - }, - "r1_member": { - "args": { - "config": "MemberConfig", - "public_key": "R1PublicKey", - "signature": "R1Signature", - "fast_forward": "bool" - } - }, - "bls_member": { - "args": { - "config": "MemberConfig", - "public_key": "PublicKey" - } - }, - "passkey_member": { - "args": { - "config": "MemberConfig", - "public_key": "R1PublicKey", - "signature": "R1Signature", - "authenticator_data": "Bytes", - "client_data_json": "Bytes", - "challenge_index": "u32", - "fast_forward": "bool" - } - }, - "singleton_member": { - "args": { - "config": "MemberConfig", - "launcher_id": "Bytes32", - "singleton_inner_puzzle_hash": "Bytes32", - "singleton_amount": "u64" - } - }, - "fixed_puzzle_member": { - "args": { - "config": "MemberConfig", - "fixed_puzzle_hash": "Bytes32" - } - }, - "custom_member": { - "args": { - "config": "MemberConfig", - "spend": "Spend" - } - }, - "timelock": { - "args": { - "timelock": "u64" - } - }, - "force_1_of_2_restricted_variable": { - "args": { - "left_side_subtree_hash": "Bytes32", - "nonce": "u32", - "member_validator_list_hash": "Bytes32", - "delegated_puzzle_validator_list_hash": "Bytes32", - "new_right_side_member_hash": "Bytes32" - } - }, - "prevent_condition_opcode": { - "args": { - "condition_opcode": "u16" - } - }, - "prevent_multiple_create_coins": {}, - "prevent_side_effects": {} - } - }, - "VaultMint": { - "type": "class", - "new": true, - "fields": { - "vault": "Vault", - "parent_conditions": "Vec" - } - }, - "wrapped_delegated_puzzle_hash": { - "type": "function", - "args": { - "restrictions": "Vec", - "delegated_puzzle_hash": "TreeHash" - }, - "return": "TreeHash" - } - }, "napi": { "Bytes32": "napi::bindgen_prelude::Uint8Array", "Bytes48": "napi::bindgen_prelude::Uint8Array", diff --git a/bindings/address.json b/bindings/address.json new file mode 100644 index 00000000..d8bfac3f --- /dev/null +++ b/bindings/address.json @@ -0,0 +1,21 @@ +{ + "Address": { + "type": "class", + "new": true, + "fields": { + "puzzle_hash": "Bytes32", + "prefix": "String" + }, + "methods": { + "encode": { + "return": "String" + }, + "decode": { + "type": "factory", + "args": { + "address": "String" + } + } + } + } +} diff --git a/bindings/bls.json b/bindings/bls.json new file mode 100644 index 00000000..819809a4 --- /dev/null +++ b/bindings/bls.json @@ -0,0 +1,146 @@ +{ + "SecretKey": { + "type": "class", + "methods": { + "from_seed": { + "type": "factory", + "args": { + "seed": "Bytes" + } + }, + "from_bytes": { + "type": "factory", + "args": { + "bytes": "Bytes32" + } + }, + "to_bytes": { + "return": "Bytes32" + }, + "public_key": { + "return": "PublicKey" + }, + "sign": { + "args": { + "message": "Bytes" + }, + "return": "Signature" + }, + "derive_unhardened": { + "args": { + "index": "u32" + }, + "return": "SecretKey" + }, + "derive_hardened": { + "args": { + "index": "u32" + }, + "return": "SecretKey" + }, + "derive_unhardened_path": { + "args": { + "path": "Vec" + }, + "return": "SecretKey" + }, + "derive_hardened_path": { + "args": { + "path": "Vec" + }, + "return": "SecretKey" + }, + "derive_synthetic": { + "return": "SecretKey" + }, + "derive_synthetic_hidden": { + "args": { + "hidden_puzzle_hash": "Bytes32" + }, + "return": "SecretKey" + } + } + }, + "PublicKey": { + "type": "class", + "methods": { + "infinity": { + "type": "factory" + }, + "aggregate": { + "type": "factory", + "args": { + "public_keys": "Vec" + } + }, + "from_bytes": { + "type": "factory", + "args": { + "bytes": "Bytes48" + } + }, + "to_bytes": { + "return": "Bytes48" + }, + "fingerprint": { + "return": "u32" + }, + "is_infinity": { + "return": "bool" + }, + "is_valid": { + "return": "bool" + }, + "derive_unhardened": { + "args": { + "index": "u32" + }, + "return": "PublicKey" + }, + "derive_unhardened_path": { + "args": { + "path": "Vec" + }, + "return": "PublicKey" + }, + "derive_synthetic": { + "return": "PublicKey" + }, + "derive_synthetic_hidden": { + "args": { + "hidden_puzzle_hash": "Bytes32" + }, + "return": "PublicKey" + } + } + }, + "Signature": { + "type": "class", + "methods": { + "infinity": { + "type": "factory" + }, + "aggregate": { + "type": "factory", + "args": { + "signatures": "Vec" + } + }, + "from_bytes": { + "type": "factory", + "args": { + "bytes": "Bytes96" + } + }, + "to_bytes": { + "return": "Bytes96" + }, + "is_infinity": { + "return": "bool" + }, + "is_valid": { + "return": "bool" + } + } + } +} diff --git a/bindings/clvm.json b/bindings/clvm.json new file mode 100644 index 00000000..04d92657 --- /dev/null +++ b/bindings/clvm.json @@ -0,0 +1,351 @@ +{ + "Clvm": { + "type": "class", + "methods": { + "new": { + "type": "constructor" + }, + "add_coin_spend": { + "args": { + "coin_spend": "CoinSpend" + } + }, + "spend_coin": { + "args": { + "coin": "Coin", + "spend": "Spend" + } + }, + "coin_spends": { + "return": "Vec" + }, + "deserialize": { + "args": { + "value": "SerializedProgram" + }, + "return": "Program" + }, + "deserialize_with_backrefs": { + "args": { + "value": "SerializedProgram" + }, + "return": "Program" + }, + "pair": { + "args": { + "first": "Program", + "rest": "Program" + }, + "return": "Program" + }, + "nil": { + "return": "Program" + }, + "string": { + "args": { + "value": "String" + }, + "return": "Program" + }, + "bool": { + "args": { + "value": "bool" + }, + "return": "Program" + }, + "atom": { + "args": { + "value": "Bytes" + }, + "return": "Program" + }, + "list": { + "args": { + "value": "Vec" + }, + "return": "Program" + }, + "delegated_spend": { + "args": { + "conditions": "Vec" + }, + "return": "Spend" + }, + "standard_spend": { + "args": { + "synthetic_key": "PublicKey", + "spend": "Spend" + }, + "return": "Spend" + }, + "spend_standard_coin": { + "args": { + "coin": "Coin", + "synthetic_key": "PublicKey", + "spend": "Spend" + } + }, + "spend_cat_coins": { + "args": { + "cat_spends": "Vec" + } + }, + "mint_nfts": { + "args": { + "parent_coin_id": "Bytes32", + "nft_mints": "Vec" + }, + "return": "MintedNfts" + }, + "spend_nft": { + "args": { + "nft": "Nft", + "inner_spend": "Spend" + } + }, + "mint_vault": { + "args": { + "parent_coin_id": "Bytes32", + "custody_hash": "TreeHash", + "memos": "Program" + }, + "return": "VaultMint" + }, + "mips_spend": { + "args": { + "coin": "Coin", + "delegated_spend": "Spend" + }, + "return": "MipsSpend" + }, + "nft_metadata": { + "args": { + "value": "NftMetadata" + }, + "return": "Program" + }, + "remark": { + "args": { + "rest": "Program" + }, + "return": "Program" + }, + "agg_sig_parent": { + "args": { + "public_key": "PublicKey", + "message": "Bytes" + }, + "return": "Program" + }, + "agg_sig_puzzle": { + "args": { + "public_key": "PublicKey", + "message": "Bytes" + }, + "return": "Program" + }, + "agg_sig_amount": { + "args": { + "public_key": "PublicKey", + "message": "Bytes" + }, + "return": "Program" + }, + "agg_sig_puzzle_amount": { + "args": { + "public_key": "PublicKey", + "message": "Bytes" + }, + "return": "Program" + }, + "agg_sig_parent_amount": { + "args": { + "public_key": "PublicKey", + "message": "Bytes" + }, + "return": "Program" + }, + "agg_sig_parent_puzzle": { + "args": { + "public_key": "PublicKey", + "message": "Bytes" + }, + "return": "Program" + }, + "agg_sig_unsafe": { + "args": { + "public_key": "PublicKey", + "message": "Bytes" + }, + "return": "Program" + }, + "agg_sig_me": { + "args": { + "public_key": "PublicKey", + "message": "Bytes" + }, + "return": "Program" + }, + "create_coin": { + "args": { + "puzzle_hash": "Bytes32", + "amount": "u64", + "memos": "Option" + }, + "return": "Program" + }, + "reserve_fee": { + "args": { + "amount": "u64" + }, + "return": "Program" + }, + "create_coin_announcement": { + "args": { + "message": "Bytes" + }, + "return": "Program" + }, + "create_puzzle_announcement": { + "args": { + "message": "Bytes" + }, + "return": "Program" + }, + "assert_coin_announcement": { + "args": { + "announcement_id": "Bytes32" + }, + "return": "Program" + }, + "assert_puzzle_announcement": { + "args": { + "announcement_id": "Bytes32" + }, + "return": "Program" + }, + "assert_concurrent_spend": { + "args": { + "coin_id": "Bytes32" + }, + "return": "Program" + }, + "assert_concurrent_puzzle": { + "args": { + "puzzle_hash": "Bytes32" + }, + "return": "Program" + }, + "assert_seconds_relative": { + "args": { + "seconds": "u64" + }, + "return": "Program" + }, + "assert_seconds_absolute": { + "args": { + "seconds": "u64" + }, + "return": "Program" + }, + "assert_height_relative": { + "args": { + "height": "u32" + }, + "return": "Program" + }, + "assert_height_absolute": { + "args": { + "height": "u32" + }, + "return": "Program" + }, + "assert_before_seconds_relative": { + "args": { + "seconds": "u64" + }, + "return": "Program" + }, + "assert_before_seconds_absolute": { + "args": { + "seconds": "u64" + }, + "return": "Program" + }, + "assert_before_height_relative": { + "args": { + "height": "u32" + }, + "return": "Program" + }, + "assert_before_height_absolute": { + "args": { + "height": "u32" + }, + "return": "Program" + }, + "assert_my_coin_id": { + "args": { + "coin_id": "Bytes32" + }, + "return": "Program" + }, + "assert_my_parent_id": { + "args": { + "parent_id": "Bytes32" + }, + "return": "Program" + }, + "assert_my_puzzle_hash": { + "args": { + "puzzle_hash": "Bytes32" + }, + "return": "Program" + }, + "assert_my_amount": { + "args": { + "amount": "u64" + }, + "return": "Program" + }, + "assert_my_birth_seconds": { + "args": { + "seconds": "u64" + }, + "return": "Program" + }, + "assert_my_birth_height": { + "args": { + "height": "u32" + }, + "return": "Program" + }, + "assert_ephemeral": { + "return": "Program" + }, + "send_message": { + "args": { + "mode": "u8", + "message": "Bytes", + "data": "Vec" + }, + "return": "Program" + }, + "receive_message": { + "args": { + "mode": "u8", + "message": "Bytes", + "data": "Vec" + }, + "return": "Program" + }, + "softfork": { + "args": { + "cost": "u64", + "rest": "Program" + }, + "return": "Program" + } + } + } +} diff --git a/bindings/clvm_types.json b/bindings/clvm_types.json new file mode 100644 index 00000000..1fedd562 --- /dev/null +++ b/bindings/clvm_types.json @@ -0,0 +1,35 @@ +{ + "Output": { + "type": "class", + "new": true, + "fields": { + "value": "Program", + "cost": "u64" + } + }, + "Pair": { + "type": "class", + "new": true, + "fields": { + "first": "Program", + "rest": "Program" + } + }, + "CurriedProgram": { + "type": "class", + "new": true, + "fields": { + "program": "Program", + "args": "Vec" + } + }, + "LineageProof": { + "type": "class", + "new": true, + "fields": { + "parent_parent_coin_info": "Bytes32", + "parent_inner_puzzle_hash": "Option", + "parent_amount": "u64" + } + } +} diff --git a/bindings/coin.json b/bindings/coin.json new file mode 100644 index 00000000..d6f204b6 --- /dev/null +++ b/bindings/coin.json @@ -0,0 +1,41 @@ +{ + "Coin": { + "type": "class", + "new": true, + "fields": { + "parent_coin_info": "Bytes32", + "puzzle_hash": "Bytes32", + "amount": "u64" + }, + "methods": { + "coin_id": { + "return": "Bytes32" + } + } + }, + "CoinSpend": { + "type": "class", + "new": true, + "fields": { + "coin": "Coin", + "puzzle_reveal": "SerializedProgram", + "solution": "SerializedProgram" + } + }, + "SpendBundle": { + "type": "class", + "new": true, + "fields": { + "coin_spends": "Vec", + "aggregated_signature": "Signature" + } + }, + "Spend": { + "type": "class", + "new": true, + "fields": { + "puzzle": "Program", + "solution": "Program" + } + } +} diff --git a/bindings/conditions.json b/bindings/conditions.json new file mode 100644 index 00000000..f4fe83f7 --- /dev/null +++ b/bindings/conditions.json @@ -0,0 +1,259 @@ +{ + "Remark": { + "type": "class", + "new": true, + "fields": { + "rest": "Program" + } + }, + "AggSigParent": { + "type": "class", + "new": true, + "fields": { + "public_key": "PublicKey", + "message": "Bytes" + } + }, + "AggSigPuzzle": { + "type": "class", + "new": true, + "fields": { + "public_key": "PublicKey", + "message": "Bytes" + } + }, + "AggSigAmount": { + "type": "class", + "new": true, + "fields": { + "public_key": "PublicKey", + "message": "Bytes" + } + }, + "AggSigPuzzleAmount": { + "type": "class", + "new": true, + "fields": { + "public_key": "PublicKey", + "message": "Bytes" + } + }, + "AggSigParentAmount": { + "type": "class", + "new": true, + "fields": { + "public_key": "PublicKey", + "message": "Bytes" + } + }, + "AggSigParentPuzzle": { + "type": "class", + "new": true, + "fields": { + "public_key": "PublicKey", + "message": "Bytes" + } + }, + "AggSigUnsafe": { + "type": "class", + "new": true, + "fields": { + "public_key": "PublicKey", + "message": "Bytes" + } + }, + "AggSigMe": { + "type": "class", + "new": true, + "fields": { + "public_key": "PublicKey", + "message": "Bytes" + } + }, + "CreateCoin": { + "type": "class", + "new": true, + "fields": { + "puzzle_hash": "Bytes32", + "amount": "u64", + "memos": "Option" + } + }, + "ReserveFee": { + "type": "class", + "new": true, + "fields": { + "amount": "u64" + } + }, + "CreateCoinAnnouncement": { + "type": "class", + "new": true, + "fields": { + "message": "Bytes" + } + }, + "CreatePuzzleAnnouncement": { + "type": "class", + "new": true, + "fields": { + "message": "Bytes" + } + }, + "AssertCoinAnnouncement": { + "type": "class", + "new": true, + "fields": { + "announcement_id": "Bytes32" + } + }, + "AssertPuzzleAnnouncement": { + "type": "class", + "new": true, + "fields": { + "announcement_id": "Bytes32" + } + }, + "AssertConcurrentSpend": { + "type": "class", + "new": true, + "fields": { + "coin_id": "Bytes32" + } + }, + "AssertConcurrentPuzzle": { + "type": "class", + "new": true, + "fields": { + "puzzle_hash": "Bytes32" + } + }, + "AssertSecondsRelative": { + "type": "class", + "new": true, + "fields": { + "seconds": "u64" + } + }, + "AssertSecondsAbsolute": { + "type": "class", + "new": true, + "fields": { + "seconds": "u64" + } + }, + "AssertHeightRelative": { + "type": "class", + "new": true, + "fields": { + "height": "u32" + } + }, + "AssertHeightAbsolute": { + "type": "class", + "new": true, + "fields": { + "height": "u32" + } + }, + "AssertBeforeSecondsRelative": { + "type": "class", + "new": true, + "fields": { + "seconds": "u64" + } + }, + "AssertBeforeSecondsAbsolute": { + "type": "class", + "new": true, + "fields": { + "seconds": "u64" + } + }, + "AssertBeforeHeightRelative": { + "type": "class", + "new": true, + "fields": { + "height": "u32" + } + }, + "AssertBeforeHeightAbsolute": { + "type": "class", + "new": true, + "fields": { + "height": "u32" + } + }, + "AssertMyCoinId": { + "type": "class", + "new": true, + "fields": { + "coin_id": "Bytes32" + } + }, + "AssertMyParentId": { + "type": "class", + "new": true, + "fields": { + "parent_id": "Bytes32" + } + }, + "AssertMyPuzzleHash": { + "type": "class", + "new": true, + "fields": { + "puzzle_hash": "Bytes32" + } + }, + "AssertMyAmount": { + "type": "class", + "new": true, + "fields": { + "amount": "u64" + } + }, + "AssertMyBirthSeconds": { + "type": "class", + "new": true, + "fields": { + "seconds": "u64" + } + }, + "AssertMyBirthHeight": { + "type": "class", + "new": true, + "fields": { + "height": "u32" + } + }, + "AssertEphemeral": { + "type": "class", + "new": true + }, + "SendMessage": { + "type": "class", + "new": true, + "fields": { + "mode": "u8", + "message": "Bytes", + "data": "Vec" + } + }, + "ReceiveMessage": { + "type": "class", + "new": true, + "fields": { + "mode": "u8", + "message": "Bytes", + "data": "Vec" + } + }, + "Softfork": { + "type": "class", + "new": true, + "fields": { + "cost": "u64", + "rest": "Program" + } + } +} diff --git a/bindings/mnemonic.json b/bindings/mnemonic.json new file mode 100644 index 00000000..85c0feaa --- /dev/null +++ b/bindings/mnemonic.json @@ -0,0 +1,45 @@ +{ + "Mnemonic": { + "type": "class", + "methods": { + "new": { + "type": "constructor", + "args": { + "mnemonic": "String" + } + }, + "from_entropy": { + "type": "factory", + "args": { + "entropy": "Bytes" + } + }, + "generate": { + "type": "factory", + "args": { + "use_24": "bool" + } + }, + "verify": { + "type": "static", + "args": { + "mnemonic": "String" + }, + "return": "bool" + }, + "to_string": { + "type": "to_string", + "return": "String" + }, + "to_entropy": { + "return": "Bytes" + }, + "to_seed": { + "args": { + "password": "String" + }, + "return": "Bytes" + } + } + } +} diff --git a/bindings/program.json b/bindings/program.json new file mode 100644 index 00000000..d41336f9 --- /dev/null +++ b/bindings/program.json @@ -0,0 +1,169 @@ +{ + "Program": { + "type": "class", + "methods": { + "serialize": { + "return": "SerializedProgram" + }, + "serialize_with_backrefs": { + "return": "SerializedProgram" + }, + "run": { + "args": { + "solution": "Program", + "max_cost": "u64", + "mempool_mode": "bool" + }, + "return": "Output" + }, + "curry": { + "args": { + "args": "Vec" + }, + "return": "Program" + }, + "uncurry": { + "return": "Option" + }, + "tree_hash": { + "return": "TreeHash" + }, + "length": { + "return": "u32" + }, + "first": { + "return": "Program" + }, + "rest": { + "return": "Program" + }, + "to_string": { + "type": "to_string", + "return": "Option" + }, + "to_bool": { + "return": "Option" + }, + "to_atom": { + "return": "Option" + }, + "to_list": { + "return": "Option>" + }, + "to_pair": { + "return": "Option" + }, + "puzzle": { + "return": "Puzzle" + }, + "parse_nft_metadata": { + "return": "Option" + }, + "parse_remark": { + "return": "Option" + }, + "parse_agg_sig_parent": { + "return": "Option" + }, + "parse_agg_sig_puzzle": { + "return": "Option" + }, + "parse_agg_sig_amount": { + "return": "Option" + }, + "parse_agg_sig_puzzle_amount": { + "return": "Option" + }, + "parse_agg_sig_parent_amount": { + "return": "Option" + }, + "parse_agg_sig_parent_puzzle": { + "return": "Option" + }, + "parse_agg_sig_unsafe": { + "return": "Option" + }, + "parse_agg_sig_me": { + "return": "Option" + }, + "parse_create_coin": { + "return": "Option" + }, + "parse_reserve_fee": { + "return": "Option" + }, + "parse_create_coin_announcement": { + "return": "Option" + }, + "parse_create_puzzle_announcement": { + "return": "Option" + }, + "parse_assert_coin_announcement": { + "return": "Option" + }, + "parse_assert_puzzle_announcement": { + "return": "Option" + }, + "parse_assert_concurrent_spend": { + "return": "Option" + }, + "parse_assert_concurrent_puzzle": { + "return": "Option" + }, + "parse_assert_seconds_relative": { + "return": "Option" + }, + "parse_assert_seconds_absolute": { + "return": "Option" + }, + "parse_assert_height_relative": { + "return": "Option" + }, + "parse_assert_height_absolute": { + "return": "Option" + }, + "parse_assert_before_seconds_relative": { + "return": "Option" + }, + "parse_assert_before_seconds_absolute": { + "return": "Option" + }, + "parse_assert_before_height_relative": { + "return": "Option" + }, + "parse_assert_before_height_absolute": { + "return": "Option" + }, + "parse_assert_my_coin_id": { + "return": "Option" + }, + "parse_assert_my_parent_id": { + "return": "Option" + }, + "parse_assert_my_puzzle_hash": { + "return": "Option" + }, + "parse_assert_my_amount": { + "return": "Option" + }, + "parse_assert_my_birth_seconds": { + "return": "Option" + }, + "parse_assert_my_birth_height": { + "return": "Option" + }, + "parse_assert_ephemeral": { + "return": "Option" + }, + "parse_send_message": { + "return": "Option" + }, + "parse_receive_message": { + "return": "Option" + }, + "parse_softfork": { + "return": "Option" + } + } + } +} diff --git a/bindings/puzzles.json b/bindings/puzzles.json new file mode 100644 index 00000000..323b2863 --- /dev/null +++ b/bindings/puzzles.json @@ -0,0 +1,130 @@ +{ + "Puzzle": { + "type": "class", + "new": true, + "fields": { + "puzzle_hash": "Bytes32", + "program": "Program", + "mod_hash": "Bytes32", + "args": "Option" + }, + "methods": { + "parse_nft": { + "return": "Option" + }, + "parse_child_nft": { + "args": { + "parent_coin": "Coin", + "parent_puzzle": "Program", + "parent_solution": "Program" + }, + "return": "Option" + } + } + }, + "Cat": { + "type": "class", + "new": true, + "fields": { + "coin": "Coin", + "lineage_proof": "Option", + "asset_id": "Bytes32", + "p2_puzzle_hash": "Bytes32" + } + }, + "CatSpend": { + "type": "class", + "new": true, + "fields": { + "cat": "Cat", + "spend": "Spend" + } + }, + "Nft": { + "type": "class", + "new": true, + "fields": { + "coin": "Coin", + "lineage_proof": "LineageProof", + "info": "NftInfo" + } + }, + "NftInfo": { + "type": "class", + "new": true, + "fields": { + "launcher_id": "Bytes32", + "metadata": "Program", + "metadata_updater_puzzle_hash": "Bytes32", + "current_owner": "Option", + "royalty_puzzle_hash": "Bytes32", + "royalty_ten_thousandths": "u16", + "p2_puzzle_hash": "Bytes32" + } + }, + "ParsedNft": { + "type": "class", + "new": true, + "fields": { + "info": "NftInfo", + "p2_puzzle": "Program" + } + }, + "NftMetadata": { + "type": "class", + "new": true, + "fields": { + "edition_number": "u64", + "edition_total": "u64", + "data_uris": "Vec", + "data_hash": "Option", + "metadata_uris": "Vec", + "metadata_hash": "Option", + "license_uris": "Vec", + "license_hash": "Option" + } + }, + "NftMint": { + "type": "class", + "new": true, + "fields": { + "metadata": "Program", + "metadata_updater_puzzle_hash": "Bytes32", + "p2_puzzle_hash": "Bytes32", + "royalty_puzzle_hash": "Bytes32", + "royalty_ten_thousandths": "u16", + "owner": "Option" + } + }, + "DidOwner": { + "type": "class", + "new": true, + "fields": { + "did_id": "Bytes32", + "inner_puzzle_hash": "Bytes32" + } + }, + "MintedNfts": { + "type": "class", + "new": true, + "fields": { + "nfts": "Vec", + "parent_conditions": "Vec" + } + }, + "standard_puzzle_hash": { + "type": "function", + "args": { + "synthetic_key": "PublicKey" + }, + "return": "Bytes32" + }, + "cat_puzzle_hash": { + "type": "function", + "args": { + "asset_id": "Bytes32", + "inner_puzzle_hash": "Bytes32" + }, + "return": "Bytes32" + } +} diff --git a/bindings/secp.json b/bindings/secp.json new file mode 100644 index 00000000..996952f7 --- /dev/null +++ b/bindings/secp.json @@ -0,0 +1,124 @@ +{ + "K1SecretKey": { + "type": "class", + "methods": { + "from_bytes": { + "type": "factory", + "args": { + "bytes": "Bytes32" + } + }, + "to_bytes": { + "return": "Bytes32" + }, + "public_key": { + "return": "K1PublicKey" + }, + "sign_prehashed": { + "args": { + "prehashed": "Bytes32" + }, + "return": "K1Signature" + } + } + }, + "K1PublicKey": { + "type": "class", + "methods": { + "from_bytes": { + "type": "factory", + "args": { + "bytes": "BytesImpl<33>" + } + }, + "to_bytes": { + "return": "BytesImpl<33>" + }, + "fingerprint": { + "return": "u32" + }, + "verify_prehashed": { + "args": { + "prehashed": "Bytes32", + "signature": "K1Signature" + }, + "return": "bool" + } + } + }, + "K1Signature": { + "type": "class", + "methods": { + "from_bytes": { + "type": "factory", + "args": { + "bytes": "BytesImpl<64>" + } + }, + "to_bytes": { + "return": "BytesImpl<64>" + } + } + }, + "R1SecretKey": { + "type": "class", + "methods": { + "from_bytes": { + "type": "factory", + "args": { + "bytes": "Bytes32" + } + }, + "to_bytes": { + "return": "Bytes32" + }, + "public_key": { + "return": "R1PublicKey" + }, + "sign_prehashed": { + "args": { + "prehashed": "Bytes32" + }, + "return": "R1Signature" + } + } + }, + "R1PublicKey": { + "type": "class", + "methods": { + "from_bytes": { + "type": "factory", + "args": { + "bytes": "BytesImpl<33>" + } + }, + "to_bytes": { + "return": "BytesImpl<33>" + }, + "fingerprint": { + "return": "u32" + }, + "verify_prehashed": { + "args": { + "prehashed": "Bytes32", + "signature": "R1Signature" + }, + "return": "bool" + } + } + }, + "R1Signature": { + "type": "class", + "methods": { + "from_bytes": { + "type": "factory", + "args": { + "bytes": "BytesImpl<64>" + } + }, + "to_bytes": { + "return": "BytesImpl<64>" + } + } + } +} diff --git a/bindings/simulator.json b/bindings/simulator.json new file mode 100644 index 00000000..d90d92b8 --- /dev/null +++ b/bindings/simulator.json @@ -0,0 +1,111 @@ +{ + "Simulator": { + "type": "class", + "methods": { + "new": { + "type": "constructor" + }, + "new_coin": { + "args": { + "puzzle_hash": "Bytes32", + "amount": "u64" + }, + "return": "Coin" + }, + "bls": { + "args": { + "amount": "u64" + }, + "return": "BlsPairWithCoin" + }, + "spend_coins": { + "args": { + "coin_spends": "Vec", + "secret_keys": "Vec" + } + } + } + }, + "BlsPair": { + "type": "class", + "new": true, + "fields": { + "sk": "SecretKey", + "pk": "PublicKey" + }, + "methods": { + "from_seed": { + "type": "factory", + "args": { + "seed": "u64" + } + }, + "many_from_seed": { + "type": "static", + "args": { + "seed": "u64", + "count": "u32" + }, + "return": "Vec" + } + } + }, + "BlsPairWithCoin": { + "type": "class", + "new": true, + "fields": { + "sk": "SecretKey", + "pk": "PublicKey", + "puzzle_hash": "Bytes32", + "coin": "Coin" + } + }, + "K1Pair": { + "type": "class", + "new": true, + "fields": { + "sk": "K1SecretKey", + "pk": "K1PublicKey" + }, + "methods": { + "from_seed": { + "type": "factory", + "args": { + "seed": "u64" + } + }, + "many_from_seed": { + "type": "static", + "args": { + "seed": "u64", + "count": "u32" + }, + "return": "Vec" + } + } + }, + "R1Pair": { + "type": "class", + "new": true, + "fields": { + "sk": "R1SecretKey", + "pk": "R1PublicKey" + }, + "methods": { + "from_seed": { + "type": "factory", + "args": { + "seed": "u64" + } + }, + "many_from_seed": { + "type": "static", + "args": { + "seed": "u64", + "count": "u32" + }, + "return": "Vec" + } + } + } +} diff --git a/bindings/utils.json b/bindings/utils.json new file mode 100644 index 00000000..32a00b2b --- /dev/null +++ b/bindings/utils.json @@ -0,0 +1,70 @@ +{ + "Constants": { + "type": "class", + "methods": { + "default_metadata_updater_hash": { + "type": "static", + "return": "TreeHash" + } + } + }, + "from_hex": { + "type": "function", + "args": { + "value": "String" + }, + "return": "Bytes" + }, + "to_hex": { + "type": "function", + "args": { + "value": "Bytes" + }, + "return": "String" + }, + "bytes_equal": { + "type": "function", + "args": { + "lhs": "Bytes", + "rhs": "Bytes" + }, + "return": "bool" + }, + "tree_hash_atom": { + "type": "function", + "args": { + "atom": "Bytes32" + }, + "return": "Bytes32" + }, + "tree_hash_pair": { + "type": "function", + "args": { + "first": "Bytes32", + "rest": "Bytes32" + }, + "return": "Bytes32" + }, + "sha256": { + "type": "function", + "args": { + "value": "Bytes" + }, + "return": "Bytes32" + }, + "curry_tree_hash": { + "type": "function", + "args": { + "program": "Bytes32", + "args": "Vec" + }, + "return": "Bytes32" + }, + "generate_bytes": { + "type": "function", + "args": { + "bytes": "u32" + }, + "return": "Bytes" + } +} diff --git a/bindings/vaults.json b/bindings/vaults.json new file mode 100644 index 00000000..6945f3ca --- /dev/null +++ b/bindings/vaults.json @@ -0,0 +1,280 @@ +{ + "Vault": { + "type": "class", + "new": true, + "fields": { + "coin": "Coin", + "launcher_id": "Bytes32", + "proof": "LineageProof", + "custody_hash": "TreeHash" + }, + "methods": { + "child": { + "args": { + "custody_hash": "TreeHash" + }, + "return": "Vault" + } + } + }, + "MemberConfig": { + "type": "class", + "fields": { + "top_level": "bool", + "nonce": "u32", + "restrictions": "Vec" + }, + "methods": { + "new": { + "type": "constructor" + }, + "with_top_level": { + "args": { + "top_level": "bool" + }, + "return": "MemberConfig" + }, + "with_nonce": { + "args": { + "nonce": "u32" + }, + "return": "MemberConfig" + }, + "with_restrictions": { + "args": { + "restrictions": "Vec" + }, + "return": "MemberConfig" + } + } + }, + "m_of_n_hash": { + "type": "function", + "args": { + "config": "MemberConfig", + "required": "u32", + "items": "Vec" + }, + "return": "TreeHash" + }, + "k1_member_hash": { + "type": "function", + "args": { + "config": "MemberConfig", + "public_key": "K1PublicKey", + "fast_forward": "bool" + }, + "return": "TreeHash" + }, + "r1_member_hash": { + "type": "function", + "args": { + "config": "MemberConfig", + "public_key": "R1PublicKey", + "fast_forward": "bool" + }, + "return": "TreeHash" + }, + "bls_member_hash": { + "type": "function", + "args": { + "config": "MemberConfig", + "public_key": "PublicKey" + }, + "return": "TreeHash" + }, + "passkey_member_hash": { + "type": "function", + "args": { + "config": "MemberConfig", + "public_key": "R1PublicKey", + "fast_forward": "bool" + }, + "return": "TreeHash" + }, + "singleton_member_hash": { + "type": "function", + "args": { + "config": "MemberConfig", + "launcher_id": "Bytes32" + }, + "return": "TreeHash" + }, + "fixed_member_hash": { + "type": "function", + "args": { + "config": "MemberConfig", + "fixed_puzzle_hash": "Bytes32" + }, + "return": "TreeHash" + }, + "custom_member_hash": { + "type": "function", + "args": { + "config": "MemberConfig", + "inner_hash": "TreeHash" + }, + "return": "TreeHash" + }, + "Restriction": { + "type": "class", + "new": true, + "fields": { + "kind": "RestrictionKind", + "puzzle_hash": "TreeHash" + } + }, + "RestrictionKind": { + "type": "enum", + "values": [ + "MemberCondition", + "DelegatedPuzzleHash", + "DelegatedPuzzleWrapper" + ] + }, + "timelock_restriction": { + "type": "function", + "args": { + "timelock": "u64" + }, + "return": "Restriction" + }, + "force_1_of_2_restriction": { + "type": "function", + "args": { + "left_side_subtree_hash": "Bytes32", + "nonce": "u32", + "member_validator_list_hash": "Bytes32", + "delegated_puzzle_validator_list_hash": "Bytes32" + }, + "return": "Restriction" + }, + "prevent_condition_opcode_restriction": { + "type": "function", + "args": { + "condition_opcode": "u16" + }, + "return": "Restriction" + }, + "prevent_multiple_create_coins_restriction": { + "type": "function", + "return": "Restriction" + }, + "prevent_side_effects_restriction": { + "type": "function", + "return": "Vec" + }, + "MipsSpend": { + "type": "class", + "methods": { + "spend": { + "args": { + "custody_hash": "TreeHash" + }, + "return": "Spend" + }, + "spend_vault": { + "args": { + "vault": "Vault" + } + }, + "m_of_n": { + "args": { + "config": "MemberConfig", + "required": "u32", + "items": "Vec" + } + }, + "k1_member": { + "args": { + "config": "MemberConfig", + "public_key": "K1PublicKey", + "signature": "K1Signature", + "fast_forward": "bool" + } + }, + "r1_member": { + "args": { + "config": "MemberConfig", + "public_key": "R1PublicKey", + "signature": "R1Signature", + "fast_forward": "bool" + } + }, + "bls_member": { + "args": { + "config": "MemberConfig", + "public_key": "PublicKey" + } + }, + "passkey_member": { + "args": { + "config": "MemberConfig", + "public_key": "R1PublicKey", + "signature": "R1Signature", + "authenticator_data": "Bytes", + "client_data_json": "Bytes", + "challenge_index": "u32", + "fast_forward": "bool" + } + }, + "singleton_member": { + "args": { + "config": "MemberConfig", + "launcher_id": "Bytes32", + "singleton_inner_puzzle_hash": "Bytes32", + "singleton_amount": "u64" + } + }, + "fixed_puzzle_member": { + "args": { + "config": "MemberConfig", + "fixed_puzzle_hash": "Bytes32" + } + }, + "custom_member": { + "args": { + "config": "MemberConfig", + "spend": "Spend" + } + }, + "timelock": { + "args": { + "timelock": "u64" + } + }, + "force_1_of_2_restricted_variable": { + "args": { + "left_side_subtree_hash": "Bytes32", + "nonce": "u32", + "member_validator_list_hash": "Bytes32", + "delegated_puzzle_validator_list_hash": "Bytes32", + "new_right_side_member_hash": "Bytes32" + } + }, + "prevent_condition_opcode": { + "args": { + "condition_opcode": "u16" + } + }, + "prevent_multiple_create_coins": {}, + "prevent_side_effects": {} + } + }, + "VaultMint": { + "type": "class", + "new": true, + "fields": { + "vault": "Vault", + "parent_conditions": "Vec" + } + }, + "wrapped_delegated_puzzle_hash": { + "type": "function", + "args": { + "restrictions": "Vec", + "delegated_puzzle_hash": "TreeHash" + }, + "return": "TreeHash" + } +} diff --git a/crates/bindy-macro/src/lib.rs b/crates/bindy-macro/src/lib.rs index e89d26d8..e2f3fbef 100644 --- a/crates/bindy-macro/src/lib.rs +++ b/crates/bindy-macro/src/lib.rs @@ -1,4 +1,4 @@ -use std::fs; +use std::{fs, path::Path}; use convert_case::{Case, Casing}; use indexmap::{indexmap, IndexMap}; @@ -12,7 +12,6 @@ use syn::{parse_str, Ident, LitStr, Type}; struct Bindy { entrypoint: String, pymodule: String, - bindings: IndexMap, #[serde(default)] napi: IndexMap, #[serde(default)] @@ -64,11 +63,29 @@ enum MethodKind { Constructor, } +fn load_bindings(path: &str) -> (Bindy, IndexMap) { + let source = fs::read_to_string(path).unwrap(); + let bindy: Bindy = serde_json::from_str(&source).unwrap(); + + let mut bindings = IndexMap::new(); + + for path in fs::read_dir(Path::new(path).parent().unwrap().join("bindings")).unwrap() { + let path = path.unwrap(); + + if path.path().extension().unwrap() == "json" { + let source = fs::read_to_string(path.path()).unwrap(); + let contents: IndexMap = serde_json::from_str(&source).unwrap(); + bindings.extend(contents); + } + } + + (bindy, bindings) +} + #[proc_macro] pub fn bindy_napi(input: TokenStream) -> TokenStream { let input = syn::parse_macro_input!(input as LitStr).value(); - let source = fs::read_to_string(input).unwrap(); - let bindy: Bindy = serde_json::from_str(&source).unwrap(); + let (bindy, bindings) = load_bindings(&input); let entrypoint = Ident::new(&bindy.entrypoint, Span::mixed_site()); @@ -83,7 +100,7 @@ pub fn bindy_napi(input: TokenStream) -> TokenStream { let mut param_mappings = base_mappings.clone(); let return_mappings = base_mappings; - for (name, binding) in &bindy.bindings { + for (name, binding) in &bindings { if matches!(binding, Binding::Class { .. }) { param_mappings.insert( name.clone(), @@ -94,7 +111,7 @@ pub fn bindy_napi(input: TokenStream) -> TokenStream { let mut output = quote!(); - for (name, binding) in bindy.bindings { + for (name, binding) in bindings { match binding { Binding::Class { new, @@ -328,8 +345,7 @@ pub fn bindy_napi(input: TokenStream) -> TokenStream { #[proc_macro] pub fn bindy_wasm(input: TokenStream) -> TokenStream { let input = syn::parse_macro_input!(input as LitStr).value(); - let source = fs::read_to_string(input).unwrap(); - let bindy: Bindy = serde_json::from_str(&source).unwrap(); + let (bindy, bindings) = load_bindings(&input); let entrypoint = Ident::new(&bindy.entrypoint, Span::mixed_site()); @@ -341,7 +357,7 @@ pub fn bindy_wasm(input: TokenStream) -> TokenStream { let mut output = quote!(); - for (name, binding) in bindy.bindings { + for (name, binding) in bindings { match binding { Binding::Class { new, @@ -590,8 +606,7 @@ pub fn bindy_wasm(input: TokenStream) -> TokenStream { #[proc_macro] pub fn bindy_pyo3(input: TokenStream) -> TokenStream { let input = syn::parse_macro_input!(input as LitStr).value(); - let source = fs::read_to_string(input).unwrap(); - let bindy: Bindy = serde_json::from_str(&source).unwrap(); + let (bindy, bindings) = load_bindings(&input); let entrypoint = Ident::new(&bindy.entrypoint, Span::mixed_site()); @@ -603,7 +618,7 @@ pub fn bindy_pyo3(input: TokenStream) -> TokenStream { let mut output = quote!(); let mut module = quote!(); - for (name, binding) in bindy.bindings { + for (name, binding) in bindings { let bound_ident = Ident::new(&name, Span::mixed_site()); match &binding { diff --git a/napi/index.d.ts b/napi/index.d.ts index a6b13618..1e12b591 100644 --- a/napi/index.d.ts +++ b/napi/index.d.ts @@ -3,14 +3,6 @@ /* auto-generated by NAPI-RS */ -export declare function fromHex(value: string): Uint8Array -export declare function toHex(value: Uint8Array): string -export declare function bytesEqual(lhs: Uint8Array, rhs: Uint8Array): boolean -export declare function treeHashAtom(atom: Uint8Array): Uint8Array -export declare function treeHashPair(first: Uint8Array, rest: Uint8Array): Uint8Array -export declare function sha256(value: Uint8Array): Uint8Array -export declare function curryTreeHash(program: Uint8Array, args: Array): Uint8Array -export declare function generateBytes(bytes: number): Uint8Array export declare function standardPuzzleHash(syntheticKey: PublicKey): Uint8Array export declare function catPuzzleHash(assetId: Uint8Array, innerPuzzleHash: Uint8Array): Uint8Array export declare function mOfNHash(config: MemberConfig, required: number, items: Array): Uint8Array @@ -32,216 +24,14 @@ export declare function preventConditionOpcodeRestriction(conditionOpcode: numbe export declare function preventMultipleCreateCoinsRestriction(): Restriction export declare function preventSideEffectsRestriction(): Array export declare function wrappedDelegatedPuzzleHash(restrictions: Array, delegatedPuzzleHash: Uint8Array): Uint8Array -export declare class Constants { - static defaultMetadataUpdaterHash(): Uint8Array -} -export declare class Clvm { - constructor() - addCoinSpend(coinSpend: CoinSpend): void - spendCoin(coin: Coin, spend: Spend): void - coinSpends(): Array - deserialize(value: Uint8Array): Program - deserializeWithBackrefs(value: Uint8Array): Program - pair(first: Program, rest: Program): Program - nil(): Program - string(value: string): Program - bool(value: boolean): Program - atom(value: Uint8Array): Program - list(value: Array): Program - delegatedSpend(conditions: Array): Spend - standardSpend(syntheticKey: PublicKey, spend: Spend): Spend - spendStandardCoin(coin: Coin, syntheticKey: PublicKey, spend: Spend): void - spendCatCoins(catSpends: Array): void - mintNfts(parentCoinId: Uint8Array, nftMints: Array): MintedNfts - spendNft(nft: Nft, innerSpend: Spend): void - mintVault(parentCoinId: Uint8Array, custodyHash: Uint8Array, memos: Program): VaultMint - mipsSpend(coin: Coin, delegatedSpend: Spend): MipsSpend - nftMetadata(value: NftMetadata): Program - remark(rest: Program): Program - aggSigParent(publicKey: PublicKey, message: Uint8Array): Program - aggSigPuzzle(publicKey: PublicKey, message: Uint8Array): Program - aggSigAmount(publicKey: PublicKey, message: Uint8Array): Program - aggSigPuzzleAmount(publicKey: PublicKey, message: Uint8Array): Program - aggSigParentAmount(publicKey: PublicKey, message: Uint8Array): Program - aggSigParentPuzzle(publicKey: PublicKey, message: Uint8Array): Program - aggSigUnsafe(publicKey: PublicKey, message: Uint8Array): Program - aggSigMe(publicKey: PublicKey, message: Uint8Array): Program - createCoin(puzzleHash: Uint8Array, amount: bigint, memos?: Program | undefined | null): Program - reserveFee(amount: bigint): Program - createCoinAnnouncement(message: Uint8Array): Program - createPuzzleAnnouncement(message: Uint8Array): Program - assertCoinAnnouncement(announcementId: Uint8Array): Program - assertPuzzleAnnouncement(announcementId: Uint8Array): Program - assertConcurrentSpend(coinId: Uint8Array): Program - assertConcurrentPuzzle(puzzleHash: Uint8Array): Program - assertSecondsRelative(seconds: bigint): Program - assertSecondsAbsolute(seconds: bigint): Program - assertHeightRelative(height: number): Program - assertHeightAbsolute(height: number): Program - assertBeforeSecondsRelative(seconds: bigint): Program - assertBeforeSecondsAbsolute(seconds: bigint): Program - assertBeforeHeightRelative(height: number): Program - assertBeforeHeightAbsolute(height: number): Program - assertMyCoinId(coinId: Uint8Array): Program - assertMyParentId(parentId: Uint8Array): Program - assertMyPuzzleHash(puzzleHash: Uint8Array): Program - assertMyAmount(amount: bigint): Program - assertMyBirthSeconds(seconds: bigint): Program - assertMyBirthHeight(height: number): Program - assertEphemeral(): Program - sendMessage(mode: number, message: Uint8Array, data: Array): Program - receiveMessage(mode: number, message: Uint8Array, data: Array): Program - softfork(cost: bigint, rest: Program): Program - alloc(value: any): Program - int(value: number): Program - bigInt(value: bigint): Program -} -export declare class Program { - serialize(): Uint8Array - serializeWithBackrefs(): Uint8Array - run(solution: Program, maxCost: bigint, mempoolMode: boolean): Output - curry(args: Array): Program - uncurry(): CurriedProgram | null - treeHash(): Uint8Array - length(): number - first(): Program - rest(): Program - toString(): string | null - toBool(): boolean | null - toAtom(): Uint8Array | null - toList(): Array | null - toPair(): Pair | null - puzzle(): Puzzle - parseNftMetadata(): NftMetadata | null - parseRemark(): Remark | null - parseAggSigParent(): AggSigParent | null - parseAggSigPuzzle(): AggSigPuzzle | null - parseAggSigAmount(): AggSigAmount | null - parseAggSigPuzzleAmount(): AggSigPuzzleAmount | null - parseAggSigParentAmount(): AggSigParentAmount | null - parseAggSigParentPuzzle(): AggSigParentPuzzle | null - parseAggSigUnsafe(): AggSigUnsafe | null - parseAggSigMe(): AggSigMe | null - parseCreateCoin(): CreateCoin | null - parseReserveFee(): ReserveFee | null - parseCreateCoinAnnouncement(): CreateCoinAnnouncement | null - parseCreatePuzzleAnnouncement(): CreatePuzzleAnnouncement | null - parseAssertCoinAnnouncement(): AssertCoinAnnouncement | null - parseAssertPuzzleAnnouncement(): AssertPuzzleAnnouncement | null - parseAssertConcurrentSpend(): AssertConcurrentSpend | null - parseAssertConcurrentPuzzle(): AssertConcurrentPuzzle | null - parseAssertSecondsRelative(): AssertSecondsRelative | null - parseAssertSecondsAbsolute(): AssertSecondsAbsolute | null - parseAssertHeightRelative(): AssertHeightRelative | null - parseAssertHeightAbsolute(): AssertHeightAbsolute | null - parseAssertBeforeSecondsRelative(): AssertBeforeSecondsRelative | null - parseAssertBeforeSecondsAbsolute(): AssertBeforeSecondsAbsolute | null - parseAssertBeforeHeightRelative(): AssertBeforeHeightRelative | null - parseAssertBeforeHeightAbsolute(): AssertBeforeHeightAbsolute | null - parseAssertMyCoinId(): AssertMyCoinId | null - parseAssertMyParentId(): AssertMyParentId | null - parseAssertMyPuzzleHash(): AssertMyPuzzleHash | null - parseAssertMyAmount(): AssertMyAmount | null - parseAssertMyBirthSeconds(): AssertMyBirthSeconds | null - parseAssertMyBirthHeight(): AssertMyBirthHeight | null - parseAssertEphemeral(): AssertEphemeral | null - parseSendMessage(): SendMessage | null - parseReceiveMessage(): ReceiveMessage | null - parseSoftfork(): Softfork | null - toInt(): number | null - toBigInt(): bigint | null -} -export declare class Puzzle { - parseNft(): ParsedNft | null - parseChildNft(parentCoin: Coin, parentPuzzle: Program, parentSolution: Program): Nft | null - constructor(puzzleHash: Uint8Array, program: Program, modHash: Uint8Array, args?: Program | undefined | null) - get puzzleHash(): Uint8Array - set puzzleHash(value: Uint8Array) - get program(): Program - set program(value: Program) - get modHash(): Uint8Array - set modHash(value: Uint8Array) - get args(): Program | null - set args(value?: Program | undefined | null) -} -export declare class Simulator { - constructor() - newCoin(puzzleHash: Uint8Array, amount: bigint): Coin - bls(amount: bigint): BlsPairWithCoin - spendCoins(coinSpends: Array, secretKeys: Array): void -} -export declare class Output { - constructor(value: Program, cost: bigint) - get value(): Program - set value(value: Program) - get cost(): bigint - set cost(value: bigint) -} -export declare class Pair { - constructor(first: Program, rest: Program) - get first(): Program - set first(value: Program) - get rest(): Program - set rest(value: Program) -} -export declare class CurriedProgram { - constructor(program: Program, args: Array) - get program(): Program - set program(value: Program) - get args(): Array - set args(value: Array) -} -export declare class Address { - encode(): string - static decode(address: string): Address - constructor(puzzleHash: Uint8Array, prefix: string) - get puzzleHash(): Uint8Array - set puzzleHash(value: Uint8Array) - get prefix(): string - set prefix(value: string) -} -export declare class Mnemonic { - constructor(mnemonic: string) - static fromEntropy(entropy: Uint8Array): Mnemonic - static generate(use24: boolean): Mnemonic - static verify(mnemonic: string): boolean - toString(): string - toEntropy(): Uint8Array - toSeed(password: string): Uint8Array -} -export declare class Coin { - coinId(): Uint8Array - constructor(parentCoinInfo: Uint8Array, puzzleHash: Uint8Array, amount: bigint) - get parentCoinInfo(): Uint8Array - set parentCoinInfo(value: Uint8Array) - get puzzleHash(): Uint8Array - set puzzleHash(value: Uint8Array) - get amount(): bigint - set amount(value: bigint) -} -export declare class CoinSpend { - constructor(coin: Coin, puzzleReveal: Uint8Array, solution: Uint8Array) - get coin(): Coin - set coin(value: Coin) - get puzzleReveal(): Uint8Array - set puzzleReveal(value: Uint8Array) - get solution(): Uint8Array - set solution(value: Uint8Array) -} -export declare class SpendBundle { - constructor(coinSpends: Array, aggregatedSignature: Signature) - get coinSpends(): Array - set coinSpends(value: Array) - get aggregatedSignature(): Signature - set aggregatedSignature(value: Signature) -} -export declare class Spend { - constructor(puzzle: Program, solution: Program) - get puzzle(): Program - set puzzle(value: Program) - get solution(): Program - set solution(value: Program) -} +export declare function fromHex(value: string): Uint8Array +export declare function toHex(value: Uint8Array): string +export declare function bytesEqual(lhs: Uint8Array, rhs: Uint8Array): boolean +export declare function treeHashAtom(atom: Uint8Array): Uint8Array +export declare function treeHashPair(first: Uint8Array, rest: Uint8Array): Uint8Array +export declare function sha256(value: Uint8Array): Uint8Array +export declare function curryTreeHash(program: Uint8Array, args: Array): Uint8Array +export declare function generateBytes(bytes: number): Uint8Array export declare class SecretKey { static fromSeed(seed: Uint8Array): SecretKey static fromBytes(bytes: Uint8Array): SecretKey @@ -276,84 +66,18 @@ export declare class Signature { isInfinity(): boolean isValid(): boolean } -export declare class K1SecretKey { - static fromBytes(bytes: Uint8Array): K1SecretKey - toBytes(): Uint8Array - publicKey(): K1PublicKey - signPrehashed(prehashed: Uint8Array): K1Signature -} -export declare class K1PublicKey { - static fromBytes(bytes: Uint8Array): K1PublicKey - toBytes(): Uint8Array - fingerprint(): number - verifyPrehashed(prehashed: Uint8Array, signature: K1Signature): boolean -} -export declare class K1Signature { - static fromBytes(bytes: Uint8Array): K1Signature - toBytes(): Uint8Array -} -export declare class R1SecretKey { - static fromBytes(bytes: Uint8Array): R1SecretKey - toBytes(): Uint8Array - publicKey(): R1PublicKey - signPrehashed(prehashed: Uint8Array): R1Signature -} -export declare class R1PublicKey { - static fromBytes(bytes: Uint8Array): R1PublicKey - toBytes(): Uint8Array - fingerprint(): number - verifyPrehashed(prehashed: Uint8Array, signature: R1Signature): boolean -} -export declare class R1Signature { - static fromBytes(bytes: Uint8Array): R1Signature - toBytes(): Uint8Array -} -export declare class BlsPair { - static fromSeed(seed: bigint): BlsPair - static manyFromSeed(seed: bigint, count: number): Array - constructor(sk: SecretKey, pk: PublicKey) - get sk(): SecretKey - set sk(value: SecretKey) - get pk(): PublicKey - set pk(value: PublicKey) -} -export declare class BlsPairWithCoin { - constructor(sk: SecretKey, pk: PublicKey, puzzleHash: Uint8Array, coin: Coin) - get sk(): SecretKey - set sk(value: SecretKey) - get pk(): PublicKey - set pk(value: PublicKey) - get puzzleHash(): Uint8Array - set puzzleHash(value: Uint8Array) - get coin(): Coin - set coin(value: Coin) -} -export declare class K1Pair { - static fromSeed(seed: bigint): K1Pair - static manyFromSeed(seed: bigint, count: number): Array - constructor(sk: K1SecretKey, pk: K1PublicKey) - get sk(): K1SecretKey - set sk(value: K1SecretKey) - get pk(): K1PublicKey - set pk(value: K1PublicKey) -} -export declare class R1Pair { - static fromSeed(seed: bigint): R1Pair - static manyFromSeed(seed: bigint, count: number): Array - constructor(sk: R1SecretKey, pk: R1PublicKey) - get sk(): R1SecretKey - set sk(value: R1SecretKey) - get pk(): R1PublicKey - set pk(value: R1PublicKey) -} -export declare class LineageProof { - constructor(parentParentCoinInfo: Uint8Array, parentInnerPuzzleHash: Uint8Array | undefined | null, parentAmount: bigint) - get parentParentCoinInfo(): Uint8Array - set parentParentCoinInfo(value: Uint8Array) - get parentInnerPuzzleHash(): Uint8Array | null - set parentInnerPuzzleHash(value?: Uint8Array | undefined | null) - get parentAmount(): bigint - set parentAmount(value: bigint) +export declare class Puzzle { + parseNft(): ParsedNft | null + parseChildNft(parentCoin: Coin, parentPuzzle: Program, parentSolution: Program): Nft | null + constructor(puzzleHash: Uint8Array, program: Program, modHash: Uint8Array, args?: Program | undefined | null) + get puzzleHash(): Uint8Array + set puzzleHash(value: Uint8Array) + get program(): Program + set program(value: Program) + get modHash(): Uint8Array + set modHash(value: Uint8Array) + get args(): Program | null + set args(value?: Program | undefined | null) } export declare class Cat { constructor(coin: Coin, lineageProof: LineageProof | undefined | null, assetId: Uint8Array, p2PuzzleHash: Uint8Array) @@ -454,6 +178,61 @@ export declare class MintedNfts { get parentConditions(): Array set parentConditions(value: Array) } +export declare class Vault { + child(custodyHash: Uint8Array): Vault + constructor(coin: Coin, launcherId: Uint8Array, proof: LineageProof, custodyHash: Uint8Array) + get coin(): Coin + set coin(value: Coin) + get launcherId(): Uint8Array + set launcherId(value: Uint8Array) + get proof(): LineageProof + set proof(value: LineageProof) + get custodyHash(): Uint8Array + set custodyHash(value: Uint8Array) +} +export declare class MemberConfig { + constructor() + withTopLevel(topLevel: boolean): MemberConfig + withNonce(nonce: number): MemberConfig + withRestrictions(restrictions: Array): MemberConfig + get topLevel(): boolean + set topLevel(value: boolean) + get nonce(): number + set nonce(value: number) + get restrictions(): Array + set restrictions(value: Array) +} +export declare class Restriction { + constructor(kind: RestrictionKind, puzzleHash: Uint8Array) + get kind(): RestrictionKind + set kind(value: RestrictionKind) + get puzzleHash(): Uint8Array + set puzzleHash(value: Uint8Array) +} +export declare class MipsSpend { + spend(custodyHash: Uint8Array): Spend + spendVault(vault: Vault): void + mOfN(config: MemberConfig, required: number, items: Array): void + k1Member(config: MemberConfig, publicKey: K1PublicKey, signature: K1Signature, fastForward: boolean): void + r1Member(config: MemberConfig, publicKey: R1PublicKey, signature: R1Signature, fastForward: boolean): void + blsMember(config: MemberConfig, publicKey: PublicKey): void + passkeyMember(config: MemberConfig, publicKey: R1PublicKey, signature: R1Signature, authenticatorData: Uint8Array, clientDataJson: Uint8Array, challengeIndex: number, fastForward: boolean): void + singletonMember(config: MemberConfig, launcherId: Uint8Array, singletonInnerPuzzleHash: Uint8Array, singletonAmount: bigint): void + fixedPuzzleMember(config: MemberConfig, fixedPuzzleHash: Uint8Array): void + customMember(config: MemberConfig, spend: Spend): void + timelock(timelock: bigint): void + force1Of2RestrictedVariable(leftSideSubtreeHash: Uint8Array, nonce: number, memberValidatorListHash: Uint8Array, delegatedPuzzleValidatorListHash: Uint8Array, newRightSideMemberHash: Uint8Array): void + preventConditionOpcode(conditionOpcode: number): void + preventMultipleCreateCoins(): void + preventSideEffects(): void +} +export declare class VaultMint { + constructor(vault: Vault, parentConditions: Array) + get vault(): Vault + set vault(value: Vault) + get parentConditions(): Array + set parentConditions(value: Array) +} export declare class Remark { constructor(rest: Program) get rest(): Program @@ -657,58 +436,279 @@ export declare class Softfork { get rest(): Program set rest(value: Program) } -export declare class Vault { - child(custodyHash: Uint8Array): Vault - constructor(coin: Coin, launcherId: Uint8Array, proof: LineageProof, custodyHash: Uint8Array) +export declare class Mnemonic { + constructor(mnemonic: string) + static fromEntropy(entropy: Uint8Array): Mnemonic + static generate(use24: boolean): Mnemonic + static verify(mnemonic: string): boolean + toString(): string + toEntropy(): Uint8Array + toSeed(password: string): Uint8Array +} +export declare class Program { + serialize(): Uint8Array + serializeWithBackrefs(): Uint8Array + run(solution: Program, maxCost: bigint, mempoolMode: boolean): Output + curry(args: Array): Program + uncurry(): CurriedProgram | null + treeHash(): Uint8Array + length(): number + first(): Program + rest(): Program + toString(): string | null + toBool(): boolean | null + toAtom(): Uint8Array | null + toList(): Array | null + toPair(): Pair | null + puzzle(): Puzzle + parseNftMetadata(): NftMetadata | null + parseRemark(): Remark | null + parseAggSigParent(): AggSigParent | null + parseAggSigPuzzle(): AggSigPuzzle | null + parseAggSigAmount(): AggSigAmount | null + parseAggSigPuzzleAmount(): AggSigPuzzleAmount | null + parseAggSigParentAmount(): AggSigParentAmount | null + parseAggSigParentPuzzle(): AggSigParentPuzzle | null + parseAggSigUnsafe(): AggSigUnsafe | null + parseAggSigMe(): AggSigMe | null + parseCreateCoin(): CreateCoin | null + parseReserveFee(): ReserveFee | null + parseCreateCoinAnnouncement(): CreateCoinAnnouncement | null + parseCreatePuzzleAnnouncement(): CreatePuzzleAnnouncement | null + parseAssertCoinAnnouncement(): AssertCoinAnnouncement | null + parseAssertPuzzleAnnouncement(): AssertPuzzleAnnouncement | null + parseAssertConcurrentSpend(): AssertConcurrentSpend | null + parseAssertConcurrentPuzzle(): AssertConcurrentPuzzle | null + parseAssertSecondsRelative(): AssertSecondsRelative | null + parseAssertSecondsAbsolute(): AssertSecondsAbsolute | null + parseAssertHeightRelative(): AssertHeightRelative | null + parseAssertHeightAbsolute(): AssertHeightAbsolute | null + parseAssertBeforeSecondsRelative(): AssertBeforeSecondsRelative | null + parseAssertBeforeSecondsAbsolute(): AssertBeforeSecondsAbsolute | null + parseAssertBeforeHeightRelative(): AssertBeforeHeightRelative | null + parseAssertBeforeHeightAbsolute(): AssertBeforeHeightAbsolute | null + parseAssertMyCoinId(): AssertMyCoinId | null + parseAssertMyParentId(): AssertMyParentId | null + parseAssertMyPuzzleHash(): AssertMyPuzzleHash | null + parseAssertMyAmount(): AssertMyAmount | null + parseAssertMyBirthSeconds(): AssertMyBirthSeconds | null + parseAssertMyBirthHeight(): AssertMyBirthHeight | null + parseAssertEphemeral(): AssertEphemeral | null + parseSendMessage(): SendMessage | null + parseReceiveMessage(): ReceiveMessage | null + parseSoftfork(): Softfork | null + toInt(): number | null + toBigInt(): bigint | null +} +export declare class Output { + constructor(value: Program, cost: bigint) + get value(): Program + set value(value: Program) + get cost(): bigint + set cost(value: bigint) +} +export declare class Pair { + constructor(first: Program, rest: Program) + get first(): Program + set first(value: Program) + get rest(): Program + set rest(value: Program) +} +export declare class CurriedProgram { + constructor(program: Program, args: Array) + get program(): Program + set program(value: Program) + get args(): Array + set args(value: Array) +} +export declare class LineageProof { + constructor(parentParentCoinInfo: Uint8Array, parentInnerPuzzleHash: Uint8Array | undefined | null, parentAmount: bigint) + get parentParentCoinInfo(): Uint8Array + set parentParentCoinInfo(value: Uint8Array) + get parentInnerPuzzleHash(): Uint8Array | null + set parentInnerPuzzleHash(value?: Uint8Array | undefined | null) + get parentAmount(): bigint + set parentAmount(value: bigint) +} +export declare class Simulator { + constructor() + newCoin(puzzleHash: Uint8Array, amount: bigint): Coin + bls(amount: bigint): BlsPairWithCoin + spendCoins(coinSpends: Array, secretKeys: Array): void +} +export declare class BlsPair { + static fromSeed(seed: bigint): BlsPair + static manyFromSeed(seed: bigint, count: number): Array + constructor(sk: SecretKey, pk: PublicKey) + get sk(): SecretKey + set sk(value: SecretKey) + get pk(): PublicKey + set pk(value: PublicKey) +} +export declare class BlsPairWithCoin { + constructor(sk: SecretKey, pk: PublicKey, puzzleHash: Uint8Array, coin: Coin) + get sk(): SecretKey + set sk(value: SecretKey) + get pk(): PublicKey + set pk(value: PublicKey) + get puzzleHash(): Uint8Array + set puzzleHash(value: Uint8Array) get coin(): Coin set coin(value: Coin) - get launcherId(): Uint8Array - set launcherId(value: Uint8Array) - get proof(): LineageProof - set proof(value: LineageProof) - get custodyHash(): Uint8Array - set custodyHash(value: Uint8Array) } -export declare class MemberConfig { +export declare class K1Pair { + static fromSeed(seed: bigint): K1Pair + static manyFromSeed(seed: bigint, count: number): Array + constructor(sk: K1SecretKey, pk: K1PublicKey) + get sk(): K1SecretKey + set sk(value: K1SecretKey) + get pk(): K1PublicKey + set pk(value: K1PublicKey) +} +export declare class R1Pair { + static fromSeed(seed: bigint): R1Pair + static manyFromSeed(seed: bigint, count: number): Array + constructor(sk: R1SecretKey, pk: R1PublicKey) + get sk(): R1SecretKey + set sk(value: R1SecretKey) + get pk(): R1PublicKey + set pk(value: R1PublicKey) +} +export declare class Address { + encode(): string + static decode(address: string): Address + constructor(puzzleHash: Uint8Array, prefix: string) + get puzzleHash(): Uint8Array + set puzzleHash(value: Uint8Array) + get prefix(): string + set prefix(value: string) +} +export declare class Clvm { constructor() - withTopLevel(topLevel: boolean): MemberConfig - withNonce(nonce: number): MemberConfig - withRestrictions(restrictions: Array): MemberConfig - get topLevel(): boolean - set topLevel(value: boolean) - get nonce(): number - set nonce(value: number) - get restrictions(): Array - set restrictions(value: Array) + addCoinSpend(coinSpend: CoinSpend): void + spendCoin(coin: Coin, spend: Spend): void + coinSpends(): Array + deserialize(value: Uint8Array): Program + deserializeWithBackrefs(value: Uint8Array): Program + pair(first: Program, rest: Program): Program + nil(): Program + string(value: string): Program + bool(value: boolean): Program + atom(value: Uint8Array): Program + list(value: Array): Program + delegatedSpend(conditions: Array): Spend + standardSpend(syntheticKey: PublicKey, spend: Spend): Spend + spendStandardCoin(coin: Coin, syntheticKey: PublicKey, spend: Spend): void + spendCatCoins(catSpends: Array): void + mintNfts(parentCoinId: Uint8Array, nftMints: Array): MintedNfts + spendNft(nft: Nft, innerSpend: Spend): void + mintVault(parentCoinId: Uint8Array, custodyHash: Uint8Array, memos: Program): VaultMint + mipsSpend(coin: Coin, delegatedSpend: Spend): MipsSpend + nftMetadata(value: NftMetadata): Program + remark(rest: Program): Program + aggSigParent(publicKey: PublicKey, message: Uint8Array): Program + aggSigPuzzle(publicKey: PublicKey, message: Uint8Array): Program + aggSigAmount(publicKey: PublicKey, message: Uint8Array): Program + aggSigPuzzleAmount(publicKey: PublicKey, message: Uint8Array): Program + aggSigParentAmount(publicKey: PublicKey, message: Uint8Array): Program + aggSigParentPuzzle(publicKey: PublicKey, message: Uint8Array): Program + aggSigUnsafe(publicKey: PublicKey, message: Uint8Array): Program + aggSigMe(publicKey: PublicKey, message: Uint8Array): Program + createCoin(puzzleHash: Uint8Array, amount: bigint, memos?: Program | undefined | null): Program + reserveFee(amount: bigint): Program + createCoinAnnouncement(message: Uint8Array): Program + createPuzzleAnnouncement(message: Uint8Array): Program + assertCoinAnnouncement(announcementId: Uint8Array): Program + assertPuzzleAnnouncement(announcementId: Uint8Array): Program + assertConcurrentSpend(coinId: Uint8Array): Program + assertConcurrentPuzzle(puzzleHash: Uint8Array): Program + assertSecondsRelative(seconds: bigint): Program + assertSecondsAbsolute(seconds: bigint): Program + assertHeightRelative(height: number): Program + assertHeightAbsolute(height: number): Program + assertBeforeSecondsRelative(seconds: bigint): Program + assertBeforeSecondsAbsolute(seconds: bigint): Program + assertBeforeHeightRelative(height: number): Program + assertBeforeHeightAbsolute(height: number): Program + assertMyCoinId(coinId: Uint8Array): Program + assertMyParentId(parentId: Uint8Array): Program + assertMyPuzzleHash(puzzleHash: Uint8Array): Program + assertMyAmount(amount: bigint): Program + assertMyBirthSeconds(seconds: bigint): Program + assertMyBirthHeight(height: number): Program + assertEphemeral(): Program + sendMessage(mode: number, message: Uint8Array, data: Array): Program + receiveMessage(mode: number, message: Uint8Array, data: Array): Program + softfork(cost: bigint, rest: Program): Program + alloc(value: any): Program + int(value: number): Program + bigInt(value: bigint): Program } -export declare class Restriction { - constructor(kind: RestrictionKind, puzzleHash: Uint8Array) - get kind(): RestrictionKind - set kind(value: RestrictionKind) +export declare class Constants { + static defaultMetadataUpdaterHash(): Uint8Array +} +export declare class K1SecretKey { + static fromBytes(bytes: Uint8Array): K1SecretKey + toBytes(): Uint8Array + publicKey(): K1PublicKey + signPrehashed(prehashed: Uint8Array): K1Signature +} +export declare class K1PublicKey { + static fromBytes(bytes: Uint8Array): K1PublicKey + toBytes(): Uint8Array + fingerprint(): number + verifyPrehashed(prehashed: Uint8Array, signature: K1Signature): boolean +} +export declare class K1Signature { + static fromBytes(bytes: Uint8Array): K1Signature + toBytes(): Uint8Array +} +export declare class R1SecretKey { + static fromBytes(bytes: Uint8Array): R1SecretKey + toBytes(): Uint8Array + publicKey(): R1PublicKey + signPrehashed(prehashed: Uint8Array): R1Signature +} +export declare class R1PublicKey { + static fromBytes(bytes: Uint8Array): R1PublicKey + toBytes(): Uint8Array + fingerprint(): number + verifyPrehashed(prehashed: Uint8Array, signature: R1Signature): boolean +} +export declare class R1Signature { + static fromBytes(bytes: Uint8Array): R1Signature + toBytes(): Uint8Array +} +export declare class Coin { + coinId(): Uint8Array + constructor(parentCoinInfo: Uint8Array, puzzleHash: Uint8Array, amount: bigint) + get parentCoinInfo(): Uint8Array + set parentCoinInfo(value: Uint8Array) get puzzleHash(): Uint8Array set puzzleHash(value: Uint8Array) + get amount(): bigint + set amount(value: bigint) } -export declare class MipsSpend { - spend(custodyHash: Uint8Array): Spend - spendVault(vault: Vault): void - mOfN(config: MemberConfig, required: number, items: Array): void - k1Member(config: MemberConfig, publicKey: K1PublicKey, signature: K1Signature, fastForward: boolean): void - r1Member(config: MemberConfig, publicKey: R1PublicKey, signature: R1Signature, fastForward: boolean): void - blsMember(config: MemberConfig, publicKey: PublicKey): void - passkeyMember(config: MemberConfig, publicKey: R1PublicKey, signature: R1Signature, authenticatorData: Uint8Array, clientDataJson: Uint8Array, challengeIndex: number, fastForward: boolean): void - singletonMember(config: MemberConfig, launcherId: Uint8Array, singletonInnerPuzzleHash: Uint8Array, singletonAmount: bigint): void - fixedPuzzleMember(config: MemberConfig, fixedPuzzleHash: Uint8Array): void - customMember(config: MemberConfig, spend: Spend): void - timelock(timelock: bigint): void - force1Of2RestrictedVariable(leftSideSubtreeHash: Uint8Array, nonce: number, memberValidatorListHash: Uint8Array, delegatedPuzzleValidatorListHash: Uint8Array, newRightSideMemberHash: Uint8Array): void - preventConditionOpcode(conditionOpcode: number): void - preventMultipleCreateCoins(): void - preventSideEffects(): void +export declare class CoinSpend { + constructor(coin: Coin, puzzleReveal: Uint8Array, solution: Uint8Array) + get coin(): Coin + set coin(value: Coin) + get puzzleReveal(): Uint8Array + set puzzleReveal(value: Uint8Array) + get solution(): Uint8Array + set solution(value: Uint8Array) } -export declare class VaultMint { - constructor(vault: Vault, parentConditions: Array) - get vault(): Vault - set vault(value: Vault) - get parentConditions(): Array - set parentConditions(value: Array) +export declare class SpendBundle { + constructor(coinSpends: Array, aggregatedSignature: Signature) + get coinSpends(): Array + set coinSpends(value: Array) + get aggregatedSignature(): Signature + set aggregatedSignature(value: Signature) +} +export declare class Spend { + constructor(puzzle: Program, solution: Program) + get puzzle(): Program + set puzzle(value: Program) + get solution(): Program + set solution(value: Program) } diff --git a/napi/index.js b/napi/index.js index 868bb65e..8135b5d7 100644 --- a/napi/index.js +++ b/napi/index.js @@ -310,44 +310,12 @@ if (!nativeBinding) { throw new Error(`Failed to load native binding`) } -const { Constants, Clvm, Program, Puzzle, Simulator, Output, Pair, CurriedProgram, Address, Mnemonic, Coin, CoinSpend, SpendBundle, Spend, SecretKey, PublicKey, Signature, K1SecretKey, K1PublicKey, K1Signature, R1SecretKey, R1PublicKey, R1Signature, BlsPair, BlsPairWithCoin, K1Pair, R1Pair, fromHex, toHex, bytesEqual, treeHashAtom, treeHashPair, sha256, curryTreeHash, generateBytes, LineageProof, Cat, CatSpend, Nft, NftInfo, ParsedNft, NftMetadata, NftMint, DidOwner, MintedNfts, standardPuzzleHash, catPuzzleHash, Remark, AggSigParent, AggSigPuzzle, AggSigAmount, AggSigPuzzleAmount, AggSigParentAmount, AggSigParentPuzzle, AggSigUnsafe, AggSigMe, CreateCoin, ReserveFee, CreateCoinAnnouncement, CreatePuzzleAnnouncement, AssertCoinAnnouncement, AssertPuzzleAnnouncement, AssertConcurrentSpend, AssertConcurrentPuzzle, AssertSecondsRelative, AssertSecondsAbsolute, AssertHeightRelative, AssertHeightAbsolute, AssertBeforeSecondsRelative, AssertBeforeSecondsAbsolute, AssertBeforeHeightRelative, AssertBeforeHeightAbsolute, AssertMyCoinId, AssertMyParentId, AssertMyPuzzleHash, AssertMyAmount, AssertMyBirthSeconds, AssertMyBirthHeight, AssertEphemeral, SendMessage, ReceiveMessage, Softfork, Vault, MemberConfig, mOfNHash, k1MemberHash, r1MemberHash, blsMemberHash, passkeyMemberHash, singletonMemberHash, fixedMemberHash, customMemberHash, Restriction, RestrictionKind, timelockRestriction, force1Of2Restriction, preventConditionOpcodeRestriction, preventMultipleCreateCoinsRestriction, preventSideEffectsRestriction, MipsSpend, VaultMint, wrappedDelegatedPuzzleHash } = nativeBinding +const { SecretKey, PublicKey, Signature, Puzzle, Cat, CatSpend, Nft, NftInfo, ParsedNft, NftMetadata, NftMint, DidOwner, MintedNfts, standardPuzzleHash, catPuzzleHash, Vault, MemberConfig, mOfNHash, k1MemberHash, r1MemberHash, blsMemberHash, passkeyMemberHash, singletonMemberHash, fixedMemberHash, customMemberHash, Restriction, RestrictionKind, timelockRestriction, force1Of2Restriction, preventConditionOpcodeRestriction, preventMultipleCreateCoinsRestriction, preventSideEffectsRestriction, MipsSpend, VaultMint, wrappedDelegatedPuzzleHash, Remark, AggSigParent, AggSigPuzzle, AggSigAmount, AggSigPuzzleAmount, AggSigParentAmount, AggSigParentPuzzle, AggSigUnsafe, AggSigMe, CreateCoin, ReserveFee, CreateCoinAnnouncement, CreatePuzzleAnnouncement, AssertCoinAnnouncement, AssertPuzzleAnnouncement, AssertConcurrentSpend, AssertConcurrentPuzzle, AssertSecondsRelative, AssertSecondsAbsolute, AssertHeightRelative, AssertHeightAbsolute, AssertBeforeSecondsRelative, AssertBeforeSecondsAbsolute, AssertBeforeHeightRelative, AssertBeforeHeightAbsolute, AssertMyCoinId, AssertMyParentId, AssertMyPuzzleHash, AssertMyAmount, AssertMyBirthSeconds, AssertMyBirthHeight, AssertEphemeral, SendMessage, ReceiveMessage, Softfork, Mnemonic, Program, Output, Pair, CurriedProgram, LineageProof, Simulator, BlsPair, BlsPairWithCoin, K1Pair, R1Pair, Address, Clvm, Constants, fromHex, toHex, bytesEqual, treeHashAtom, treeHashPair, sha256, curryTreeHash, generateBytes, K1SecretKey, K1PublicKey, K1Signature, R1SecretKey, R1PublicKey, R1Signature, Coin, CoinSpend, SpendBundle, Spend } = nativeBinding -module.exports.Constants = Constants -module.exports.Clvm = Clvm -module.exports.Program = Program -module.exports.Puzzle = Puzzle -module.exports.Simulator = Simulator -module.exports.Output = Output -module.exports.Pair = Pair -module.exports.CurriedProgram = CurriedProgram -module.exports.Address = Address -module.exports.Mnemonic = Mnemonic -module.exports.Coin = Coin -module.exports.CoinSpend = CoinSpend -module.exports.SpendBundle = SpendBundle -module.exports.Spend = Spend module.exports.SecretKey = SecretKey module.exports.PublicKey = PublicKey module.exports.Signature = Signature -module.exports.K1SecretKey = K1SecretKey -module.exports.K1PublicKey = K1PublicKey -module.exports.K1Signature = K1Signature -module.exports.R1SecretKey = R1SecretKey -module.exports.R1PublicKey = R1PublicKey -module.exports.R1Signature = R1Signature -module.exports.BlsPair = BlsPair -module.exports.BlsPairWithCoin = BlsPairWithCoin -module.exports.K1Pair = K1Pair -module.exports.R1Pair = R1Pair -module.exports.fromHex = fromHex -module.exports.toHex = toHex -module.exports.bytesEqual = bytesEqual -module.exports.treeHashAtom = treeHashAtom -module.exports.treeHashPair = treeHashPair -module.exports.sha256 = sha256 -module.exports.curryTreeHash = curryTreeHash -module.exports.generateBytes = generateBytes -module.exports.LineageProof = LineageProof +module.exports.Puzzle = Puzzle module.exports.Cat = Cat module.exports.CatSpend = CatSpend module.exports.Nft = Nft @@ -359,6 +327,26 @@ module.exports.DidOwner = DidOwner module.exports.MintedNfts = MintedNfts module.exports.standardPuzzleHash = standardPuzzleHash module.exports.catPuzzleHash = catPuzzleHash +module.exports.Vault = Vault +module.exports.MemberConfig = MemberConfig +module.exports.mOfNHash = mOfNHash +module.exports.k1MemberHash = k1MemberHash +module.exports.r1MemberHash = r1MemberHash +module.exports.blsMemberHash = blsMemberHash +module.exports.passkeyMemberHash = passkeyMemberHash +module.exports.singletonMemberHash = singletonMemberHash +module.exports.fixedMemberHash = fixedMemberHash +module.exports.customMemberHash = customMemberHash +module.exports.Restriction = Restriction +module.exports.RestrictionKind = RestrictionKind +module.exports.timelockRestriction = timelockRestriction +module.exports.force1Of2Restriction = force1Of2Restriction +module.exports.preventConditionOpcodeRestriction = preventConditionOpcodeRestriction +module.exports.preventMultipleCreateCoinsRestriction = preventMultipleCreateCoinsRestriction +module.exports.preventSideEffectsRestriction = preventSideEffectsRestriction +module.exports.MipsSpend = MipsSpend +module.exports.VaultMint = VaultMint +module.exports.wrappedDelegatedPuzzleHash = wrappedDelegatedPuzzleHash module.exports.Remark = Remark module.exports.AggSigParent = AggSigParent module.exports.AggSigPuzzle = AggSigPuzzle @@ -394,23 +382,35 @@ module.exports.AssertEphemeral = AssertEphemeral module.exports.SendMessage = SendMessage module.exports.ReceiveMessage = ReceiveMessage module.exports.Softfork = Softfork -module.exports.Vault = Vault -module.exports.MemberConfig = MemberConfig -module.exports.mOfNHash = mOfNHash -module.exports.k1MemberHash = k1MemberHash -module.exports.r1MemberHash = r1MemberHash -module.exports.blsMemberHash = blsMemberHash -module.exports.passkeyMemberHash = passkeyMemberHash -module.exports.singletonMemberHash = singletonMemberHash -module.exports.fixedMemberHash = fixedMemberHash -module.exports.customMemberHash = customMemberHash -module.exports.Restriction = Restriction -module.exports.RestrictionKind = RestrictionKind -module.exports.timelockRestriction = timelockRestriction -module.exports.force1Of2Restriction = force1Of2Restriction -module.exports.preventConditionOpcodeRestriction = preventConditionOpcodeRestriction -module.exports.preventMultipleCreateCoinsRestriction = preventMultipleCreateCoinsRestriction -module.exports.preventSideEffectsRestriction = preventSideEffectsRestriction -module.exports.MipsSpend = MipsSpend -module.exports.VaultMint = VaultMint -module.exports.wrappedDelegatedPuzzleHash = wrappedDelegatedPuzzleHash +module.exports.Mnemonic = Mnemonic +module.exports.Program = Program +module.exports.Output = Output +module.exports.Pair = Pair +module.exports.CurriedProgram = CurriedProgram +module.exports.LineageProof = LineageProof +module.exports.Simulator = Simulator +module.exports.BlsPair = BlsPair +module.exports.BlsPairWithCoin = BlsPairWithCoin +module.exports.K1Pair = K1Pair +module.exports.R1Pair = R1Pair +module.exports.Address = Address +module.exports.Clvm = Clvm +module.exports.Constants = Constants +module.exports.fromHex = fromHex +module.exports.toHex = toHex +module.exports.bytesEqual = bytesEqual +module.exports.treeHashAtom = treeHashAtom +module.exports.treeHashPair = treeHashPair +module.exports.sha256 = sha256 +module.exports.curryTreeHash = curryTreeHash +module.exports.generateBytes = generateBytes +module.exports.K1SecretKey = K1SecretKey +module.exports.K1PublicKey = K1PublicKey +module.exports.K1Signature = K1Signature +module.exports.R1SecretKey = R1SecretKey +module.exports.R1PublicKey = R1PublicKey +module.exports.R1Signature = R1Signature +module.exports.Coin = Coin +module.exports.CoinSpend = CoinSpend +module.exports.SpendBundle = SpendBundle +module.exports.Spend = Spend