Skip to main content

Transactions — HCS‑7

Note

  • These builders are for direct transaction construction (e.g., with the Standards Agent Kit or custom pipelines).
  • For most applications, prefer higher‑level bridge/helpers in wasm-bridge.ts and evm-bridge.ts.

HCS‑7 defines message builders around two bridge modes: EVM and WASM. All payloads include p: 'hcs-7' and a matching op.

Sources

Generic Submit — buildHcs7SubmitMessageTx

Signature

buildHcs7SubmitMessageTx(params: {
topicId: string;
message: BaseMessage; // see wasm-bridge.ts
transactionMemo?: string;
}): TopicMessageSubmitTransaction

Example

const tx = buildHcs7SubmitMessageTx({
topicId: '0.0.123',
message: { op: 'evm', abi: 'transfer(address,uint256)', to: '0x...', data: '0x...', m: 'demo' },
transactionMemo: 'hcs-7 evm',
});

EVM Bridge — buildHcs7EvmMessageTx

Signature

buildHcs7EvmMessageTx(params: {
topicId: string;
config: Omit<EVMConfig, 'p' | 'op'> & { m?: string };
transactionMemo?: string;
}): TopicMessageSubmitTransaction

Example

import { buildHcs7EvmMessageTx } from '@hashgraphonline/standards-sdk';

const tx = buildHcs7EvmMessageTx({
topicId: '0.0.123',
config: {
abi: 'transfer(address,uint256)',
to: '0xabc...',
data: '0x...',
m: 'evm op',
},
});

WASM Bridge — buildHcs7WasmMessageTx

Signature

buildHcs7WasmMessageTx(params: {
topicId: string;
config: Omit<WASMConfig, 'p' | 'op'> & { m?: string };
transactionMemo?: string;
}): TopicMessageSubmitTransaction

Example

import { buildHcs7WasmMessageTx } from '@hashgraphonline/standards-sdk';

const tx = buildHcs7WasmMessageTx({
topicId: '0.0.123',
config: {
module: 'hcs://1/0.0.777',
func: 'process',
input: { x: 1, y: 2 },
m: 'wasm op',
},
transactionMemo: 'hcs-7 wasm',
});

Source