From 34ea018fad7cf8f1330a6462dcea1b2901b6f8dd Mon Sep 17 00:00:00 2001 From: Jordan Ribbink Date: Wed, 24 Jan 2024 09:20:57 -0800 Subject: [PATCH 1/3] PKG -- [sdk] Typescript fixes for SDK builders --- .changeset/old-ravens-perform.md | 5 + packages/sdk/src/build/build-arguments.ts | 28 +-- packages/sdk/src/build/build-payer.js | 7 +- packages/sdk/src/interaction/interaction.ts | 221 +++++++++++++------- packages/sdk/src/sdk.ts | 1 + packages/sdk/src/send/send.js | 2 +- 6 files changed, 167 insertions(+), 97 deletions(-) create mode 100644 .changeset/old-ravens-perform.md diff --git a/.changeset/old-ravens-perform.md b/.changeset/old-ravens-perform.md new file mode 100644 index 000000000..67713e9b2 --- /dev/null +++ b/.changeset/old-ravens-perform.md @@ -0,0 +1,5 @@ +--- +"@onflow/sdk": patch +--- + +Typescript fixes for SDK builders diff --git a/packages/sdk/src/build/build-arguments.ts b/packages/sdk/src/build/build-arguments.ts index 7b9ba8fc5..8c12abd5e 100644 --- a/packages/sdk/src/build/build-arguments.ts +++ b/packages/sdk/src/build/build-arguments.ts @@ -1,24 +1,24 @@ -import {pipe, makeArgument} from "../interaction/interaction" +import {pipe, makeArgument, CadenceArgument} from "../interaction/interaction" import {TypeDescriptorInput, TypeDescriptor} from "@onflow/types" /** - * @description - A utility builder to be used with other builders to pass in arguments with a value and supported type - * @param {Array.<*>} ax - An array of arguments - * @returns {Function} - An interaction object + * @description A utility builder to be used with other builders to pass in arguments with a value and supported type + * @param ax An array of arguments + * @returns An interaction object */ -export function args(ax = []) { +export function args(ax: CadenceArgument[]) { return pipe(ax.map(makeArgument)) } /** - * @description - A utility builder to be used with fcl.args[...] to create FCL supported arguments for interactions - * @param {any} value - The value of the argument - * @param {Function} xform - A function to transform the value - * @returns {object} - An argument object + * @description A utility builder to be used with fcl.args[...] to create FCL supported arguments for interactions + * @param value The value of the argument + * @param xform A function to transform the value + * @returns An argument object */ -export function arg>(value: TypeDescriptorInput, xform: T) { - return {value, xform} +export function arg>( + value: TypeDescriptorInput, + xform: T +) { + return {value, xform} as CadenceArgument } diff --git a/packages/sdk/src/build/build-payer.js b/packages/sdk/src/build/build-payer.js index bb16d233c..9073a787e 100644 --- a/packages/sdk/src/build/build-payer.js +++ b/packages/sdk/src/build/build-payer.js @@ -1,6 +1,11 @@ -import { TransactionRole } from "@onflow/typedefs" +import {TransactionRole} from "@onflow/typedefs" import {pipe, prepAccount} from "../interaction/interaction" +/** + * @description - A builder function that adds payer account(s) to a transaction + * @param {Function | Array.} ax - An account address or array of account addresses + * @returns {Function} - An interaction object + */ export function payer(ax = []) { if (!Array.isArray(ax)) ax = [ax] return pipe( diff --git a/packages/sdk/src/interaction/interaction.ts b/packages/sdk/src/interaction/interaction.ts index 05f95f066..ed3c9817a 100644 --- a/packages/sdk/src/interaction/interaction.ts +++ b/packages/sdk/src/interaction/interaction.ts @@ -2,10 +2,23 @@ import {invariant} from "@onflow/util-invariant" import {v4 as uuidv4} from "uuid" import {log, LEVELS} from "@onflow/util-logger" -import { TransactionRole, Interaction, InteractionAccount, InteractionResolverKind, InteractionStatus, InteractionTag } from "@onflow/typedefs"; - -type AcctFn = (acct: InteractionAccount) => InteractionAccount; -type AccountFn = AcctFn & Partial; +import { + TransactionRole, + Interaction, + InteractionAccount, + InteractionResolverKind, + InteractionStatus, + InteractionTag, +} from "@onflow/typedefs" +import {TypeDescriptor, TypeDescriptorInput} from "@onflow/types" + +type AcctFn = (acct: InteractionAccount) => InteractionAccount +type AccountFn = AcctFn & Partial + +export type CadenceArgument> = { + value: TypeDescriptorInput + xform: T +} const ACCT = `{ "kind":"${InteractionResolverKind.ACCOUNT}", @@ -87,7 +100,6 @@ const IX = `{ const KEYS = new Set(Object.keys(JSON.parse(IX) as Interaction)) - export const initInteraction = (): Interaction => JSON.parse(IX) /** * @deprecated @@ -105,7 +117,8 @@ export const interaction = () => { export const isNumber = (d: any): d is number => typeof d === "number" export const isArray = (d: any): d is any[] => Array.isArray(d) -export const isObj = (d: any): d is Record => d !== null && typeof d === "object" +export const isObj = (d: any): d is Record => + d !== null && typeof d === "object" export const isNull = (d: any): d is null => d == null export const isFn = (d: any): d is Function => typeof d === "function" @@ -131,10 +144,15 @@ const makeIx = (wat: InteractionTag) => (ix: Interaction) => { return Ok(ix) } -const prepAccountKeyId = (acct: Partial | AccountFn): Partial | AccountFn => { +const prepAccountKeyId = ( + acct: Partial | AccountFn +): Partial | AccountFn => { if (acct.keyId == null) return acct - invariant(!isNaN(parseInt(acct.keyId.toString())), "account.keyId must be an integer") + invariant( + !isNaN(parseInt(acct.keyId.toString())), + "account.keyId must be an integer" + ) return { ...acct, @@ -148,55 +166,57 @@ interface IPrepAccountOpts { export const initAccount = (): InteractionAccount => JSON.parse(ACCT) -export const prepAccount = (acct: InteractionAccount | AccountFn, opts: IPrepAccountOpts = {}) => (ix: Interaction) => { - invariant( - typeof acct === "function" || typeof acct === "object", - "prepAccount must be passed an authorization function or an account object" - ) - invariant(opts.role != null, "Account must have a role") - - const ACCOUNT = initAccount() - const role = opts.role - const tempId = uuidv4() - let account: Partial = {...acct} - - if (acct.authorization && isFn(acct.authorization)) - account = {resolve: acct.authorization} - if (!acct.authorization && isFn(acct)) account = {resolve: acct} - - const resolve = account.resolve - if (resolve) { - account.resolve = (acct: InteractionAccount, ...rest: any[]) => - [resolve, prepAccountKeyId].reduce( - async (d, fn) => fn(await d, ...rest), - acct - ) - } - account = prepAccountKeyId(account) - - ix.accounts[tempId] = { - ...ACCOUNT, - tempId, - ...account, - role: { - ...ACCOUNT.role, - ...(typeof acct.role === "object" ? acct.role : {}), - ...(role ? {[role]: true} : {}), - }, - } - - if (role === TransactionRole.AUTHORIZER) { - ix.authorizations.push(tempId) - } else if (role === TransactionRole.PAYER) { - ix.payer.push(tempId) - } else if (role) { - ix[role] = tempId +export const prepAccount = + (acct: InteractionAccount | AccountFn, opts: IPrepAccountOpts = {}) => + (ix: Interaction) => { + invariant( + typeof acct === "function" || typeof acct === "object", + "prepAccount must be passed an authorization function or an account object" + ) + invariant(opts.role != null, "Account must have a role") + + const ACCOUNT = initAccount() + const role = opts.role + const tempId = uuidv4() + let account: Partial = {...acct} + + if (acct.authorization && isFn(acct.authorization)) + account = {resolve: acct.authorization} + if (!acct.authorization && isFn(acct)) account = {resolve: acct} + + const resolve = account.resolve + if (resolve) { + account.resolve = (acct: InteractionAccount, ...rest: any[]) => + [resolve, prepAccountKeyId].reduce( + async (d, fn) => fn(await d, ...rest), + acct + ) + } + account = prepAccountKeyId(account) + + ix.accounts[tempId] = { + ...ACCOUNT, + tempId, + ...account, + role: { + ...ACCOUNT.role, + ...(typeof acct.role === "object" ? acct.role : {}), + ...(role ? {[role]: true} : {}), + }, + } + + if (role === TransactionRole.AUTHORIZER) { + ix.authorizations.push(tempId) + } else if (role === TransactionRole.PAYER) { + ix.payer.push(tempId) + } else if (role) { + ix[role] = tempId + } + + return ix } - return ix -} - -export const makeArgument = (arg: Record) => (ix: Interaction) => { +export const makeArgument = (arg: Record) => (ix: Interaction) => { let tempId = uuidv4() ix.message.arguments.push(tempId) @@ -215,40 +235,74 @@ export const makeArgument = (arg: Record) => (ix: Interaction) => export const makeUnknown /* */ = makeIx(InteractionTag.UNKNOWN) export const makeScript /* */ = makeIx(InteractionTag.SCRIPT) -export const makeTransaction /* */ = makeIx(InteractionTag.TRANSACTION) -export const makeGetTransactionStatus /* */ = makeIx(InteractionTag.GET_TRANSACTION_STATUS) -export const makeGetTransaction /* */ = makeIx(InteractionTag.GET_TRANSACTION) -export const makeGetAccount /* */ = makeIx(InteractionTag.GET_ACCOUNT) -export const makeGetEvents /* */ = makeIx(InteractionTag.GET_EVENTS) +export const makeTransaction /* */ = makeIx( + InteractionTag.TRANSACTION +) +export const makeGetTransactionStatus /* */ = makeIx( + InteractionTag.GET_TRANSACTION_STATUS +) +export const makeGetTransaction /* */ = makeIx( + InteractionTag.GET_TRANSACTION +) +export const makeGetAccount /* */ = makeIx( + InteractionTag.GET_ACCOUNT +) +export const makeGetEvents /* */ = makeIx( + InteractionTag.GET_EVENTS +) export const makePing /* */ = makeIx(InteractionTag.PING) -export const makeGetBlock /* */ = makeIx(InteractionTag.GET_BLOCK) -export const makeGetBlockHeader /* */ = makeIx(InteractionTag.GET_BLOCK_HEADER) -export const makeGetCollection /* */ = makeIx(InteractionTag.GET_COLLECTION) -export const makeGetNetworkParameters /* */ = makeIx(InteractionTag.GET_NETWORK_PARAMETERS) -export const makeSubscribeEvents /* */ = makeIx(InteractionTag.SUBSCRIBE_EVENTS) +export const makeGetBlock /* */ = makeIx( + InteractionTag.GET_BLOCK +) +export const makeGetBlockHeader /* */ = makeIx( + InteractionTag.GET_BLOCK_HEADER +) +export const makeGetCollection /* */ = makeIx( + InteractionTag.GET_COLLECTION +) +export const makeGetNetworkParameters /* */ = makeIx( + InteractionTag.GET_NETWORK_PARAMETERS +) +export const makeSubscribeEvents /* */ = makeIx( + InteractionTag.SUBSCRIBE_EVENTS +) const is = (wat: InteractionTag) => (ix: Interaction) => ix.tag === wat export const isUnknown /* */ = is(InteractionTag.UNKNOWN) export const isScript /* */ = is(InteractionTag.SCRIPT) export const isTransaction /* */ = is(InteractionTag.TRANSACTION) -export const isGetTransactionStatus /* */ = is(InteractionTag.GET_TRANSACTION_STATUS) -export const isGetTransaction /* */ = is(InteractionTag.GET_TRANSACTION) +export const isGetTransactionStatus /* */ = is( + InteractionTag.GET_TRANSACTION_STATUS +) +export const isGetTransaction /* */ = is( + InteractionTag.GET_TRANSACTION +) export const isGetAccount /* */ = is(InteractionTag.GET_ACCOUNT) export const isGetEvents /* */ = is(InteractionTag.GET_EVENTS) export const isPing /* */ = is(InteractionTag.PING) export const isGetBlock /* */ = is(InteractionTag.GET_BLOCK) -export const isGetBlockHeader /* */ = is(InteractionTag.GET_BLOCK_HEADER) +export const isGetBlockHeader /* */ = is( + InteractionTag.GET_BLOCK_HEADER +) export const isGetCollection /* */ = is(InteractionTag.GET_COLLECTION) -export const isGetNetworkParameters /* */ = is(InteractionTag.GET_NETWORK_PARAMETERS) -export const isSubscribeEvents /* */ = is(InteractionTag.SUBSCRIBE_EVENTS) - -export const isOk /* */ = (ix: Interaction) => ix.status === InteractionStatus.OK -export const isBad /* */ = (ix: Interaction) => ix.status === InteractionStatus.BAD +export const isGetNetworkParameters /* */ = is( + InteractionTag.GET_NETWORK_PARAMETERS +) +export const isSubscribeEvents /* */ = is( + InteractionTag.SUBSCRIBE_EVENTS +) + +export const isOk /* */ = (ix: Interaction) => + ix.status === InteractionStatus.OK +export const isBad /* */ = (ix: Interaction) => + ix.status === InteractionStatus.BAD export const why /* */ = (ix: Interaction) => ix.reason -export const isAccount /* */ = (account: Record) => account.kind === InteractionResolverKind.ACCOUNT -export const isArgument /* */ = (argument: Record) => argument.kind === InteractionResolverKind.ARGUMENT +export const isAccount /* */ = (account: Record) => + account.kind === InteractionResolverKind.ACCOUNT +export const isArgument /* */ = (argument: Record) => + argument.kind === InteractionResolverKind.ARGUMENT const hardMode = (ix: Interaction) => { for (let key of Object.keys(ix)) { @@ -258,7 +312,10 @@ const hardMode = (ix: Interaction) => { return ix } -const recPipe = async (ix: Interaction, fns: (Function | Interaction)[] = []): Promise => { +const recPipe = async ( + ix: Interaction, + fns: (Function | Interaction)[] = [] +): Promise => { try { ix = hardMode(await ix) if (isBad(ix)) throw new Error(`Interaction Error: ${ix.reason}`) @@ -291,12 +348,14 @@ export const put = (key: string, value: any) => (ix: Interaction) => { return Ok(ix) } -export const update = (key: string, fn = identity) => (ix: Interaction) => { - ix.assigns[key] = fn(ix.assigns[key], ix) - return Ok(ix) -} +export const update = + (key: string, fn = identity) => + (ix: Interaction) => { + ix.assigns[key] = fn(ix.assigns[key], ix) + return Ok(ix) + } export const destroy = (key: string) => (ix: Interaction) => { delete ix.assigns[key] return Ok(ix) -} \ No newline at end of file +} diff --git a/packages/sdk/src/sdk.ts b/packages/sdk/src/sdk.ts index b4804d288..94ce06bfa 100644 --- a/packages/sdk/src/sdk.ts +++ b/packages/sdk/src/sdk.ts @@ -33,6 +33,7 @@ export { isGetBlockHeader, isGetCollection, isGetNetworkParameters, + CadenceArgument, } from "./interaction/interaction" export {createSignableVoucher, voucherToTxId} from "./resolve/voucher" export {encodeMessageFromSignable} from "./wallet-utils/encode-signable.js" diff --git a/packages/sdk/src/send/send.js b/packages/sdk/src/send/send.js index e2baf17c6..fe327ed68 100644 --- a/packages/sdk/src/send/send.js +++ b/packages/sdk/src/send/send.js @@ -9,7 +9,7 @@ import {resolve as defaultResolve} from "../resolve/resolve.js" /** * @description - Sends arbitrary scripts, transactions, and requests to Flow - * @param {Array.} args - An array of functions that take interaction and return interaction + * @param {Array.>} args - An array of functions that take interaction and return interaction * @param {object} opts - Optional parameters * @returns {Promise<*>} - A promise that resolves to a response */ From 1e5b27fbe3e1ffe5800b86c27481288c5e2b7f6c Mon Sep 17 00:00:00 2001 From: Jordan Ribbink Date: Wed, 24 Jan 2024 10:12:53 -0800 Subject: [PATCH 2/3] fix babel export bug --- package-lock.json | 406 ++++++++------------ packages/sdk/src/block/block.js | 2 +- packages/sdk/src/interaction/interaction.ts | 4 +- packages/sdk/src/sdk.ts | 5 +- 4 files changed, 170 insertions(+), 247 deletions(-) diff --git a/package-lock.json b/package-lock.json index a41501d9b..2eef5c0a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,6 +33,7 @@ }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -2209,6 +2210,7 @@ "version": "0.41.0", "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.41.0.tgz", "integrity": "sha512-aKUhyn1QI5Ksbqcr3fFJj16p99QdjUxXAEuFst1Z47DRyoiMwivIH9MV/ARcJOCXVjPfjITciej8ZD2O/6qUmw==", + "dev": true, "dependencies": { "comment-parser": "1.4.1", "esquery": "^1.5.0", @@ -2220,6 +2222,7 @@ }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", + "dev": true, "license": "MIT", "dependencies": { "eslint-visitor-keys": "^3.3.0" @@ -2233,6 +2236,7 @@ }, "node_modules/@eslint-community/regexpp": { "version": "4.6.2", + "dev": true, "license": "MIT", "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" @@ -2240,6 +2244,7 @@ }, "node_modules/@eslint/eslintrc": { "version": "2.1.2", + "dev": true, "license": "MIT", "dependencies": { "ajv": "^6.12.4", @@ -2261,10 +2266,12 @@ }, "node_modules/@eslint/eslintrc/node_modules/argparse": { "version": "2.0.1", + "dev": true, "license": "Python-2.0" }, "node_modules/@eslint/eslintrc/node_modules/js-yaml": { "version": "4.1.0", + "dev": true, "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -2275,6 +2282,7 @@ }, "node_modules/@eslint/js": { "version": "8.52.0", + "dev": true, "license": "MIT", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -4359,6 +4367,7 @@ }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.13", + "dev": true, "license": "Apache-2.0", "dependencies": { "@humanwhocodes/object-schema": "^2.0.1", @@ -4371,6 +4380,7 @@ }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", + "dev": true, "license": "Apache-2.0", "engines": { "node": ">=12.22" @@ -4382,6 +4392,7 @@ }, "node_modules/@humanwhocodes/object-schema": { "version": "2.0.1", + "dev": true, "license": "BSD-3-Clause" }, "node_modules/@hutson/parse-repository-url": { @@ -8643,6 +8654,7 @@ }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", + "dev": true, "license": "ISC" }, "node_modules/@urql/core": { @@ -9232,6 +9244,7 @@ }, "node_modules/acorn-jsx": { "version": "5.3.2", + "dev": true, "license": "MIT", "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" @@ -9284,6 +9297,7 @@ }, "node_modules/ajv": { "version": "6.12.6", + "dev": true, "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.1", @@ -9432,6 +9446,7 @@ }, "node_modules/are-docs-informative": { "version": "0.0.2", + "dev": true, "license": "MIT", "engines": { "node": ">=14" @@ -10398,6 +10413,7 @@ }, "node_modules/callsites": { "version": "3.1.0", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -10665,6 +10681,7 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.1.tgz", "integrity": "sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==", + "dev": true, "engines": { "node": ">= 12.0.0" } @@ -11639,6 +11656,7 @@ }, "node_modules/deep-is": { "version": "0.1.4", + "dev": true, "license": "MIT" }, "node_modules/deepmerge": { @@ -11925,6 +11943,7 @@ }, "node_modules/doctrine": { "version": "3.0.0", + "dev": true, "license": "Apache-2.0", "dependencies": { "esutils": "^2.0.2" @@ -12347,6 +12366,7 @@ }, "node_modules/eslint": { "version": "8.52.0", + "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", @@ -12402,6 +12422,7 @@ "version": "46.9.0", "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-46.9.0.tgz", "integrity": "sha512-UQuEtbqLNkPf5Nr/6PPRCtr9xypXY+g8y/Q7gPa0YK7eDhh0y2lWprXRnaYbW7ACgIUvpDKy9X2bZqxtGzBG9Q==", + "dev": true, "dependencies": { "@es-joy/jsdoccomment": "~0.41.0", "are-docs-informative": "^0.0.2", @@ -12422,6 +12443,7 @@ }, "node_modules/eslint-plugin-jsdoc/node_modules/escape-string-regexp": { "version": "4.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=10" @@ -12434,6 +12456,7 @@ "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -12446,6 +12469,7 @@ }, "node_modules/eslint-scope": { "version": "7.2.2", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", @@ -12460,6 +12484,7 @@ }, "node_modules/eslint-visitor-keys": { "version": "3.4.3", + "dev": true, "license": "Apache-2.0", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -12470,6 +12495,7 @@ }, "node_modules/eslint/node_modules/ansi-styles": { "version": "4.3.0", + "dev": true, "license": "MIT", "dependencies": { "color-convert": "^2.0.1" @@ -12483,10 +12509,12 @@ }, "node_modules/eslint/node_modules/argparse": { "version": "2.0.1", + "dev": true, "license": "Python-2.0" }, "node_modules/eslint/node_modules/chalk": { "version": "4.1.2", + "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", @@ -12501,6 +12529,7 @@ }, "node_modules/eslint/node_modules/color-convert": { "version": "2.0.1", + "dev": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -12511,10 +12540,12 @@ }, "node_modules/eslint/node_modules/color-name": { "version": "1.1.4", + "dev": true, "license": "MIT" }, "node_modules/eslint/node_modules/escape-string-regexp": { "version": "4.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=10" @@ -12525,6 +12556,7 @@ }, "node_modules/eslint/node_modules/find-up": { "version": "5.0.0", + "dev": true, "license": "MIT", "dependencies": { "locate-path": "^6.0.0", @@ -12539,6 +12571,7 @@ }, "node_modules/eslint/node_modules/glob-parent": { "version": "6.0.2", + "dev": true, "license": "ISC", "dependencies": { "is-glob": "^4.0.3" @@ -12549,6 +12582,7 @@ }, "node_modules/eslint/node_modules/has-flag": { "version": "4.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -12556,6 +12590,7 @@ }, "node_modules/eslint/node_modules/js-yaml": { "version": "4.1.0", + "dev": true, "license": "MIT", "dependencies": { "argparse": "^2.0.1" @@ -12566,6 +12601,7 @@ }, "node_modules/eslint/node_modules/locate-path": { "version": "6.0.0", + "dev": true, "license": "MIT", "dependencies": { "p-locate": "^5.0.0" @@ -12579,6 +12615,7 @@ }, "node_modules/eslint/node_modules/p-limit": { "version": "3.1.0", + "dev": true, "license": "MIT", "dependencies": { "yocto-queue": "^0.1.0" @@ -12592,6 +12629,7 @@ }, "node_modules/eslint/node_modules/p-locate": { "version": "5.0.0", + "dev": true, "license": "MIT", "dependencies": { "p-limit": "^3.0.2" @@ -12605,6 +12643,7 @@ }, "node_modules/eslint/node_modules/supports-color": { "version": "7.2.0", + "dev": true, "license": "MIT", "dependencies": { "has-flag": "^4.0.0" @@ -12615,6 +12654,7 @@ }, "node_modules/espree": { "version": "9.6.1", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "acorn": "^8.9.0", @@ -12641,6 +12681,7 @@ }, "node_modules/esquery": { "version": "1.5.0", + "dev": true, "license": "BSD-3-Clause", "dependencies": { "estraverse": "^5.1.0" @@ -12651,6 +12692,7 @@ }, "node_modules/esrecurse": { "version": "4.3.0", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "estraverse": "^5.2.0" @@ -12661,6 +12703,7 @@ }, "node_modules/estraverse": { "version": "5.3.0", + "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=4.0" @@ -13543,6 +13586,7 @@ }, "node_modules/fast-deep-equal": { "version": "3.1.3", + "dev": true, "license": "MIT" }, "node_modules/fast-glob": { @@ -13561,10 +13605,12 @@ }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", + "dev": true, "license": "MIT" }, "node_modules/fast-levenshtein": { "version": "2.0.6", + "dev": true, "license": "MIT" }, "node_modules/fast-redact": { @@ -13670,6 +13716,7 @@ }, "node_modules/file-entry-cache": { "version": "6.0.1", + "dev": true, "license": "MIT", "dependencies": { "flat-cache": "^3.0.4" @@ -13839,6 +13886,7 @@ }, "node_modules/flat-cache": { "version": "3.0.4", + "dev": true, "license": "MIT", "dependencies": { "flatted": "^3.1.0", @@ -13850,6 +13898,7 @@ }, "node_modules/flatted": { "version": "3.2.7", + "dev": true, "license": "ISC" }, "node_modules/flow-enums-runtime": { @@ -14536,6 +14585,7 @@ }, "node_modules/globals": { "version": "13.21.0", + "dev": true, "license": "MIT", "dependencies": { "type-fest": "^0.20.2" @@ -14605,6 +14655,7 @@ }, "node_modules/graphemer": { "version": "1.4.0", + "dev": true, "license": "MIT" }, "node_modules/graphql": { @@ -14975,6 +15026,7 @@ }, "node_modules/import-fresh": { "version": "3.3.0", + "dev": true, "license": "MIT", "dependencies": { "parent-module": "^1.0.0", @@ -14989,6 +15041,7 @@ }, "node_modules/import-fresh/node_modules/resolve-from": { "version": "4.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=4" @@ -17639,6 +17692,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.0.0.tgz", "integrity": "sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==", + "dev": true, "engines": { "node": ">=12.0.0" } @@ -17767,10 +17821,12 @@ }, "node_modules/json-schema-traverse": { "version": "0.4.1", + "dev": true, "license": "MIT" }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", + "dev": true, "license": "MIT" }, "node_modules/json-stringify-safe": { @@ -18265,6 +18321,7 @@ }, "node_modules/levn": { "version": "0.4.1", + "dev": true, "license": "MIT", "dependencies": { "prelude-ls": "^1.2.1", @@ -18748,6 +18805,7 @@ }, "node_modules/lodash.merge": { "version": "4.6.2", + "dev": true, "license": "MIT" }, "node_modules/lodash.startcase": { @@ -20453,6 +20511,7 @@ }, "node_modules/natural-compare": { "version": "1.4.0", + "dev": true, "license": "MIT" }, "node_modules/ncp": { @@ -21606,6 +21665,7 @@ }, "node_modules/optionator": { "version": "0.9.3", + "dev": true, "license": "MIT", "dependencies": { "@aashutoshrathi/word-wrap": "^1.2.3", @@ -22122,6 +22182,7 @@ }, "node_modules/parent-module": { "version": "1.0.1", + "dev": true, "license": "MIT", "dependencies": { "callsites": "^3.0.0" @@ -22586,6 +22647,7 @@ }, "node_modules/prelude-ls": { "version": "1.2.1", + "dev": true, "license": "MIT", "engines": { "node": ">= 0.8.0" @@ -22779,6 +22841,7 @@ }, "node_modules/punycode": { "version": "2.3.0", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -24831,10 +24894,12 @@ }, "node_modules/spdx-exceptions": { "version": "2.3.0", + "dev": true, "license": "CC-BY-3.0" }, "node_modules/spdx-expression-parse": { "version": "3.0.1", + "dev": true, "license": "MIT", "dependencies": { "spdx-exceptions": "^2.1.0", @@ -24843,6 +24908,7 @@ }, "node_modules/spdx-license-ids": { "version": "3.0.12", + "dev": true, "license": "CC0-1.0" }, "node_modules/split": { @@ -25107,6 +25173,7 @@ }, "node_modules/strip-json-comments": { "version": "3.1.1", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -26088,6 +26155,7 @@ }, "node_modules/type-check": { "version": "0.4.0", + "dev": true, "license": "MIT", "dependencies": { "prelude-ls": "^1.2.1" @@ -26105,6 +26173,7 @@ }, "node_modules/type-fest": { "version": "0.20.2", + "dev": true, "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" @@ -26356,6 +26425,7 @@ }, "node_modules/uri-js": { "version": "4.4.1", + "dev": true, "license": "BSD-2-Clause", "dependencies": { "punycode": "^2.1.0" @@ -27048,13 +27118,13 @@ }, "packages/config": { "name": "@onflow/config", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6", - "@onflow/util-actor": "1.3.2-alpha.1", - "@onflow/util-invariant": "1.2.2-alpha.1", - "@onflow/util-logger": "1.3.2-alpha.1", + "@onflow/util-actor": "1.3.2-alpha.2", + "@onflow/util-invariant": "1.2.2-alpha.2", + "@onflow/util-logger": "1.3.2-alpha.2", "eslint": "^8.34.0", "eslint-plugin-jsdoc": "^46.9.0" }, @@ -27086,30 +27156,30 @@ }, "packages/fcl": { "name": "@onflow/fcl", - "version": "1.10.0-alpha.2", + "version": "1.10.0-alpha.5", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6", - "@onflow/config": "1.2.2-alpha.1", - "@onflow/fcl-core": "1.8.1", + "@onflow/config": "1.2.2-alpha.2", + "@onflow/fcl-core": "1.8.2-alpha.2", "@onflow/interaction": "0.0.11", - "@onflow/rlp": "1.2.2-alpha.1", - "@onflow/sdk": "1.4.0-alpha.2", - "@onflow/types": "1.3.0-alpha.1", - "@onflow/util-actor": "1.3.2-alpha.1", - "@onflow/util-address": "1.2.2-alpha.1", - "@onflow/util-invariant": "1.2.2-alpha.1", - "@onflow/util-logger": "1.3.2-alpha.1", - "@onflow/util-semver": "1.0.1", - "@onflow/util-template": "1.2.2-alpha.1", - "@onflow/util-uid": "1.2.2-alpha.1", + "@onflow/rlp": "1.2.2-alpha.2", + "@onflow/sdk": "1.4.0-alpha.4", + "@onflow/types": "1.3.0-alpha.3", + "@onflow/util-actor": "1.3.2-alpha.2", + "@onflow/util-address": "1.2.2-alpha.2", + "@onflow/util-invariant": "1.2.2-alpha.2", + "@onflow/util-logger": "1.3.2-alpha.2", + "@onflow/util-semver": "1.0.2-alpha.0", + "@onflow/util-template": "1.2.2-alpha.2", + "@onflow/util-uid": "1.2.2-alpha.2", "cross-fetch": "^3.1.6", "events": "^3.3.0", "sha3": "^2.1.4" }, "devDependencies": { "@onflow/fcl-bundle": "1.4.2-alpha.1", - "@onflow/typedefs": "1.3.0-alpha.1", + "@onflow/typedefs": "1.3.0-alpha.2", "@types/estree": "^1.0.1", "@types/jest": "^29.5.10", "@types/node": "^18.13.0", @@ -27152,28 +27222,28 @@ }, "packages/fcl-core": { "name": "@onflow/fcl-core", - "version": "1.8.1", + "version": "1.8.2-alpha.2", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6", "@improbable-eng/grpc-web": "^0.15.0", - "@onflow/config": "1.2.2-alpha.1", + "@onflow/config": "1.2.2-alpha.2", "@onflow/interaction": "0.0.11", - "@onflow/rlp": "1.2.2-alpha.0", - "@onflow/sdk": "1.4.0-alpha.2", - "@onflow/types": "1.3.0-alpha.0", - "@onflow/util-actor": "1.3.2-alpha.0", - "@onflow/util-address": "1.2.2-alpha.0", - "@onflow/util-invariant": "1.2.2-alpha.0", - "@onflow/util-logger": "1.3.2-alpha.0", - "@onflow/util-semver": "1.0.1", - "@onflow/util-template": "1.2.2-alpha.0", - "@onflow/util-uid": "1.2.2-alpha.0", + "@onflow/rlp": "1.2.2-alpha.2", + "@onflow/sdk": "1.4.0-alpha.4", + "@onflow/types": "1.3.0-alpha.3", + "@onflow/util-actor": "1.3.2-alpha.2", + "@onflow/util-address": "1.2.2-alpha.2", + "@onflow/util-invariant": "1.2.2-alpha.2", + "@onflow/util-logger": "1.3.2-alpha.2", + "@onflow/util-semver": "1.0.2-alpha.0", + "@onflow/util-template": "1.2.2-alpha.2", + "@onflow/util-uid": "1.2.2-alpha.2", "cross-fetch": "^3.1.6" }, "devDependencies": { "@onflow/fcl-bundle": "1.4.2-alpha.1", - "@onflow/typedefs": "1.3.0-alpha.1", + "@onflow/typedefs": "1.3.0-alpha.2", "@types/estree": "^1.0.1", "@types/jest": "^29.5.4", "@types/node": "^18.13.0", @@ -27195,82 +27265,6 @@ "google-protobuf": "^3.14.0" } }, - "packages/fcl-core/node_modules/@onflow/rlp": { - "version": "1.2.2-alpha.0", - "resolved": "https://registry.npmjs.org/@onflow/rlp/-/rlp-1.2.2-alpha.0.tgz", - "integrity": "sha512-QYUEwqF+zza8MkrMiNHo0grMYXWkLl+CZ8dv4VAdZLFM/5w+6j4JQuUqyEsIMef92/l3IKjzdsx0axCAsRcuyg==", - "dependencies": { - "@babel/runtime": "^7.18.6", - "buffer": "^6.0.3" - } - }, - "packages/fcl-core/node_modules/@onflow/types": { - "version": "1.3.0-alpha.0", - "resolved": "https://registry.npmjs.org/@onflow/types/-/types-1.3.0-alpha.0.tgz", - "integrity": "sha512-8RxQt7x3QIr9zrewGmz/LP2574wKmVlqroWQDrk5FWatNPABPnxSOuVa//rKDRGOH/BiGnIy+VaPjJJOKfqV3Q==", - "dependencies": { - "@babel/runtime": "^7.18.6", - "@onflow/util-logger": "^1.3.2-alpha.0" - } - }, - "packages/fcl-core/node_modules/@onflow/util-actor": { - "version": "1.3.2-alpha.0", - "resolved": "https://registry.npmjs.org/@onflow/util-actor/-/util-actor-1.3.2-alpha.0.tgz", - "integrity": "sha512-JjrbR0sDyGt0hJ0UXP9vWqvzefF4NDi3CLa9WTaRetbyEtiaAsQeWtwjdd7j9Q/WnUhpBkxzZozqaoKKbLbwqw==", - "dependencies": { - "@babel/runtime": "^7.18.6", - "queue-microtask": "1.2.3" - } - }, - "packages/fcl-core/node_modules/@onflow/util-address": { - "version": "1.2.2-alpha.0", - "resolved": "https://registry.npmjs.org/@onflow/util-address/-/util-address-1.2.2-alpha.0.tgz", - "integrity": "sha512-QcZLwuHEiR6LhMDeuOpVl6HDDREm+x8VUXLDGq9qa3vmMTcAaaUaty1lUxviTdPoakKiEZa20ZZkxH/uYEghkw==", - "dependencies": { - "@babel/runtime": "^7.18.6" - } - }, - "packages/fcl-core/node_modules/@onflow/util-invariant": { - "version": "1.2.2-alpha.0", - "resolved": "https://registry.npmjs.org/@onflow/util-invariant/-/util-invariant-1.2.2-alpha.0.tgz", - "integrity": "sha512-fJObIGoa7G5cyGdhSoj7r0xnfa7sZp+pJ39tMZs29e34YUjE/Ep5hMsD47paorgXvhSZ3GcIjuEufISZs07lcg==", - "dependencies": { - "@babel/runtime": "^7.18.6" - } - }, - "packages/fcl-core/node_modules/@onflow/util-logger": { - "version": "1.3.2-alpha.0", - "resolved": "https://registry.npmjs.org/@onflow/util-logger/-/util-logger-1.3.2-alpha.0.tgz", - "integrity": "sha512-P7m1FSxj2oruqZM+FNs/u3GYXvuPnJmr4dWGOXO74DExHe9qGX82pDWvtxCfuC+a/4h9hgNNTPzjupMUoOi2KA==", - "dependencies": { - "@babel/runtime": "^7.18.6" - }, - "peerDependencies": { - "@onflow/util-config": ">1.1.1" - }, - "peerDependenciesMeta": { - "@onflow/util-config": { - "optional": true - } - } - }, - "packages/fcl-core/node_modules/@onflow/util-template": { - "version": "1.2.2-alpha.0", - "resolved": "https://registry.npmjs.org/@onflow/util-template/-/util-template-1.2.2-alpha.0.tgz", - "integrity": "sha512-UDbPOuWEMGa7Fd2r4/G/T9QF6kCiljY/ON2SUb20exl33NkAn25dwNILd+JRHRBBXVPXp672Oyvw3GdMr1CoEg==", - "dependencies": { - "@babel/runtime": "^7.18.6", - "@onflow/util-logger": "^1.3.2-alpha.0" - } - }, - "packages/fcl-core/node_modules/@onflow/util-uid": { - "version": "1.2.2-alpha.0", - "resolved": "https://registry.npmjs.org/@onflow/util-uid/-/util-uid-1.2.2-alpha.0.tgz", - "integrity": "sha512-5+OrklSCKNKScKTsGT4fYZGXTNp6nitEpEOhx2cRfZ7S0/LhV/PQFD8zdREVdcO5cw5GO6pj6A7H/62w8Hu5KQ==", - "dependencies": { - "@babel/runtime": "^7.18.6" - } - }, "packages/fcl-core/node_modules/google-protobuf": { "version": "3.21.2", "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.21.2.tgz", @@ -27292,28 +27286,28 @@ }, "packages/fcl-react-native": { "name": "@onflow/fcl-react-native", - "version": "1.9.0-alpha.2", + "version": "1.9.0-alpha.5", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6", - "@onflow/config": "1.2.2-alpha.1", - "@onflow/fcl-core": "1.8.1", + "@onflow/config": "1.2.2-alpha.2", + "@onflow/fcl-core": "1.8.2-alpha.2", "@onflow/interaction": "0.0.11", - "@onflow/rlp": "1.2.2-alpha.0", - "@onflow/sdk": "1.4.0-alpha.2", - "@onflow/types": "1.3.0-alpha.0", - "@onflow/util-actor": "1.3.2-alpha.0", - "@onflow/util-address": "1.2.2-alpha.0", - "@onflow/util-invariant": "1.2.2-alpha.0", - "@onflow/util-logger": "1.3.2-alpha.0", - "@onflow/util-semver": "1.0.1", - "@onflow/util-template": "1.2.2-alpha.0", - "@onflow/util-uid": "1.2.2-alpha.0", + "@onflow/rlp": "1.2.2-alpha.2", + "@onflow/sdk": "1.4.0-alpha.4", + "@onflow/types": "1.3.0-alpha.3", + "@onflow/util-actor": "1.3.2-alpha.2", + "@onflow/util-address": "1.2.2-alpha.2", + "@onflow/util-invariant": "1.2.2-alpha.2", + "@onflow/util-logger": "1.3.2-alpha.2", + "@onflow/util-semver": "1.0.2-alpha.0", + "@onflow/util-template": "1.2.2-alpha.2", + "@onflow/util-uid": "1.2.2-alpha.2", "cross-fetch": "^3.1.6" }, "devDependencies": { "@onflow/fcl-bundle": "1.4.2-alpha.1", - "@onflow/typedefs": "1.3.0-alpha.1", + "@onflow/typedefs": "1.3.0-alpha.2", "@types/estree": "^1.0.1", "@types/node": "^18.13.0", "eslint": "^8.35.0", @@ -27330,82 +27324,6 @@ "react-native": "^0.0.0-0 || 0.60 - 0.72 || 1000.0.0" } }, - "packages/fcl-react-native/node_modules/@onflow/rlp": { - "version": "1.2.2-alpha.0", - "resolved": "https://registry.npmjs.org/@onflow/rlp/-/rlp-1.2.2-alpha.0.tgz", - "integrity": "sha512-QYUEwqF+zza8MkrMiNHo0grMYXWkLl+CZ8dv4VAdZLFM/5w+6j4JQuUqyEsIMef92/l3IKjzdsx0axCAsRcuyg==", - "dependencies": { - "@babel/runtime": "^7.18.6", - "buffer": "^6.0.3" - } - }, - "packages/fcl-react-native/node_modules/@onflow/types": { - "version": "1.3.0-alpha.0", - "resolved": "https://registry.npmjs.org/@onflow/types/-/types-1.3.0-alpha.0.tgz", - "integrity": "sha512-8RxQt7x3QIr9zrewGmz/LP2574wKmVlqroWQDrk5FWatNPABPnxSOuVa//rKDRGOH/BiGnIy+VaPjJJOKfqV3Q==", - "dependencies": { - "@babel/runtime": "^7.18.6", - "@onflow/util-logger": "^1.3.2-alpha.0" - } - }, - "packages/fcl-react-native/node_modules/@onflow/util-actor": { - "version": "1.3.2-alpha.0", - "resolved": "https://registry.npmjs.org/@onflow/util-actor/-/util-actor-1.3.2-alpha.0.tgz", - "integrity": "sha512-JjrbR0sDyGt0hJ0UXP9vWqvzefF4NDi3CLa9WTaRetbyEtiaAsQeWtwjdd7j9Q/WnUhpBkxzZozqaoKKbLbwqw==", - "dependencies": { - "@babel/runtime": "^7.18.6", - "queue-microtask": "1.2.3" - } - }, - "packages/fcl-react-native/node_modules/@onflow/util-address": { - "version": "1.2.2-alpha.0", - "resolved": "https://registry.npmjs.org/@onflow/util-address/-/util-address-1.2.2-alpha.0.tgz", - "integrity": "sha512-QcZLwuHEiR6LhMDeuOpVl6HDDREm+x8VUXLDGq9qa3vmMTcAaaUaty1lUxviTdPoakKiEZa20ZZkxH/uYEghkw==", - "dependencies": { - "@babel/runtime": "^7.18.6" - } - }, - "packages/fcl-react-native/node_modules/@onflow/util-invariant": { - "version": "1.2.2-alpha.0", - "resolved": "https://registry.npmjs.org/@onflow/util-invariant/-/util-invariant-1.2.2-alpha.0.tgz", - "integrity": "sha512-fJObIGoa7G5cyGdhSoj7r0xnfa7sZp+pJ39tMZs29e34YUjE/Ep5hMsD47paorgXvhSZ3GcIjuEufISZs07lcg==", - "dependencies": { - "@babel/runtime": "^7.18.6" - } - }, - "packages/fcl-react-native/node_modules/@onflow/util-logger": { - "version": "1.3.2-alpha.0", - "resolved": "https://registry.npmjs.org/@onflow/util-logger/-/util-logger-1.3.2-alpha.0.tgz", - "integrity": "sha512-P7m1FSxj2oruqZM+FNs/u3GYXvuPnJmr4dWGOXO74DExHe9qGX82pDWvtxCfuC+a/4h9hgNNTPzjupMUoOi2KA==", - "dependencies": { - "@babel/runtime": "^7.18.6" - }, - "peerDependencies": { - "@onflow/util-config": ">1.1.1" - }, - "peerDependenciesMeta": { - "@onflow/util-config": { - "optional": true - } - } - }, - "packages/fcl-react-native/node_modules/@onflow/util-template": { - "version": "1.2.2-alpha.0", - "resolved": "https://registry.npmjs.org/@onflow/util-template/-/util-template-1.2.2-alpha.0.tgz", - "integrity": "sha512-UDbPOuWEMGa7Fd2r4/G/T9QF6kCiljY/ON2SUb20exl33NkAn25dwNILd+JRHRBBXVPXp672Oyvw3GdMr1CoEg==", - "dependencies": { - "@babel/runtime": "^7.18.6", - "@onflow/util-logger": "^1.3.2-alpha.0" - } - }, - "packages/fcl-react-native/node_modules/@onflow/util-uid": { - "version": "1.2.2-alpha.0", - "resolved": "https://registry.npmjs.org/@onflow/util-uid/-/util-uid-1.2.2-alpha.0.tgz", - "integrity": "sha512-5+OrklSCKNKScKTsGT4fYZGXTNp6nitEpEOhx2cRfZ7S0/LhV/PQFD8zdREVdcO5cw5GO6pj6A7H/62w8Hu5KQ==", - "dependencies": { - "@babel/runtime": "^7.18.6" - } - }, "packages/fcl-react-native/node_modules/typescript": { "version": "4.9.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", @@ -27421,13 +27339,13 @@ }, "packages/fcl-wc": { "name": "@onflow/fcl-wc", - "version": "5.0.2-alpha.0", + "version": "5.0.2-alpha.3", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.9", - "@onflow/config": "1.2.2-alpha.1", - "@onflow/util-invariant": "1.2.2-alpha.1", - "@onflow/util-logger": "1.3.2-alpha.1", + "@onflow/config": "1.2.2-alpha.2", + "@onflow/util-invariant": "1.2.2-alpha.2", + "@onflow/util-logger": "1.3.2-alpha.2", "@walletconnect/modal": "^2.4.7", "@walletconnect/sign-client": "^2.8.1", "@walletconnect/types": "^2.8.1", @@ -27441,7 +27359,7 @@ "jest": "^29.5.0" }, "peerDependencies": { - "@onflow/fcl": "1.10.0-alpha.2" + "@onflow/fcl": "1.10.0-alpha.5" } }, "packages/fcl/node_modules/typescript": { @@ -27907,7 +27825,7 @@ }, "packages/rlp": { "name": "@onflow/rlp", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "license": "MPL-2.0", "dependencies": { "@babel/runtime": "^7.18.6", @@ -27926,19 +27844,19 @@ }, "packages/sdk": { "name": "@onflow/sdk", - "version": "1.4.0-alpha.2", + "version": "1.4.0-alpha.4", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6", - "@onflow/config": "1.2.2-alpha.1", - "@onflow/rlp": "1.2.2-alpha.1", - "@onflow/transport-http": "1.10.0-alpha.1", - "@onflow/typedefs": "1.3.0-alpha.1", - "@onflow/util-actor": "1.3.2-alpha.1", - "@onflow/util-address": "1.2.2-alpha.1", - "@onflow/util-invariant": "1.2.2-alpha.1", - "@onflow/util-logger": "1.3.2-alpha.1", - "@onflow/util-template": "1.2.2-alpha.1", + "@onflow/config": "1.2.2-alpha.2", + "@onflow/rlp": "1.2.2-alpha.2", + "@onflow/transport-http": "1.10.0-alpha.3", + "@onflow/typedefs": "1.3.0-alpha.2", + "@onflow/util-actor": "1.3.2-alpha.2", + "@onflow/util-address": "1.2.2-alpha.2", + "@onflow/util-invariant": "1.2.2-alpha.2", + "@onflow/util-logger": "1.3.2-alpha.2", + "@onflow/util-template": "1.2.2-alpha.2", "deepmerge": "^4.2.2", "events": "^3.3.0", "sha3": "^2.1.4", @@ -27967,21 +27885,21 @@ }, "packages/transport-grpc": { "name": "@onflow/transport-grpc", - "version": "1.3.2-alpha.2", + "version": "1.3.2-alpha.4", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6", "@improbable-eng/grpc-web": "^0.15.0", "@improbable-eng/grpc-web-node-http-transport": "^0.15.0", "@onflow/protobuf": "1.2.2", - "@onflow/rlp": "1.2.2-alpha.1", - "@onflow/util-address": "1.2.2-alpha.1", - "@onflow/util-invariant": "1.2.2-alpha.1", - "@onflow/util-template": "1.2.2-alpha.1" + "@onflow/rlp": "1.2.2-alpha.2", + "@onflow/util-address": "1.2.2-alpha.2", + "@onflow/util-invariant": "1.2.2-alpha.2", + "@onflow/util-template": "1.2.2-alpha.2" }, "devDependencies": { "@onflow/fcl-bundle": "1.4.2-alpha.1", - "@onflow/sdk": "1.4.0-alpha.2", + "@onflow/sdk": "1.4.0-alpha.4", "jest": "^29.5.0" } }, @@ -28011,14 +27929,14 @@ }, "packages/transport-http": { "name": "@onflow/transport-http", - "version": "1.10.0-alpha.1", + "version": "1.10.0-alpha.3", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6", - "@onflow/util-address": "1.2.2-alpha.1", - "@onflow/util-invariant": "1.2.2-alpha.1", - "@onflow/util-logger": "1.3.2-alpha.1", - "@onflow/util-template": "1.2.2-alpha.1", + "@onflow/util-address": "1.2.2-alpha.2", + "@onflow/util-invariant": "1.2.2-alpha.2", + "@onflow/util-logger": "1.3.2-alpha.2", + "@onflow/util-template": "1.2.2-alpha.2", "abort-controller": "^3.0.0", "cross-fetch": "^3.1.6", "events": "^3.3.0", @@ -28027,9 +27945,9 @@ }, "devDependencies": { "@onflow/fcl-bundle": "1.4.2-alpha.1", - "@onflow/rlp": "1.2.2-alpha.1", - "@onflow/sdk": "1.4.0-alpha.2", - "@onflow/types": "1.3.0-alpha.1", + "@onflow/rlp": "1.2.2-alpha.2", + "@onflow/sdk": "1.4.0-alpha.4", + "@onflow/types": "1.3.0-alpha.3", "jest": "^29.5.0" } }, @@ -28054,7 +27972,7 @@ }, "packages/typedefs": { "name": "@onflow/typedefs", - "version": "1.3.0-alpha.1", + "version": "1.3.0-alpha.2", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6" @@ -28083,11 +28001,11 @@ }, "packages/types": { "name": "@onflow/types", - "version": "1.3.0-alpha.1", + "version": "1.3.0-alpha.3", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6", - "@onflow/util-logger": "1.3.2-alpha.1" + "@onflow/util-logger": "1.3.2-alpha.2" }, "devDependencies": { "@babel/preset-typescript": "^7.22.5", @@ -28102,7 +28020,7 @@ }, "packages/util-actor": { "name": "@onflow/util-actor", - "version": "1.3.2-alpha.1", + "version": "1.3.2-alpha.2", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6", @@ -28121,7 +28039,7 @@ }, "packages/util-address": { "name": "@onflow/util-address", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6" @@ -28129,7 +28047,7 @@ "devDependencies": { "@babel/preset-typescript": "^7.22.5", "@onflow/fcl-bundle": "1.4.2-alpha.1", - "@onflow/types": "1.3.0-alpha.1", + "@onflow/types": "1.3.0-alpha.3", "@types/jest": "^29.5.3", "@types/node": "^18.13.0", "@typescript-eslint/eslint-plugin": "^6.4.0", @@ -28154,17 +28072,17 @@ }, "packages/util-encode-key": { "name": "@onflow/util-encode-key", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6", - "@onflow/rlp": "1.2.2-alpha.1", - "@onflow/util-invariant": "1.2.2-alpha.1" + "@onflow/rlp": "1.2.2-alpha.2", + "@onflow/util-invariant": "1.2.2-alpha.2" }, "devDependencies": { "@babel/preset-typescript": "^7.22.5", "@onflow/fcl-bundle": "1.4.2-alpha.1", - "@onflow/types": "1.3.0-alpha.1", + "@onflow/types": "1.3.0-alpha.3", "@types/jest": "^29.5.3", "@types/node": "^18.13.0", "@typescript-eslint/eslint-plugin": "^6.4.0", @@ -28189,7 +28107,7 @@ }, "packages/util-invariant": { "name": "@onflow/util-invariant", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6" @@ -28197,7 +28115,7 @@ "devDependencies": { "@babel/preset-typescript": "^7.22.5", "@onflow/fcl-bundle": "1.4.2-alpha.1", - "@onflow/types": "1.3.0-alpha.1", + "@onflow/types": "1.3.0-alpha.3", "@types/jest": "^29.5.3", "@typescript-eslint/eslint-plugin": "^6.4.0", "@typescript-eslint/parser": "^6.4.0", @@ -28208,7 +28126,7 @@ }, "packages/util-logger": { "name": "@onflow/util-logger", - "version": "1.3.2-alpha.1", + "version": "1.3.2-alpha.2", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6" @@ -28234,7 +28152,7 @@ }, "packages/util-semver": { "name": "@onflow/util-semver", - "version": "1.0.1", + "version": "1.0.2-alpha.0", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6" @@ -28279,11 +28197,11 @@ }, "packages/util-template": { "name": "@onflow/util-template", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6", - "@onflow/util-logger": "1.3.2-alpha.1" + "@onflow/util-logger": "1.3.2-alpha.2" }, "devDependencies": { "@babel/preset-typescript": "^7.22.5", @@ -28298,7 +28216,7 @@ }, "packages/util-uid": { "name": "@onflow/util-uid", - "version": "1.2.2-alpha.1", + "version": "1.2.2-alpha.2", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.18.6" diff --git a/packages/sdk/src/block/block.js b/packages/sdk/src/block/block.js index 6cace8e72..6cc92df8e 100644 --- a/packages/sdk/src/block/block.js +++ b/packages/sdk/src/block/block.js @@ -12,7 +12,7 @@ import {invariant} from "@onflow/util-invariant" /** * @description Returns the latest block (optionally sealed or not), by id, or by height * @param {object} [queryOptions] - Query parameters - * @param {boolean} [queryOptions.sealed=false] - Whether to query for a sealed block + * @param {boolean} [queryOptions.sealed] - Whether to query for a sealed block * @param {number} [queryOptions.height] - Block height to query * @param {string} [queryOptions.id] - Block ID to query * @param {object} [opts] - Optional parameters diff --git a/packages/sdk/src/interaction/interaction.ts b/packages/sdk/src/interaction/interaction.ts index ed3c9817a..e1de5dd25 100644 --- a/packages/sdk/src/interaction/interaction.ts +++ b/packages/sdk/src/interaction/interaction.ts @@ -15,11 +15,13 @@ import {TypeDescriptor, TypeDescriptorInput} from "@onflow/types" type AcctFn = (acct: InteractionAccount) => InteractionAccount type AccountFn = AcctFn & Partial -export type CadenceArgument> = { +type CadenceArgument> = { value: TypeDescriptorInput xform: T } +export {CadenceArgument} + const ACCT = `{ "kind":"${InteractionResolverKind.ACCOUNT}", "tempId":null, diff --git a/packages/sdk/src/sdk.ts b/packages/sdk/src/sdk.ts index 94ce06bfa..39a48c653 100644 --- a/packages/sdk/src/sdk.ts +++ b/packages/sdk/src/sdk.ts @@ -9,6 +9,7 @@ export { encodeTransactionEnvelope, encodeTxIdFromVoucher, } from "./encode/encode" + // Utils export { interaction, // deprecated @@ -33,8 +34,10 @@ export { isGetBlockHeader, isGetCollection, isGetNetworkParameters, - CadenceArgument, } from "./interaction/interaction" +import type {CadenceArgument} from "./interaction/interaction" +export {CadenceArgument} // Workaround for babel https://github.com/babel/babel/issues/8361 + export {createSignableVoucher, voucherToTxId} from "./resolve/voucher" export {encodeMessageFromSignable} from "./wallet-utils/encode-signable.js" export {template as cadence} from "@onflow/util-template" From b10c9c3a35bd7ac0ca88590035ef9d1fcc0976e3 Mon Sep 17 00:00:00 2001 From: Jordan Ribbink Date: Wed, 24 Jan 2024 13:09:28 -0800 Subject: [PATCH 3/3] Fix pipe type --- packages/sdk/src/interaction/interaction.ts | 42 +++++++++++++++++---- packages/sdk/src/send/send.js | 2 +- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/packages/sdk/src/interaction/interaction.ts b/packages/sdk/src/interaction/interaction.ts index e1de5dd25..bec6d10aa 100644 --- a/packages/sdk/src/interaction/interaction.ts +++ b/packages/sdk/src/interaction/interaction.ts @@ -124,7 +124,7 @@ export const isObj = (d: any): d is Record => export const isNull = (d: any): d is null => d == null export const isFn = (d: any): d is Function => typeof d === "function" -export const isInteraction = (ix: Interaction) => { +export const isInteraction = (ix: unknown) => { if (!isObj(ix) || isNull(ix) || isNumber(ix)) return false for (let key of KEYS) if (!ix.hasOwnProperty(key)) return false return true @@ -314,10 +314,15 @@ const hardMode = (ix: Interaction) => { return ix } +type MaybePromise = T | Promise + const recPipe = async ( - ix: Interaction, - fns: (Function | Interaction)[] = [] -): Promise => { + ix: MaybePromise, + fns: ( + | ((x: Interaction) => MaybePromise) + | MaybePromise + )[] = [] +): Promise => { try { ix = hardMode(await ix) if (isBad(ix)) throw new Error(`Interaction Error: ${ix.reason}`) @@ -333,11 +338,34 @@ const recPipe = async ( } } -export const pipe = (...args: any[]) => { +/** + * @description Async pipe function to compose interactions + * @returns An interaction object + */ +function pipe( + fns: ((x: Interaction) => Interaction)[] +): (x: Interaction) => Promise +/** + * @description Async pipe function to compose interactions + * @returns An interaction object + */ +function pipe( + ix: MaybePromise, + fns: ((x: Interaction) => Interaction)[] +): Promise +function pipe( + ...args: + | [((x: Interaction) => Interaction)[]] + | [MaybePromise, ((x: Interaction) => Interaction)[]] +): Promise | ((x: Interaction) => Promise) { const [arg1, arg2] = args - if (isArray(arg1) && arg2 == null) return (d: any) => pipe(d, arg1) - return recPipe(arg1, arg2) + if (isArray(arg1)) return (d: Interaction) => pipe(d, arg1) + + const ix = arg1 as MaybePromise + const fns = arg2 as ((x: Interaction) => Interaction)[] + return recPipe(ix, fns) } +export {pipe} const identity = (v: T, ..._: any[]) => v diff --git a/packages/sdk/src/send/send.js b/packages/sdk/src/send/send.js index fe327ed68..e2baf17c6 100644 --- a/packages/sdk/src/send/send.js +++ b/packages/sdk/src/send/send.js @@ -9,7 +9,7 @@ import {resolve as defaultResolve} from "../resolve/resolve.js" /** * @description - Sends arbitrary scripts, transactions, and requests to Flow - * @param {Array.>} args - An array of functions that take interaction and return interaction + * @param {Array.} args - An array of functions that take interaction and return interaction * @param {object} opts - Optional parameters * @returns {Promise<*>} - A promise that resolves to a response */