Skip to content

Commit

Permalink
Fix EVM.Address struct in funding transaction (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
jribbink authored Feb 26, 2024
1 parent 04cc488 commit 55e783c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/flow/fund.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ export async function fundAccount(
const {tx, amount} = tokens[addressType]

if (addressType === "FLOWEVM") {
const addressBytes = Array.from(Buffer.from(address, "hex")).map(b =>
const withoutPrefix = fcl.sansPrefix(address)
if (!withoutPrefix) {
throw new Error("Invalid address")
}
const addressBytes = Array.from(Buffer.from(withoutPrefix, "hex")).map(b =>
b.toString()
)

Expand All @@ -116,9 +120,10 @@ export async function fundAccount(
{
fields: [{name: "bytes", value: addressBytes}],
},
t.Struct(`A.${publicConfig.contractEVM}.EVM.EVMAddress`, [
{value: t.Array(t.UInt8)},
])
t.Struct(
`A.${fcl.sansPrefix(publicConfig.contractEVM)}.EVM.EVMAddress`,
[{value: t.Array(t.UInt8)}]
)
),
fcl.arg(amount, t.UFix64),
fcl.arg("60000", t.UInt64),
Expand Down

0 comments on commit 55e783c

Please sign in to comment.