Skip to content

Commit c4196b0

Browse files
committed
fix sol vault decoding
1 parent 3275ae1 commit c4196b0

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

src/screens/Home/Home.tsx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,30 @@ function Home({ navigation }: Props) {
462462
error: 'Failed to parse EVM UserOp data',
463463
});
464464
}
465+
} else if (chainConf?.chainType === 'sol') {
466+
// Solana: rawUnsignedTx is a base64-encoded bundled tx (not UTXO
467+
// hex), so the UTXO decoder would throw. The recipients + fee +
468+
// source were captured by the relay at proposal-create time and
469+
// shipped in the signing payload itself, so we surface them
470+
// here for the UI. NOTE: this is NOT trustless verification
471+
// against the bundle bytes — a full Solana decoder would have
472+
// to borsh-decode create_transaction's inner message + walk the
473+
// SystemProgram.transfer / spl-token ixs. The wallet's
474+
// EnterpriseVaultSignTx uses the same synthetic-decode pattern.
475+
const rawRecipients = Array.isArray(data.recipients)
476+
? (data.recipients as Array<{ address: string; amount: string }>)
477+
: [];
478+
setDecodedVaultTx({
479+
sender:
480+
typeof data.sourceAddress === 'string'
481+
? data.sourceAddress
482+
: '',
483+
recipients: rawRecipients.map((r) => ({
484+
address: r.address,
485+
amount: r.amount,
486+
})),
487+
fee: typeof data.fee === 'string' ? data.fee : '0',
488+
});
465489
} else if (data.rawUnsignedTx) {
466490
// UTXO: decode from raw TX hex, pass first input scripts for sender derivation
467491
const inputs = Array.isArray(data.inputDetails)
@@ -1766,6 +1790,30 @@ function Home({ navigation }: Props) {
17661790
error: 'Failed to parse EVM UserOp data',
17671791
});
17681792
}
1793+
} else if (chainConf?.chainType === 'sol') {
1794+
// Solana: rawUnsignedTx is base64 bundled tx — surface the
1795+
// recipients/fee/source from the relay payload directly
1796+
// (same pattern as the wallet's EnterpriseVaultSignTx).
1797+
const rawRecipients = Array.isArray(vaultSignData.recipients)
1798+
? (vaultSignData.recipients as Array<{
1799+
address: string;
1800+
amount: string;
1801+
}>)
1802+
: [];
1803+
setDecodedVaultTx({
1804+
sender:
1805+
typeof vaultSignData.sourceAddress === 'string'
1806+
? vaultSignData.sourceAddress
1807+
: '',
1808+
recipients: rawRecipients.map((r) => ({
1809+
address: r.address,
1810+
amount: r.amount,
1811+
})),
1812+
fee:
1813+
typeof vaultSignData.fee === 'string'
1814+
? vaultSignData.fee
1815+
: '0',
1816+
});
17691817
} else if (vaultSignData.rawUnsignedTx) {
17701818
// UTXO: decode from raw TX hex, pass first input scripts for sender derivation
17711819
const inputs = Array.isArray(vaultSignData.inputDetails)

0 commit comments

Comments
 (0)