From 20d49d2f37f5bd1881bb59d48e3035ffc114425d Mon Sep 17 00:00:00 2001 From: Jon C Date: Fri, 2 May 2025 22:59:59 +0200 Subject: [PATCH 1/8] Upgrade default version --- install-solana-zig.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-solana-zig.sh b/install-solana-zig.sh index 1974a51..d5886d3 100755 --- a/install-solana-zig.sh +++ b/install-solana-zig.sh @@ -3,7 +3,7 @@ if [[ -n $SOLANA_ZIG_VERSION ]]; then solana_zig_version="$SOLANA_ZIG_VERSION" else - solana_zig_version="v1.43.0" + solana_zig_version="v1.47.0" fi solana_zig_release_url="https://github.com/joncinque/solana-zig-bootstrap/releases/download/solana-$solana_zig_version" From c51c599ba41884cf1e74db2c4b38529eb446a915 Mon Sep 17 00:00:00 2001 From: Jon C Date: Fri, 2 May 2025 23:00:08 +0200 Subject: [PATCH 2/8] Update helloworld program --- helloworld/zig/build.zig | 2 +- helloworld/zig/build.zig.zon | 13 +++++++------ helloworld/zig/main.zig | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/helloworld/zig/build.zig b/helloworld/zig/build.zig index 8c437b7..7097e73 100644 --- a/helloworld/zig/build.zig +++ b/helloworld/zig/build.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const solana = @import("solana-program-sdk"); +const solana = @import("solana_program_sdk"); pub fn build(b: *std.Build) !void { const target = b.resolveTargetQuery(solana.sbf_target); diff --git a/helloworld/zig/build.zig.zon b/helloworld/zig/build.zig.zon index 1465301..9190c3e 100644 --- a/helloworld/zig/build.zig.zon +++ b/helloworld/zig/build.zig.zon @@ -1,5 +1,6 @@ .{ - .name = "solana-program-rosetta-helloworld-zig", + .name = .solana_rosetta_helloworld, + .fingerprint = 0x34d885e7d0be5910, // This is a [Semantic Version](https://semver.org/). // In a future version of Zig it will be used for package deduplication. .version = "0.13.0", @@ -16,12 +17,12 @@ // internet connectivity. .dependencies = .{ .base58 = .{ - .url = "https://github.com/joncinque/base58-zig/archive/refs/tags/v0.13.3.tar.gz", - .hash = "1220fd067bf167b9062cc29ccf715ff97643c2d3f8958beea863b6036876bb71bcb8", + .url = "https://github.com/joncinque/base58-zig/archive/refs/tags/v0.14.0.tar.gz", + .hash = "base58-0.14.0-6-CZm81qAAD4JCRHgewcNh8FS0pmnk7-OmwUkosaFKvg", }, - .@"solana-program-sdk" = .{ - .url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.13.1.tar.gz", - .hash = "122030336f1257e3c0aa64243f5243f554b903c6b9ef3a91d48bfbe896c0c7d9b13b", + .solana_program_sdk = .{ + .url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.0.tar.gz", + .hash = "solana_program_sdk-0.16.0-wGj9UFDgAAA31EfM9LV-cmDP5BctyNwEVvyEWtZ1QPkj", }, }, diff --git a/helloworld/zig/main.zig b/helloworld/zig/main.zig index b6edb73..7f95503 100644 --- a/helloworld/zig/main.zig +++ b/helloworld/zig/main.zig @@ -1,4 +1,4 @@ -const sol = @import("solana-program-sdk"); +const sol = @import("solana_program_sdk"); export fn entrypoint(_: [*]u8) u64 { sol.log("Hello world!"); From 51e63efe7cfb0eb6558b36defd2e043e2ec44926 Mon Sep 17 00:00:00 2001 From: Jon C Date: Fri, 2 May 2025 23:00:29 +0200 Subject: [PATCH 3/8] Update CI version --- .github/workflows/main.yml | 2 +- helloworld/zig/build.zig.zon | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 33bd91d..27fe5ac 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,7 @@ on: - main env: - SOLANA_ZIG_VERSION: v1.43.0 + SOLANA_ZIG_VERSION: v1.47.0 SOLANA_ZIG_DIR: solana-zig SOLANA_C_DIR: solana-c-sdk SOLANA_LLVM_DIR: solana-llvm diff --git a/helloworld/zig/build.zig.zon b/helloworld/zig/build.zig.zon index 9190c3e..d08debe 100644 --- a/helloworld/zig/build.zig.zon +++ b/helloworld/zig/build.zig.zon @@ -8,7 +8,7 @@ // This field is optional. // This is currently advisory only; Zig does not yet do anything // with this value. - .minimum_zig_version = "0.13.0", + .minimum_zig_version = "0.14.0", // This field is optional. // Each dependency must either provide a `url` and `hash`, or a `path`. From 58121a9bdcbf8887295315a662d6c19004bcc896 Mon Sep 17 00:00:00 2001 From: Jon C Date: Fri, 2 May 2025 23:03:29 +0200 Subject: [PATCH 4/8] Update token program --- token/zig/build.zig | 2 +- token/zig/build.zig.zon | 11 ++++++----- token/zig/src/error.zig | 2 +- token/zig/src/id.zig | 2 +- token/zig/src/instruction.zig | 2 +- token/zig/src/main.zig | 2 +- token/zig/src/state.zig | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/token/zig/build.zig b/token/zig/build.zig index 7733836..5e81fe9 100644 --- a/token/zig/build.zig +++ b/token/zig/build.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const solana = @import("solana-program-sdk"); +const solana = @import("solana_program_sdk"); pub fn build(b: *std.Build) !void { const target = b.resolveTargetQuery(solana.sbf_target); diff --git a/token/zig/build.zig.zon b/token/zig/build.zig.zon index 4f1fd17..889b6c7 100644 --- a/token/zig/build.zig.zon +++ b/token/zig/build.zig.zon @@ -1,5 +1,6 @@ .{ - .name = "solana-program-rosetta-token-zig", + .name = .solana_rosetta_token, + .fingerprint = 0xc77c51400e78e0da, // This is a [Semantic Version](https://semver.org/). // In a future version of Zig it will be used for package deduplication. .version = "0.13.0", @@ -7,7 +8,7 @@ // This field is optional. // This is currently advisory only; Zig does not yet do anything // with this value. - .minimum_zig_version = "0.13.0", + .minimum_zig_version = "0.14.0", // This field is optional. // Each dependency must either provide a `url` and `hash`, or a `path`. @@ -15,9 +16,9 @@ // Once all dependencies are fetched, `zig build` no longer requires // internet connectivity. .dependencies = .{ - .@"solana-program-sdk" = .{ - .url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.15.1.tar.gz", - .hash = "12203631b9eba91c479991ec8f0525f181addb5879bbb96e256427f802c2ca67e108", + .solana_program_sdk = .{ + .url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.0.tar.gz", + .hash = "solana_program_sdk-0.16.0-wGj9UFDgAAA31EfM9LV-cmDP5BctyNwEVvyEWtZ1QPkj", }, }, diff --git a/token/zig/src/error.zig b/token/zig/src/error.zig index 356dcc9..a254198 100644 --- a/token/zig/src/error.zig +++ b/token/zig/src/error.zig @@ -1,4 +1,4 @@ -const sol = @import("solana-program-sdk"); +const sol = @import("solana_program_sdk"); pub const TokenError = error{ NotRentExempt, diff --git a/token/zig/src/id.zig b/token/zig/src/id.zig index a43c505..20a58d1 100644 --- a/token/zig/src/id.zig +++ b/token/zig/src/id.zig @@ -1,4 +1,4 @@ -const PublicKey = @import("solana-program-sdk").PublicKey; +const PublicKey = @import("solana_program_sdk").PublicKey; pub const id = PublicKey.comptimeFromBase58("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"); pub const native_mint_id = PublicKey.comptimeFromBase58("So11111111111111111111111111111111111111112"); pub const system_program_id = PublicKey.comptimeFromBase58("11111111111111111111111111111111"); diff --git a/token/zig/src/instruction.zig b/token/zig/src/instruction.zig index 430720d..2a151cf 100644 --- a/token/zig/src/instruction.zig +++ b/token/zig/src/instruction.zig @@ -1,6 +1,6 @@ const std = @import("std"); const COption = @import("state.zig").COption; -const PublicKey = @import("solana-program-sdk").PublicKey; +const PublicKey = @import("solana_program_sdk").PublicKey; pub const AuthorityType = enum(u8) { /// Authority to mint new tokens diff --git a/token/zig/src/main.zig b/token/zig/src/main.zig index 0816d7a..7991664 100644 --- a/token/zig/src/main.zig +++ b/token/zig/src/main.zig @@ -1,4 +1,4 @@ -const sol = @import("solana-program-sdk"); +const sol = @import("solana_program_sdk"); const PublicKey = sol.PublicKey; const Rent = sol.Rent; diff --git a/token/zig/src/state.zig b/token/zig/src/state.zig index 179ca50..539b95b 100644 --- a/token/zig/src/state.zig +++ b/token/zig/src/state.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const PublicKey = @import("solana-program-sdk").PublicKey; +const PublicKey = @import("solana_program_sdk").PublicKey; const TokenError = @import("error.zig").TokenError; pub const Mint = packed struct { From bc2f2ce28227cb2a1073b08d90aac135cd6bc480 Mon Sep 17 00:00:00 2001 From: Jon C Date: Fri, 2 May 2025 23:05:30 +0200 Subject: [PATCH 5/8] Update pubkey program --- pubkey/zig/build.zig | 2 +- pubkey/zig/build.zig.zon | 11 ++++++----- pubkey/zig/main.zig | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pubkey/zig/build.zig b/pubkey/zig/build.zig index 050adba..49118f3 100644 --- a/pubkey/zig/build.zig +++ b/pubkey/zig/build.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const solana = @import("solana-program-sdk"); +const solana = @import("solana_program_sdk"); pub fn build(b: *std.Build) !void { const target = b.resolveTargetQuery(solana.sbf_target); diff --git a/pubkey/zig/build.zig.zon b/pubkey/zig/build.zig.zon index 2410a7f..14f5e99 100644 --- a/pubkey/zig/build.zig.zon +++ b/pubkey/zig/build.zig.zon @@ -1,5 +1,6 @@ .{ - .name = "solana-program-rosetta-pubkey-zig", + .name = .solana_rosetta_pubkey, + .fingerprint = 0xa8636daaef29becd, // This is a [Semantic Version](https://semver.org/). // In a future version of Zig it will be used for package deduplication. .version = "0.13.0", @@ -7,7 +8,7 @@ // This field is optional. // This is currently advisory only; Zig does not yet do anything // with this value. - .minimum_zig_version = "0.13.0", + .minimum_zig_version = "0.14.0", // This field is optional. // Each dependency must either provide a `url` and `hash`, or a `path`. @@ -15,9 +16,9 @@ // Once all dependencies are fetched, `zig build` no longer requires // internet connectivity. .dependencies = .{ - .@"solana-program-sdk" = .{ - .url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.14.0.tar.gz", - .hash = "1220bdfa4ea1ab6330959ce4bc40feb5b39a7f98923a266a94b69e27fd20c3526786", + .solana_program_sdk = .{ + .url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.0.tar.gz", + .hash = "solana_program_sdk-0.16.0-wGj9UFDgAAA31EfM9LV-cmDP5BctyNwEVvyEWtZ1QPkj", }, }, .paths = .{ diff --git a/pubkey/zig/main.zig b/pubkey/zig/main.zig index 75cb39d..09ae1b2 100644 --- a/pubkey/zig/main.zig +++ b/pubkey/zig/main.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const PublicKey = @import("solana-program-sdk").PublicKey; +const PublicKey = @import("solana_program_sdk").PublicKey; export fn entrypoint(input: [*]u8) u64 { const id: *align(1) PublicKey = @ptrCast(input + 16); From d59d64d876c37eff784fd6928ea0aba8efd4bb24 Mon Sep 17 00:00:00 2001 From: Jon C Date: Fri, 2 May 2025 23:08:34 +0200 Subject: [PATCH 6/8] Update transfer-lamports --- README.md | 2 +- transfer-lamports/zig/build.zig | 2 +- transfer-lamports/zig/build.zig.zon | 11 ++++++----- transfer-lamports/zig/main.zig | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 40fd029..d9fa5ab 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ on-chain programs, but it can be expensive. | Language | CU Usage | | --- | --- | | Rust | 14 | -| Zig | 15 | +| Zig | 19 | ### Token diff --git a/transfer-lamports/zig/build.zig b/transfer-lamports/zig/build.zig index 1c2b386..e99fa26 100644 --- a/transfer-lamports/zig/build.zig +++ b/transfer-lamports/zig/build.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const solana = @import("solana-program-sdk"); +const solana = @import("solana_program_sdk"); pub fn build(b: *std.Build) !void { const target = b.resolveTargetQuery(solana.sbf_target); diff --git a/transfer-lamports/zig/build.zig.zon b/transfer-lamports/zig/build.zig.zon index b294afb..ba29a2b 100644 --- a/transfer-lamports/zig/build.zig.zon +++ b/transfer-lamports/zig/build.zig.zon @@ -1,5 +1,6 @@ .{ - .name = "solana-program-rosetta-helloworld-zig", + .name = .solana_rosetta_transfer_lamports, + .fingerprint = 0x1ecd6515ce9d93ec, // This is a [Semantic Version](https://semver.org/). // In a future version of Zig it will be used for package deduplication. .version = "0.13.0", @@ -7,7 +8,7 @@ // This field is optional. // This is currently advisory only; Zig does not yet do anything // with this value. - .minimum_zig_version = "0.13.0", + .minimum_zig_version = "0.14.0", // This field is optional. // Each dependency must either provide a `url` and `hash`, or a `path`. @@ -15,9 +16,9 @@ // Once all dependencies are fetched, `zig build` no longer requires // internet connectivity. .dependencies = .{ - .@"solana-program-sdk" = .{ - .url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.15.1.tar.gz", - .hash = "12203631b9eba91c479991ec8f0525f181addb5879bbb96e256427f802c2ca67e108", + .solana_program_sdk = .{ + .url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.0.tar.gz", + .hash = "solana_program_sdk-0.16.0-wGj9UFDgAAA31EfM9LV-cmDP5BctyNwEVvyEWtZ1QPkj", }, }, .paths = .{ diff --git a/transfer-lamports/zig/main.zig b/transfer-lamports/zig/main.zig index 6903a42..0914d90 100644 --- a/transfer-lamports/zig/main.zig +++ b/transfer-lamports/zig/main.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const sol = @import("solana-program-sdk"); +const sol = @import("solana_program_sdk"); export fn entrypoint(input: [*]u8) u64 { const context = sol.Context.load(input) catch return 1; From 146ba2ae0562add6865e0dc2ddc54ff228ecc3d2 Mon Sep 17 00:00:00 2001 From: Jon C Date: Sun, 17 Aug 2025 22:27:44 +0200 Subject: [PATCH 7/8] Update cpi --- cpi/zig/build.zig | 8 ++++---- cpi/zig/build.zig.zon | 35 +++++++++-------------------------- cpi/zig/main.zig | 4 ++-- 3 files changed, 15 insertions(+), 32 deletions(-) diff --git a/cpi/zig/build.zig b/cpi/zig/build.zig index afb481c..6134c75 100644 --- a/cpi/zig/build.zig +++ b/cpi/zig/build.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const solana = @import("solana-program-sdk"); +const solana = @import("solana_program_sdk"); pub fn build(b: *std.Build) !void { const target = b.resolveTargetQuery(solana.sbf_target); @@ -7,8 +7,8 @@ pub fn build(b: *std.Build) !void { const dep_opts = .{ .target = target, .optimize = optimize }; - const solana_lib_dep = b.dependency("solana-program-library", dep_opts); - const solana_lib_mod = solana_lib_dep.module("solana-program-library"); + const solana_lib_dep = b.dependency("solana_program_library", dep_opts); + const solana_lib_mod = solana_lib_dep.module("solana_program_library"); const program = b.addSharedLibrary(.{ .name = "solana_program_rosetta_cpi", @@ -17,7 +17,7 @@ pub fn build(b: *std.Build) !void { .optimize = optimize, }); - program.root_module.addImport("solana-program-library", solana_lib_mod); + program.root_module.addImport("solana_program_library", solana_lib_mod); _ = solana.buildProgram(b, program, target, optimize); diff --git a/cpi/zig/build.zig.zon b/cpi/zig/build.zig.zon index 3bb9ad4..c63afe7 100644 --- a/cpi/zig/build.zig.zon +++ b/cpi/zig/build.zig.zon @@ -1,38 +1,21 @@ .{ - .name = "solana-program-rosetta-cpi-zig", - // This is a [Semantic Version](https://semver.org/). - // In a future version of Zig it will be used for package deduplication. + .fingerprint = 0x32a89e177ff27d07, + .name = .solana_program_rosetta_cpi, .version = "0.13.0", + .minimum_zig_version = "0.14.0", - // This field is optional. - // This is currently advisory only; Zig does not yet do anything - // with this value. - .minimum_zig_version = "0.13.0", - - // This field is optional. - // Each dependency must either provide a `url` and `hash`, or a `path`. - // `zig build --fetch` can be used to fetch all dependencies of a package, recursively. - // Once all dependencies are fetched, `zig build` no longer requires - // internet connectivity. .dependencies = .{ - .@"solana-program-sdk" = .{ - .url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.14.0.tar.gz", - .hash = "1220bdfa4ea1ab6330959ce4bc40feb5b39a7f98923a266a94b69e27fd20c3526786", + .solana_program_sdk = .{ + .url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.2.tar.gz", + .hash = "solana_program_sdk-0.16.2-wGj9UHXjAAAK5z6ZdLUJ5uu2SxgE8o7ZJ9Il4EG22IJP", }, - .@"solana-program-library" = .{ - .url = "https://github.com/joncinque/solana-program-library-zig/archive/refs/tags/v0.14.0.tar.gz", - .hash = "1220b5f9dbfa8e36b67c4bcbddb44d1e74a1c8eda0f10f485c553f4a316994e1a3d5", + .solana_program_library = .{ + .url = "https://github.com/joncinque/solana-program-library-zig/archive/refs/tags/v0.15.1.tar.gz", + .hash = "solana_program_library-0.15.1-10r-le4EAQBXCYrq-CeWEKfTnJEh29ErMm8tA46Mi2Dd", }, }, - // Specifies the set of files and directories that are included in this package. - // Only files and directories listed here are included in the `hash` that - // is computed for this package. - // Paths are relative to the build root. Use the empty string (`""`) to refer to - // the build root itself. - // A directory listed here means that all files within, recursively, are included. .paths = .{ - // For example... "build.zig", "build.zig.zon", "src", diff --git a/cpi/zig/main.zig b/cpi/zig/main.zig index c83861e..ed967bf 100644 --- a/cpi/zig/main.zig +++ b/cpi/zig/main.zig @@ -1,5 +1,5 @@ -const sol = @import("solana-program-sdk"); -const sol_lib = @import("solana-program-library"); +const sol = @import("solana_program_sdk"); +const sol_lib = @import("solana_program_library"); const system_ix = sol_lib.system; const SIZE = 42; From 6866f37dd121f5e996142f03bcfc82092888bbe1 Mon Sep 17 00:00:00 2001 From: Jon C Date: Sun, 17 Aug 2025 22:43:58 +0200 Subject: [PATCH 8/8] Update all programs to 0.16.2, update CU numbers --- README.md | 16 ++++++++-------- helloworld/zig/build.zig.zon | 4 ++-- pubkey/zig/build.zig.zon | 4 ++-- token/zig/build.zig.zon | 4 ++-- token/zig/src/instruction.zig | 30 +++++++++++++++--------------- token/zig/src/state.zig | 8 ++++---- 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index d9fa5ab..d2aea7f 100644 --- a/README.md +++ b/README.md @@ -186,7 +186,7 @@ address and `invoke_signed` to CPI to the system program. | Language | CU Usage | CU Usage (minus syscalls) | | --- | --- | --- | | Rust | 3698 | 1198 | -| Zig | 2825 | 325 | +| Zig | 2809 | 309 | | C | 3122 | 622 | | Rust (pinocchio) | 2816 | 316 | @@ -202,7 +202,7 @@ on-chain programs, but it can be expensive. | Language | CU Usage | | --- | --- | | Rust | 14 | -| Zig | 19 | +| Zig | 15 | ### Token @@ -215,39 +215,39 @@ program. | Language | CU Usage | | --- | --- | | Rust | 1115 | -| Zig | 158 | +| Zig | 152 | * Initialize Account | Language | CU Usage | | --- | --- | | Rust | 2071 | -| Zig | 176 | +| Zig | 175 | * Mint To | Language | CU Usage | | --- | --- | | Rust | 2189 | -| Zig | 179 | +| Zig | 154 | * Transfer | Language | CU Usage | | --- | --- | | Rust | 2208 | -| Zig | 148 | +| Zig | 145 | * Burn | Language | CU Usage | | --- | --- | | Rust | 2045 | -| Zig | 145 | +| Zig | 141 | * Close Account | Language | CU Usage | | --- | --- | | Rust | 1483 | -| Zig | 130 | +| Zig | 122 | diff --git a/helloworld/zig/build.zig.zon b/helloworld/zig/build.zig.zon index d08debe..c664706 100644 --- a/helloworld/zig/build.zig.zon +++ b/helloworld/zig/build.zig.zon @@ -21,8 +21,8 @@ .hash = "base58-0.14.0-6-CZm81qAAD4JCRHgewcNh8FS0pmnk7-OmwUkosaFKvg", }, .solana_program_sdk = .{ - .url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.0.tar.gz", - .hash = "solana_program_sdk-0.16.0-wGj9UFDgAAA31EfM9LV-cmDP5BctyNwEVvyEWtZ1QPkj", + .url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.2.tar.gz", + .hash = "solana_program_sdk-0.16.2-wGj9UHXjAAAK5z6ZdLUJ5uu2SxgE8o7ZJ9Il4EG22IJP", }, }, diff --git a/pubkey/zig/build.zig.zon b/pubkey/zig/build.zig.zon index 14f5e99..7d4e546 100644 --- a/pubkey/zig/build.zig.zon +++ b/pubkey/zig/build.zig.zon @@ -17,8 +17,8 @@ // internet connectivity. .dependencies = .{ .solana_program_sdk = .{ - .url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.0.tar.gz", - .hash = "solana_program_sdk-0.16.0-wGj9UFDgAAA31EfM9LV-cmDP5BctyNwEVvyEWtZ1QPkj", + .url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.2.tar.gz", + .hash = "solana_program_sdk-0.16.2-wGj9UHXjAAAK5z6ZdLUJ5uu2SxgE8o7ZJ9Il4EG22IJP", }, }, .paths = .{ diff --git a/token/zig/build.zig.zon b/token/zig/build.zig.zon index 889b6c7..27d4763 100644 --- a/token/zig/build.zig.zon +++ b/token/zig/build.zig.zon @@ -17,8 +17,8 @@ // internet connectivity. .dependencies = .{ .solana_program_sdk = .{ - .url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.0.tar.gz", - .hash = "solana_program_sdk-0.16.0-wGj9UFDgAAA31EfM9LV-cmDP5BctyNwEVvyEWtZ1QPkj", + .url = "https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.2.tar.gz", + .hash = "solana_program_sdk-0.16.2-wGj9UHXjAAAK5z6ZdLUJ5uu2SxgE8o7ZJ9Il4EG22IJP", }, }, diff --git a/token/zig/src/instruction.zig b/token/zig/src/instruction.zig index 2a151cf..6b7d4ad 100644 --- a/token/zig/src/instruction.zig +++ b/token/zig/src/instruction.zig @@ -42,7 +42,7 @@ pub const InstructionDiscriminant = enum(u8) { }; pub fn IxOption(T: type) type { - return packed struct { + return extern struct { is_some: u8, value: T, const Self = @This(); @@ -81,7 +81,7 @@ pub fn IxOption(T: type) type { }; } -pub const InitializeMintData = packed struct { +pub const InitializeMintData = extern struct { /// Number of base 10 digits to the right of the decimal place. decimals: u8, /// The authority/multisignature to mint tokens. @@ -90,7 +90,7 @@ pub const InitializeMintData = packed struct { freeze_authority: IxOption(PublicKey), }; -pub const AmountData = packed struct { +pub const AmountData = extern struct { /// The amount of tokens to process. amount: u64, }; @@ -149,7 +149,7 @@ pub const Instruction = union(InstructionDiscriminant) { /// 1. `[]` Rent sysvar /// 2. ..2+N. `[]` The signer accounts, must equal to N where 1 <= N <= /// 11. - initialize_multisig: packed struct { + initialize_multisig: extern struct { /// The number of signers (M) required to validate this multisignature /// account. m: u8, @@ -213,7 +213,7 @@ pub const Instruction = union(InstructionDiscriminant) { /// 0. `[writable]` The mint or account to change the authority of. /// 1. `[]` The mint's or account's current multisignature authority. /// 2. ..2+M `[signer]` M signer accounts - set_authority: packed struct { + set_authority: extern struct { /// The type of authority to update. authority_type: AuthorityType, /// The new authority. @@ -321,7 +321,7 @@ pub const Instruction = union(InstructionDiscriminant) { /// 2. `[writable]` The destination account. /// 3. `[]` The source account's multisignature owner/delegate. /// 4. ..4+M `[signer]` M signer accounts. - transfer_checked: packed struct { + transfer_checked: extern struct { /// The amount of tokens to transfer. amount: u64, /// Expected number of base 10 digits to the right of the decimal place. @@ -348,7 +348,7 @@ pub const Instruction = union(InstructionDiscriminant) { /// 2. `[]` The delegate. /// 3. `[]` The source account's multisignature owner. /// 4. ..4+M `[signer]` M signer accounts - approve_checked: packed struct { + approve_checked: extern struct { /// The amount of tokens the delegate is approved for. amount: u64, /// Expected number of base 10 digits to the right of the decimal place. @@ -373,7 +373,7 @@ pub const Instruction = union(InstructionDiscriminant) { /// 1. `[writable]` The account to mint tokens to. /// 2. `[]` The mint's multisignature mint-tokens authority. /// 3. ..3+M `[signer]` M signer accounts. - mint_to_checked: packed struct { + mint_to_checked: extern struct { /// The amount of new tokens to mint. amount: u64, /// Expected number of base 10 digits to the right of the decimal place. @@ -399,7 +399,7 @@ pub const Instruction = union(InstructionDiscriminant) { /// 1. `[writable]` The token mint. /// 2. `[]` The account's multisignature owner/delegate. /// 3. ..3+M `[signer]` M signer accounts. - burn_checked: packed struct { + burn_checked: extern struct { /// The amount of tokens to burn. amount: u64, /// Expected number of base 10 digits to the right of the decimal place. @@ -415,7 +415,7 @@ pub const Instruction = union(InstructionDiscriminant) { /// 0. `[writable]` The account to initialize. /// 1. `[]` The mint this account will be associated with. /// 3. `[]` Rent sysvar - initialize_account_2: packed struct { + initialize_account_2: extern struct { /// The new account's owner/multisignature. owner_id: PublicKey, }, @@ -435,7 +435,7 @@ pub const Instruction = union(InstructionDiscriminant) { /// /// 0. `[writable]` The account to initialize. /// 1. `[]` The mint this account will be associated with. - initialize_account_3: packed struct { + initialize_account_3: extern struct { /// The new account's owner/multisignature. owner_id: PublicKey, }, @@ -446,7 +446,7 @@ pub const Instruction = union(InstructionDiscriminant) { /// 0. `[writable]` The multisignature account to initialize. /// 1. ..1+N. `[]` The signer accounts, must equal to N where 1 <= N <= /// 11. - initialize_multisig_2: packed struct { + initialize_multisig_2: extern struct { /// The number of signers (M) required to validate this multisignature /// account. m: u8, @@ -457,7 +457,7 @@ pub const Instruction = union(InstructionDiscriminant) { /// /// 0. `[writable]` The mint to initialize. /// - initialize_mint_2: packed struct { + initialize_mint_2: extern struct { /// Number of base 10 digits to the right of the decimal place. decimals: u8, /// The authority/multisignature to mint tokens. @@ -501,7 +501,7 @@ pub const Instruction = union(InstructionDiscriminant) { /// Accounts expected by this instruction: /// /// 0. `[]` The mint to calculate for - amount_to_ui_amount: packed struct { + amount_to_ui_amount: extern struct { /// The amount of tokens to reformat. amount: u64, }, @@ -514,7 +514,7 @@ pub const Instruction = union(InstructionDiscriminant) { /// Accounts expected by this instruction: /// /// 0. `[]` The mint to calculate for - ui_amount_to_amount: packed struct { + ui_amount_to_amount: extern struct { /// The ui_amount of tokens to reformat. ui_amount: [*:0]u8, }, diff --git a/token/zig/src/state.zig b/token/zig/src/state.zig index 539b95b..feacf0b 100644 --- a/token/zig/src/state.zig +++ b/token/zig/src/state.zig @@ -2,7 +2,7 @@ const std = @import("std"); const PublicKey = @import("solana_program_sdk").PublicKey; const TokenError = @import("error.zig").TokenError; -pub const Mint = packed struct { +pub const Mint = extern struct { pub const len = 82; mint_authority: COption(PublicKey), @@ -23,7 +23,7 @@ pub const Mint = packed struct { } }; -pub const Account = packed struct { +pub const Account = extern struct { pub const len = 165; pub const State = enum(u8) { @@ -61,7 +61,7 @@ pub const Account = packed struct { }; pub fn COption(T: type) type { - return packed struct { + return extern struct { is_some: u32, value: T, const Self = @This(); @@ -94,7 +94,7 @@ pub fn COption(T: type) type { }; } -pub const Multisig = packed struct { +pub const Multisig = extern struct { pub const len = 355; };