Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@onflow/fcl

Package Overview
Dependencies
Maintainers
4
Versions
312
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onflow/fcl - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

2

dist/fcl.js

@@ -1,2 +0,2 @@

var r=require("@qvvg/mario"),t=require("@qvvg/templar"),n=require("@onflow/interaction"),e=r.pipe;exports.pipe=r.pipe,exports.Ok=r.Ok,exports.Nope=r.Nope,exports.isNope=r.isNope,exports.isOk=r.isOk,exports.getValue=r.getValue,exports.getReason=r.getReason,exports.getError=r.getError,exports.log=r.log,exports.__=r.__,exports.isUnknown=n.isUnknown,exports.isScript=n.isScript,exports.isTransaction=n.isTransaction,exports.isGetTransaction=n.isGetTransaction,exports.build=function(t){return r.pipe(n.interaction(),t)},exports.resolve=e,exports.script=function(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];return function(o){return(o=n.makeScript(o)).assigns.code=t.t7l.apply(void 0,e),r.Ok(o)}},exports.transaction=function(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];return function(o){return(o=n.makeTransaction(o)).assigns.code=t.t7l.apply(void 0,e),r.Ok(o)}},exports.getTransaction=function(t){return function(e){return(e=n.makeGetTransaction(e)).assigns.hash=t,r.Ok(e)}},exports.params=function(t){return void 0===t&&(t=[]),function(n){return n.assigns.params=t.reduce(function(r,t){var n;return Object.assign({},r,((n={})[t.key]=t.value,n))},{}),r.Ok(n)}},exports.param=function(r,t){return{key:r,value:t}},exports.payer=function(t){return function(n){return n.assigns.payerAuthorization=t,r.Ok(n)}},exports.authorizations=function(t){return void 0===t&&(t=[]),function(n){return n.assigns.authorizations=t,r.Ok(n)}},exports.authorization=function(r,t){return{acct:r,signFn:t}},exports.resolveParams=function(t){return"function"==typeof t.assigns.code&&(t.assigns.code=t.assigns.code(t.assigns.params)),r.Ok(t)};
var e=require("@qvvg/mario"),t=require("@qvvg/templar"),r=require("@onflow/interaction"),o=require("@onflow/assigns"),n=e.pipe,i=e.pipe([o.update("code",function(e){return"function"==typeof e?e(o.get(ix,"params",{})):e})]);exports.pipe=e.pipe,exports.Ok=e.Ok,exports.Nope=e.Nope,exports.isNope=e.isNope,exports.isOk=e.isOk,exports.getValue=e.getValue,exports.getReason=e.getReason,exports.getError=e.getError,exports.log=e.log,exports.__=e.__,exports.isUnknown=r.isUnknown,exports.isScript=r.isScript,exports.isTransaction=r.isTransaction,exports.isGetTransaction=r.isGetTransaction,exports.build=function(t){return e.pipe(r.interaction(),t)},exports.resolve=n,exports.script=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return e.pipe([r.makeScript,o.put("code",t.t7l.apply(void 0,n))])},exports.transaction=function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return e.pipe([r.makeTransaction,o.put("code",t.t7l.apply(void 0,n))])},exports.getTransaction=function(t){return e.pipe([r.makeGetTransaction,o.put("hash",t)])},exports.params=function(t){return void 0===t&&(t=[]),e.pipe([o.put("params",(r=t,void 0===r&&(r=[]),r.reduce(function(e,t){var r;return Object.assign({},e,((r={})[t.key]=t.value,r))},{})))]);var r},exports.param=function(e,t){return{key:e,value:t}},exports.payer=function(t){return e.pipe([o.put("payerAuthorization",t)])},exports.authorizations=function(t){return void 0===t&&(t=[]),e.pipe([o.put("authorization",t)])},exports.authorization=function(e,t){return{acct:e,signFn:t}},exports.resolveParams=i;
//# sourceMappingURL=fcl.js.map

@@ -1,2 +0,2 @@

