Skip to content

Commit

Permalink
use sdk types
Browse files Browse the repository at this point in the history
  • Loading branch information
nialexsan committed Dec 17, 2024
1 parent 0c0e95b commit afba192
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/flow/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export async function createAccount(
publicKey: string,
sigAlgo: number,
hashAlgo: number,
authorization: fcl.Authorization
authorization: typeof fcl.authorization
) {
const result = await sendTransaction({
transaction: txCreateAccount,
Expand All @@ -69,7 +69,7 @@ export async function createAccount(
})

const accountCreatedEvent = result.events.find(
(event: fcl.Event) => event.type === accountCreatedEventType
event => event.type === accountCreatedEventType
)

if (!accountCreatedEvent) {
Expand Down
2 changes: 1 addition & 1 deletion lib/flow/fund.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const tokens: Tokens = {
export async function fundAccount(
address: string,
token: TokenType,
authorization: fcl.Authorization
authorization: typeof fcl.authorization
) {
const addressType = getAddressType(address)

Expand Down
4 changes: 2 additions & 2 deletions lib/flow/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import publicConfig from "../publicConfig"

fcl.config().put("accessNode.api", publicConfig.accessAPIHost)

export const getAuthorization = (keyIndex: number): fcl.Authorization => {
return async (account = {}) => {
export const getAuthorization = (keyIndex: number) => {
return async (account: {addr?: string} = {}) => {
return {
...account,
tempId: `${account.addr}-${keyIndex}`,
Expand Down
11 changes: 6 additions & 5 deletions lib/flow/send.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as fcl from "@onflow/fcl"
import * as sdk from "@onflow/sdk"

export async function sendTransaction({
transaction,
Expand All @@ -8,10 +9,10 @@ export async function sendTransaction({
payer,
}: {
transaction: string
args: fcl.TransactionArg[]
proposer: fcl.Authorization
authorizations: fcl.Authorization[]
payer: fcl.Authorization
args: sdk.CadenceArgument<any>[]
proposer: typeof fcl.authorization
authorizations: (typeof fcl.authorization)[]
payer: typeof fcl.authorization
}) {
const response = await fcl.send([
fcl.transaction(transaction),
Expand All @@ -30,7 +31,7 @@ export async function sendScript({
args,
}: {
script: string
args: fcl.TransactionArg[]
args: sdk.CadenceArgument<any>[]
}) {
return fcl.send([fcl.script(script), fcl.args(args)]).then(fcl.decode)
}
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"dependencies": {
"@hcaptcha/react-hcaptcha": "^1.8.1",
"@onflow/fcl": "^1.13.3",
"@onflow/sdk": "^1.5.5",
"@onflow/types": "^1.4.1",
"@prisma/client": "^5.2.0",
"@theme-ui/match-media": "^0.16.2",
Expand Down

0 comments on commit afba192

Please sign in to comment.