Skip to content

Commit 7f4da2e

Browse files
committed
refactor(wasm-dot): rename metadataHex to metadata in Material interface
Align field naming with BitGoJS Material interface so material objects can be passed directly without field mapping.
1 parent ede6160 commit 7f4da2e

9 files changed

Lines changed: 10 additions & 10 deletions

File tree

146 KB
Binary file not shown.

packages/wasm-dot/js/parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function createParseContext(ctx: ParseContext): ParseContextJs {
7070
ctx.material.specName,
7171
ctx.material.specVersion,
7272
ctx.material.txVersion,
73-
ctx.material.metadataHex,
73+
ctx.material.metadata,
7474
);
7575
return new ParseContextJs(material, ctx.sender ?? null);
7676
}

packages/wasm-dot/js/transaction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class DotTransaction {
115115
material.specName,
116116
material.specVersion,
117117
material.txVersion,
118-
material.metadataHex,
118+
material.metadata,
119119
);
120120
const validityJs = new ValidityJs(validity.firstValid, validity.maxDuration);
121121
this.inner.setContext(materialJs, validityJs, referenceBlock);
@@ -178,7 +178,7 @@ function createParseContext(ctx: ParseContext): ParseContextJs {
178178
ctx.material.specName,
179179
ctx.material.specVersion,
180180
ctx.material.txVersion,
181-
ctx.material.metadataHex,
181+
ctx.material.metadata,
182182
);
183183
return new ParseContextJs(material, ctx.sender ?? null);
184184
}

packages/wasm-dot/js/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface Material {
2525
/** Transaction format version */
2626
txVersion: number;
2727
/** Runtime metadata bytes (hex encoded) - required for encoding calls */
28-
metadataHex: string;
28+
metadata: string;
2929
}
3030

3131
/**

packages/wasm-dot/src/builder/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn build_transaction(
2121
context: BuildContext,
2222
) -> Result<Transaction, WasmDotError> {
2323
// Decode metadata once
24-
let metadata = decode_metadata(&context.material.metadata_hex)?;
24+
let metadata = decode_metadata(&context.material.metadata)?;
2525

2626
// Build call data using metadata
2727
let call_data = encode_call(&intent, &metadata)?;

packages/wasm-dot/src/builder/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ mod tests {
271271
"specName": "polkadot",
272272
"specVersion": 9150,
273273
"txVersion": 9,
274-
"metadataHex": "0x00"
274+
"metadata": "0x00"
275275
},
276276
"validity": {
277277
"firstValid": 1000,

packages/wasm-dot/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub struct Material {
1818
pub tx_version: u32,
1919
/// Runtime metadata bytes (hex encoded)
2020
/// Required for encoding calls - handles runtime upgrades automatically
21-
pub metadata_hex: String,
21+
pub metadata: String,
2222
}
2323

2424
/// Validity window for mortal transactions

packages/wasm-dot/src/wasm/transaction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl MaterialJs {
204204
spec_name: &str,
205205
spec_version: u32,
206206
tx_version: u32,
207-
metadata_hex: &str,
207+
metadata: &str,
208208
) -> MaterialJs {
209209
MaterialJs {
210210
inner: Material {
@@ -213,7 +213,7 @@ impl MaterialJs {
213213
spec_name: spec_name.to_string(),
214214
spec_version,
215215
tx_version,
216-
metadata_hex: metadata_hex.to_string(),
216+
metadata: metadata.to_string(),
217217
},
218218
}
219219
}

packages/wasm-dot/test/builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe("buildTransaction", () => {
1414
specName: "westend",
1515
specVersion: 9420,
1616
txVersion: 16,
17-
metadataHex: westendMetadataRpc,
17+
metadata: westendMetadataRpc,
1818
};
1919

2020
// Reference block (use genesis for testing)

0 commit comments

Comments
 (0)