import{pipe as n,Ok as r}from"@qvvg/mario";export{pipe,Ok,Nope,isNope,isOk,getValue,getReason,getError,log,__}from"@qvvg/mario";import{t7l as t}from"@qvvg/templar";import{interaction as o,makeScript as i,makeTransaction as e,makeGetTransaction as s}from"@onflow/interaction";export{isUnknown,isScript,isTransaction,isGetTransaction}from"@onflow/interaction";var u=function(r){return n(o(),r)},a=n,c=function(){for(var n=[],o=arguments.length;o--;)n[o]=arguments[o];return function(o){return(o=i(o)).assigns.code=t.apply(void 0,n),r(o)}},f=function(){for(var n=[],o=arguments.length;o--;)n[o]=arguments[o];return function(o){return(o=e(o)).assigns.code=t.apply(void 0,n),r(o)}},g=function(n){return function(t){return(t=s(t)).assigns.hash=n,r(t)}},p=function(n){return void 0===n&&(n=[]),function(t){return t.assigns.params=n.reduce(function(n,r){var t;return Object.assign({},n,((t={})[r.key]=r.value,t))},{}),r(t)}},v=function(n,r){return{key:n,value:r}},m=function(n){return function(t){return t.assigns.payerAuthorization=n,r(t)}},l=function(n){return void 0===n&&(n=[]),function(t){return t.assigns.authorizations=n,r(t)}},d=function(n,r){return{acct:n,signFn:r}},h=function(n){return"function"==typeof n.assigns.code&&(n.assigns.code=n.assigns.code(n.assigns.params)),r(n)};export{u as build,a as resolve,c as script,f as transaction,g as getTransaction,p as params,v as param,m as payer,l as authorizations,d as authorization,h as resolveParams};
import{pipe as r}from"@qvvg/mario";export{pipe,Ok,Nope,isNope,isOk,getValue,getReason,getError,log,__}from"@qvvg/mario";import{t7l as n}from"@qvvg/templar";import{interaction as o,makeScript as t,makeTransaction as i,makeGetTransaction as e}from"@onflow/interaction";export{isUnknown,isScript,isTransaction,isGetTransaction}from"@onflow/interaction";import{put as a,update as u,get as c}from"@onflow/assigns";var f=function(n){return r(o(),n)},p=r,s=function(){for(var o=[],i=arguments.length;i--;)o[i]=arguments[i];return r([t,a("code",n.apply(void 0,o))])},v=function(){for(var o=[],t=arguments.length;t--;)o[t]=arguments[t];return r([i,a("code",n.apply(void 0,o))])},m=function(n){return r([e,a("hash",n)])},g=function(n){return void 0===n&&(n=[]),r([a("params",(o=n,void 0===o&&(o=[]),o.reduce(function(r,n){var o;return Object.assign({},r,((o={})[n.key]=n.value,o))},{})))]);var o},l=function(r,n){return{key:r,value:n}},d=function(n){return r([a("payerAuthorization",n)])},h=function(n){return void 0===n&&(n=[]),r([a("authorization",n)])},y=function(r,n){return{acct:r,signFn:n}},k=r([u("code",function(r){return"function"==typeof r?r(c(ix,"params",{})):r})]);export{f as build,p as resolve,s as script,v as transaction,m as getTransaction,g as params,l as param,d as payer,h as authorizations,y as authorization,k as resolveParams};
//# sourceMappingURL=fcl.module.js.map

@@ -1,2 +0,2 @@

