Skip to content

Commit

Permalink
Add tx send changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chasefleming committed Feb 23, 2024
1 parent 815a477 commit 92faf73
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
38 changes: 31 additions & 7 deletions lib/flow/fund.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,37 @@ export async function fundAccount(

const {tx, amount} = tokens[addressType]

await sendTransaction({
transaction: tx,
args: [fcl.arg(address, t.Address), fcl.arg(amount, t.UFix64)],
authorizations: [authorization],
payer: authorization,
proposer: authorization,
})
if (addressType === "FLOWEVM") {

Check failure on line 105 in lib/flow/fund.ts

View workflow job for this annotation

GitHub Actions / Static checks (20.x)

Replace `⏎····let·addressBytes·=·Array.from(Buffer.from(address,·"hex")).map(b·=>·b.toString()` with `····let·addressBytes·=·Array.from(Buffer.from(address,·"hex")).map(b·=>⏎······b.toString()⏎····`
let addressBytes = Array.from(Buffer.from(address, "hex")).map(b => b.toString())

Check failure on line 106 in lib/flow/fund.ts

View workflow job for this annotation

GitHub Actions / Static checks (20.x)

'addressBytes' is never reassigned. Use 'const' instead

await sendTransaction({
transaction: tx,
args: [
fcl.arg(

Check failure on line 111 in lib/flow/fund.ts

View workflow job for this annotation

GitHub Actions / Static checks (20.x)

Delete `··`
{

Check failure on line 112 in lib/flow/fund.ts

View workflow job for this annotation

GitHub Actions / Static checks (20.x)

Replace `··············` with `··········`
fields: [{name: "bytes", value: addressBytes}],

Check failure on line 113 in lib/flow/fund.ts

View workflow job for this annotation

GitHub Actions / Static checks (20.x)

Delete `····`
},

Check failure on line 114 in lib/flow/fund.ts

View workflow job for this annotation

GitHub Actions / Static checks (20.x)

Replace `··············` with `··········`
t.Struct(`A.${publicConfig.contractEVM}.EVM.EVMAddress`, [{value: t.Array(t.UInt8)}])

Check failure on line 115 in lib/flow/fund.ts

View workflow job for this annotation

GitHub Actions / Static checks (20.x)

Replace `··············t.Struct(`A.${publicConfig.contractEVM}.EVM.EVMAddress`,·[{value:·t.Array(t.UInt8)}])` with `··········t.Struct(`A.${publicConfig.contractEVM}.EVM.EVMAddress`,·[⏎············{value:·t.Array(t.UInt8)},`
),

Check failure on line 116 in lib/flow/fund.ts

View workflow job for this annotation

GitHub Actions / Static checks (20.x)

Replace `),` with `])`
fcl.arg(amount, t.UFix64),

Check failure on line 117 in lib/flow/fund.ts

View workflow job for this annotation

GitHub Actions / Static checks (20.x)

Insert `······),⏎`
fcl.arg("60000", t.UInt64),

Check failure on line 118 in lib/flow/fund.ts

View workflow job for this annotation

GitHub Actions / Static checks (20.x)

Delete `··`
],
authorizations: [authorization],
payer: authorization,
proposer: authorization,
})

} else {

await sendTransaction({
transaction: tx,
args: [fcl.arg(address, t.Address), fcl.arg(amount, t.UFix64)],
authorizations: [authorization],
payer: authorization,
proposer: authorization,
})

}
return amount
}
2 changes: 1 addition & 1 deletion modules.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ declare module "@onflow/fcl" {
export function script(script: string): unknown
export function decode(): unknown
export function authz(): Authorization
export function arg(encodedPublicKey: string, type: string): TransactionArg
export function arg(value: any, type: string): TransactionArg

Check warning on line 73 in modules.d.ts

View workflow job for this annotation

GitHub Actions / Static checks (20.x)

Unexpected any. Specify a different type
export function args(args: TransactionArg[]): unknown
export function authorizations(authorizations: Authorization[]): unknown
export function proposer(proposer: Authorization): unknown
Expand Down

0 comments on commit 92faf73

Please sign in to comment.