{"id":48892887,"url":"https://github.com/glamsystems/ix-mapper-java","last_synced_at":"2026-05-31T03:01:02.898Z","repository":{"id":279464392,"uuid":"938816172","full_name":"glamsystems/ix-mapper-java","owner":"glamsystems","description":"Java SDK for mapping Solana instructions to GLAM program instructions.","archived":false,"fork":false,"pushed_at":"2026-05-31T01:11:39.000Z","size":357,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-05-31T02:28:20.327Z","etag":null,"topics":["glam","solana"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glamsystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-25T14:49:20.000Z","updated_at":"2026-05-31T01:10:28.000Z","dependencies_parsed_at":"2025-03-19T23:20:42.894Z","dependency_job_id":"175510ca-3cd9-43c8-8448-a3a30f9b2c34","html_url":"https://github.com/glamsystems/ix-mapper-java","commit_stats":null,"previous_names":["glamsystems/ix-converter","glamsystems/ix-proxy"],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/glamsystems/ix-mapper-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glamsystems%2Fix-mapper-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glamsystems%2Fix-mapper-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glamsystems%2Fix-mapper-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glamsystems%2Fix-mapper-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glamsystems","download_url":"https://codeload.github.com/glamsystems/ix-mapper-java/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glamsystems%2Fix-mapper-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33717419,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["glam","solana"],"created_at":"2026-04-16T09:39:23.701Z","updated_at":"2026-05-31T03:01:02.893Z","avatar_url":"https://github.com/glamsystems.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ixProxy [![Gradle Check](https://github.com/glamsystems/ix-proxy/actions/workflows/build.yml/badge.svg)](https://github.com/glamsystems/ix-proxy/actions/workflows/build.yml) [![Publish Release](https://github.com/glamsystems/ix-proxy/actions/workflows/publish.yml/badge.svg)](https://github.com/glamsystems/ix-proxy/actions/workflows/publish.yml)\n\nFacilitates the re-mapping of instructions from one program to another proxy program. The primary use case is to add\nadditional safety checks in the proxy program before and after forwarding the request to the original program.\n\n## [Transaction Mapper](https://github.com/glamsystems/ix-proxy/blob/main/ix-proxy/src/main/java/systems/glam/ix/proxy/TransactionMapper.java)\n\nThe transaction mapper can be used to map a list of instructions or entire transactions.\n\n### Example Construction\n\nA dynamic account factory is needed from the user to provide the functions for wiring runtime accounts.\n\nThis example uses a simple version that could be used for the GLAM proxy program.\n\n```java\nrecord GlamVaultAccounts(AccountMeta readGlamState,\n                         AccountMeta writeGlamState,\n                         AccountMeta readGlamVault,\n                         AccountMeta writeGlamVault) {\n\n  static GlamVaultAccounts createAccounts(final PublicKey stateAccount, final PublicKey vaultAccount) {\n    return new GlamVaultAccounts(\n        AccountMeta.createRead(stateAccount),\n        AccountMeta.createWrite(stateAccount),\n        AccountMeta.createRead(vaultAccount),\n        AccountMeta.createWrite(vaultAccount)\n    );\n  }\n}\n\nFunction\u003cDynamicAccountConfig, DynamicAccount\u003cGlamVaultAccounts\u003e\u003e dynamicAccountFactory = accountConfig -\u003e {\n  final int index = accountConfig.index();\n  final boolean w = accountConfig.writable();\n  return switch (accountConfig.name()) {\n    case \"glam_state\" -\u003e (mappedAccounts, _, _, vaultAccounts) -\u003e mappedAccounts[index] = w\n        ? vaultAccounts.writeGlamState() : vaultAccounts.readGlamState();\n    case \"glam_vault\" -\u003e (mappedAccounts, _, _, vaultAccounts) -\u003e mappedAccounts[index] = w\n        ? vaultAccounts.writeGlamVault() : vaultAccounts.readGlamVault();\n    case \"glam_signer\" -\u003e accountConfig.createFeePayerAccount();\n    case \"cpi_program\" -\u003e accountConfig.createReadCpiProgram();\n    default -\u003e throw new IllegalStateException(\"Unknown dynamic account type: \" + accountConfig.name());\n  };\n```\n\nThe following iterates over each mapping configuration file in a given directory.\nConstructs the corresponding program proxy for each and puts them in a map with the key being the source CPI program. \nThen finally the TransactionMapper is constructed. \n\n```java\n// Used to de-duplicate AccountMeta objects.\nvar accountMetaCache = new HashMap\u003cAccountMeta, AccountMeta\u003e(256);\nvar indexedAccountMetaCache = new HashMap\u003cIndexedAccountMeta, IndexedAccountMeta\u003e(256);\n\nvar proxyProgram = PublicKey.fromBase58Encoded(\"\");\nvar invokedProxyProgram = AccountMeta.createInvoked(proxyProgram);\nFunction\u003cDynamicAccountConfig, DynamicAccount\u003cA\u003e\u003e dynamicAccountFactory = null; // See example above.\n\nvar programKeyToProgramProxyMap = new HashMap\u003cPublicKey, ProgramProxy\u003cA\u003e\u003e();\n\nvar mappingFileDirectory = Path.of(\"path/to/mapping/config/files\");\ntry (final var paths = Files.walk(mappingFileDirectory, 1)) {\n  paths\n      .filter(Files::isRegularFile)\n      .filter(Files::isReadable)\n      .filter(f -\u003e f.getFileName().toString().endsWith(\".json\"))\n      .forEach(mappingFile -\u003e ProgramMapConfig.createProxies(\n          mappingFile,\n          invokedProxyProgram,\n          programKeyToProgramProxyMap,\n          dynamicAccountFactory,\n          accountMetaCache,\n          indexedAccountMetaCache\n      ));\n  \n  var txMapper = TransactionMapper.createMapper(invokedProxyProgram, programProxies);\n}\n```\n\n### Example Usage\n\n```java \n// Given some instructions or a transaction from any source.\nvar sourceInstructions = List.\u003cInstruction\u003eof();\nvar feePayer = AccountMeta.createFeePayer(PublicKey.fromBase58Encoded(\"\"));\nA runtimeAccounts = null; // See example above.\n\nInstruction[] mappedInstructions = txMapper.mapInstructions(\n    feePayer, \n    runtimeAccounts,\n    sourceInstructions\n);\n```\n\n## Program Mapping Configuration Files\n\nMapping files define the necessary information for translating a source program instruction that will be called via CPI\nfrom the destination proxy program.  More example configurations can be found in the [glam-sdk repository](https://github.com/glamsystems/glam-sdk/tree/main/remapping)\n\n### Example Configuration\n\n```json\n{\n  \"program_id\": \"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH\",\n  \"instructions\": [\n    {\n      \"src_ix_name\": \"cancel_orders\",\n      \"src_discriminator\": [\n        238,\n        225,\n        95,\n        158,\n        227,\n        103,\n        8,\n        194\n      ],\n      \"dst_ix_name\": \"drift_cancel_orders\",\n      \"dst_discriminator\": [\n        98,\n        107,\n        48,\n        79,\n        97,\n        60,\n        99,\n        58\n      ],\n      \"dynamic_accounts\": [\n        {\n          \"name\": \"glam_state\",\n          \"index\": 0,\n          \"writable\": false,\n          \"signer\": false\n        },\n        {\n          \"name\": \"glam_vault\",\n          \"index\": 1,\n          \"writable\": false,\n          \"signer\": false\n        },\n        {\n          \"name\": \"glam_signer\",\n          \"index\": 2,\n          \"writable\": true,\n          \"signer\": true\n        },\n        {\n          \"name\": \"cpi_program\",\n          \"index\": 3,\n          \"writable\": false,\n          \"signer\": false\n        }\n      ],\n      \"static_accounts\": [],\n      \"index_map\": [\n        4,\n        5,\n        -1\n      ]\n    }\n  ]\n}\n```\n\n### **src_discriminator**\n\nThe discriminator of the original instruction.\n\n### **dst_discriminator**\n\nThe discriminator of the proxy instruction.\n\n### **dynamic_accounts**\n\nAccount Meta information for accounts which can differ at runtime.\n\n### **static_accounts**\n\nAccount Meta information for accounts which are always the same given a Solana cluster such as mainnet.\n\n### **index_map**\n\nDefines the parameter index for the destination instruction. If the account has been removed or replaced use a negative\nnumber.\n\n## Build \u0026 Tests\n\nMapping configuration files from the [glam-sdk repository](https://github.com/glamsystems/glam-sdk/tree/main/remapping) \nare needed to run the tests.  Run [./downloadMappings.sh](downloadMappings.sh) to pull only those files into this project.\n\n### Sync Re-mapping JSON Files\n\n```shell\n./syncMappings.sh\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglamsystems%2Fix-mapper-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglamsystems%2Fix-mapper-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglamsystems%2Fix-mapper-java/lists"}