!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@qvvg/mario"),require("@qvvg/templar"),require("@onflow/interaction")):"function"==typeof define&&define.amd?define(["exports","@qvvg/mario","@qvvg/templar","@onflow/interaction"],t):t(n.fcl={},n.mario,n.templar,n.interaction)}(this,function(n,t,i,e){var r=t.pipe;n.pipe=t.pipe,n.Ok=t.Ok,n.Nope=t.Nope,n.isNope=t.isNope,n.isOk=t.isOk,n.getValue=t.getValue,n.getReason=t.getReason,n.getError=t.getError,n.log=t.log,n.__=t.__,n.isUnknown=e.isUnknown,n.isScript=e.isScript,n.isTransaction=e.isTransaction,n.isGetTransaction=e.isGetTransaction,n.build=function(n){return t.pipe(e.interaction(),n)},n.resolve=r,n.script=function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];return function(r){return(r=e.makeScript(r)).assigns.code=i.t7l.apply(void 0,n),t.Ok(r)}},n.transaction=function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];return function(r){return(r=e.makeTransaction(r)).assigns.code=i.t7l.apply(void 0,n),t.Ok(r)}},n.getTransaction=function(n){return function(i){return(i=e.makeGetTransaction(i)).assigns.hash=n,t.Ok(i)}},n.params=function(n){return void 0===n&&(n=[]),function(i){return i.assigns.params=n.reduce(function(n,t){var i;return Object.assign({},n,((i={})[t.key]=t.value,i))},{}),t.Ok(i)}},n.param=function(n,t){return{key:n,value:t}},n.payer=function(n){return function(i){return i.assigns.payerAuthorization=n,t.Ok(i)}},n.authorizations=function(n){return void 0===n&&(n=[]),function(i){return i.assigns.authorizations=n,t.Ok(i)}},n.authorization=function(n,t){return{acct:n,signFn:t}},n.resolveParams=function(n){return"function"==typeof n.assigns.code&&(n.assigns.code=n.assigns.code(n.assigns.params)),t.Ok(n)}});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@qvvg/mario"),require("@qvvg/templar"),require("@onflow/interaction"),require("@onflow/assigns")):"function"==typeof define&&define.amd?define(["exports","@qvvg/mario","@qvvg/templar","@onflow/interaction","@onflow/assigns"],n):n(e.fcl={},e.mario,e.templar,e.interaction,e.assigns)}(this,function(e,n,t,i,r){var o=n.pipe,a=n.pipe([r.update("code",function(e){return"function"==typeof e?e(r.get(ix,"params",{})):e})]);e.pipe=n.pipe,e.Ok=n.Ok,e.Nope=n.Nope,e.isNope=n.isNope,e.isOk=n.isOk,e.getValue=n.getValue,e.getReason=n.getReason,e.getError=n.getError,e.log=n.log,e.__=n.__,e.isUnknown=i.isUnknown,e.isScript=i.isScript,e.isTransaction=i.isTransaction,e.isGetTransaction=i.isGetTransaction,e.build=function(e){return n.pipe(i.interaction(),e)},e.resolve=o,e.script=function(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];return n.pipe([i.makeScript,r.put("code",t.t7l.apply(void 0,e))])},e.transaction=function(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];return n.pipe([i.makeTransaction,r.put("code",t.t7l.apply(void 0,e))])},e.getTransaction=function(e){return n.pipe([i.makeGetTransaction,r.put("hash",e)])},e.params=function(e){return void 0===e&&(e=[]),n.pipe([r.put("params",(t=e,void 0===t&&(t=[]),t.reduce(function(e,n){var t;return Object.assign({},e,((t={})[n.key]=n.value,t))},{})))]);var t},e.param=function(e,n){return{key:e,value:n}},e.payer=function(e){return n.pipe([r.put("payerAuthorization",e)])},e.authorizations=function(e){return void 0===e&&(e=[]),n.pipe([r.put("authorization",e)])},e.authorization=function(e,n){return{acct:e,signFn:n}},e.resolveParams=a});
//# sourceMappingURL=fcl.umd.js.map
{
"name": "@onflow/fcl",
"version": "0.0.9",
"version": "0.0.10",
"description": "Flow Client Library",

@@ -38,2 +38,3 @@ "license": "Apache-2.0",

"@onflow/interaction": "0.0.1",
"@onflow/assigns": "0.0.3",
"@qvvg/mario": "1.3.0",

@@ -40,0 +41,0 @@ "@qvvg/templar": "0.0.0"

@@ -1,2 +0,2 @@

import {pipe, Ok} from "@qvvg/mario"
import {pipe, Ok, __} from "@qvvg/mario"
import {t7l} from "@qvvg/templar"

@@ -9,2 +9,3 @@ import {

} from "@onflow/interaction"
import {put, update, get} from "@onflow/assigns"

@@ -35,24 +36,11 @@ export {

/* BUILDERS */
export const script = (...args) => ix => {
ix = makeScript(ix)
ix.assigns.code = t7l(...args)
return Ok(ix)
}
export const script = (...args) => pipe([makeScript, put("code", t7l(...args))])
export const transaction = (...args) => ix => {
ix = makeTransaction(ix)
ix.assigns.code = t7l(...args)
return Ok(ix)
}
export const transaction = (...args) =>
pipe([makeTransaction, put("code", t7l(...args))])
export const getTransaction = hash => ix => {
ix = makeGetTransaction(ix)
ix.assigns.hash = hash
return Ok(ix)
}
export const getTransaction = hash =>
pipe([makeGetTransaction, put("hash", hash)])
export const params = (px = []) => ix => {
ix.assigns.params = px.reduce((acc, d) => ({...acc, [d.key]: d.value}), {})
return Ok(ix)
}
export const params = (px = []) => pipe([put("params", toMap(px))])

@@ -63,11 +51,6 @@ export const param = (key, value) => {

export const payer = authorization => ix => {
ix.assigns.payerAuthorization = authorization
return Ok(ix)
}
export const payer = authorization =>
pipe([put("payerAuthorization", authorization)])
export const authorizations = (ax = []) => ix => {
ix.assigns.authorizations = ax
return Ok(ix)
}
export const authorizations = (ax = []) => pipe([put("authorization", ax)])

@@ -79,7 +62,13 @@ export const authorization = (acct, signFn) => {

/* RESOLVERS */
export const resolveParams = ix => {
if (typeof ix.assigns.code === "function") {
ix.assigns.code = ix.assigns.code(ix.assigns.params)
}
return Ok(ix)
export const resolveParams = pipe([
update("code", code => (isFn(code) ? code(get(ix, "params", {})) : code)),
])
/* Helpers */
function toMap(kv = []) {
return kv.reduce((acc, d) => ({...acc, [d.key]: d.value}), {})
}
function isFn(value) {
return typeof value === "function"
}

@@ -1,3 +0,37 @@

it("works", () => {
expect(1).toBe(1);
});
import {get} from "@onflow/assigns"
import {
build,
script,
params,
param,
isOk,
isNope,
getValue,
isScript,
} from "./fcl.js"
describe("mvp non-realized script", () => {
let ix
beforeEach(async () => {
ix = getValue(
await build([
script`log("${p => p.words}")`,
params([param("words", "TEST")]),
])
)
})
it("is a script", () => {
expect(isScript(ix)).toBeTruthy()
})
it("stored a function as code", () => {
expect(typeof get(ix, "code")).toBe("function")
})
it("stored a map of params as params", () => {
expect(typeof get(ix, "params")).toBe("object")
})
it("stored TEST as a string in params.words", () => {
expect(get(ix, "params").words).toBe("TEST")
})
})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc