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

@onflow/sdk-send

Package Overview
Dependencies
Maintainers
8
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onflow/sdk-send - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

26

CHANGELOG.md

@@ -5,2 +5,28 @@ ### Unreleased

### 0.0.4 -- 2020-11-17
- 2020-11-17 -- Globally Injectable Send and Resolve Function as Config
- 2020-11-17 -- Injectable Send and Resolve Function as Option
> Notes
```javascript
// As Config
import {config} from "@onflow/config"
config()
.put("sdk.resolve", async (ix) => ix)
.put("sdk.send", async (ix) => console.log(ix))
await send([getAccount("0x1d007d755706c469")])
// As Options
const opts = {
resolve: async (ix) => ix,
send: async (ix) => console.log(ix),
}
await send([getAccount("0x1d007d755706c469")], opts)
```
### 0.0.3 -- 2020-11-04

@@ -7,0 +33,0 @@

2

dist/sdk-send.js

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

var e=require("@onflow/interaction"),r=require("@onflow/send"),n=require("@onflow/sdk-resolve");exports.send=function(o,i){void 0===o&&(o=[]),void 0===i&&(i={});try{return Array.isArray(o)&&(o=e.pipe(e.interaction(),o)),Promise.resolve(n.resolve(i)(o)).then(function(e){return r.send(e,i)})}catch(e){return Promise.reject(e)}};
var e=require("@onflow/interaction"),r=require("@onflow/send"),n=require("@onflow/sdk-resolve"),o=require("@onflow/config");exports.send=function(i,t){void 0===i&&(i=[]),void 0===t&&(t={});try{return Promise.resolve(o.config().get("sdk.send",t.send||r.send)).then(function(r){return Promise.resolve(o.config().get("sdk.resolve",t.resolve||n.resolve(t))).then(function(n){return Array.isArray(i)&&(i=e.pipe(e.interaction(),i)),Promise.resolve(n(i)).then(function(e){return r(e,t)})})})}catch(e){return Promise.reject(e)}};
//# sourceMappingURL=sdk-send.js.map

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

import{pipe as o,interaction as r}from"@onflow/interaction";import{send as n}from"@onflow/send";import{resolve as s}from"@onflow/sdk-resolve";const t=async(t=[],a={})=>(Array.isArray(t)&&(t=o(r(),t)),n(await s(a)(t),a));export{t as send};
import{pipe as o,interaction as r}from"@onflow/interaction";import{send as e}from"@onflow/send";import{resolve as n}from"@onflow/sdk-resolve";import{config as s}from"@onflow/config";const t=async(t=[],a={})=>{const i=await s().get("sdk.send",a.send||e),f=await s().get("sdk.resolve",a.resolve||n(a));return Array.isArray(t)&&(t=o(r(),t)),i(await f(t),a)};export{t as send};
//# sourceMappingURL=sdk-send.modern.js.map

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

import{pipe as r,interaction as o}from"@onflow/interaction";import{send as e}from"@onflow/send";import{resolve as n}from"@onflow/sdk-resolve";var t=function(t,i){void 0===t&&(t=[]),void 0===i&&(i={});try{return Array.isArray(t)&&(t=r(o(),t)),Promise.resolve(n(i)(t)).then(function(r){return e(r,i)})}catch(r){return Promise.reject(r)}};export{t as send};
import{pipe as r,interaction as o}from"@onflow/interaction";import{send as e}from"@onflow/send";import{resolve as n}from"@onflow/sdk-resolve";import{config as t}from"@onflow/config";var s=function(s,i){void 0===s&&(s=[]),void 0===i&&(i={});try{return Promise.resolve(t().get("sdk.send",i.send||e)).then(function(e){return Promise.resolve(t().get("sdk.resolve",i.resolve||n(i))).then(function(n){return Array.isArray(s)&&(s=r(o(),s)),Promise.resolve(n(s)).then(function(r){return e(r,i)})})})}catch(r){return Promise.reject(r)}};export{s as send};
//# sourceMappingURL=sdk-send.module.js.map

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@onflow/interaction"),require("@onflow/send"),require("@onflow/sdk-resolve")):"function"==typeof define&&define.amd?define(["exports","@onflow/interaction","@onflow/send","@onflow/sdk-resolve"],n):n((e=e||self).sdkSend={},e.interaction,e.send$1,e.sdkResolve)}(this,function(e,n,o,r){e.send=function(e,t){void 0===e&&(e=[]),void 0===t&&(t={});try{return Array.isArray(e)&&(e=n.pipe(n.interaction(),e)),Promise.resolve(r.resolve(t)(e)).then(function(e){return o.send(e,t)})}catch(e){return Promise.reject(e)}}});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@onflow/interaction"),require("@onflow/send"),require("@onflow/sdk-resolve"),require("@onflow/config")):"function"==typeof define&&define.amd?define(["exports","@onflow/interaction","@onflow/send","@onflow/sdk-resolve","@onflow/config"],n):n((e=e||self).sdkSend={},e.interaction,e.send$1,e.sdkResolve,e.config)}(this,function(e,n,o,r,i){e.send=function(e,t){void 0===e&&(e=[]),void 0===t&&(t={});try{return Promise.resolve(i.config().get("sdk.send",t.send||o.send)).then(function(o){return Promise.resolve(i.config().get("sdk.resolve",t.resolve||r.resolve(t))).then(function(r){return Array.isArray(e)&&(e=n.pipe(n.interaction(),e)),Promise.resolve(r(e)).then(function(e){return o(e,t)})})})}catch(e){return Promise.reject(e)}}});
//# sourceMappingURL=sdk-send.umd.js.map
{
"name": "@onflow/sdk-send",
"version": "0.0.3",
"version": "0.0.4",
"description": "Flow JS SDK -- Send interactions to Access Nodes after resolving them with the default resolver.",

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

"dependencies": {
"@onflow/config": "0.0.2",
"@onflow/interaction": "0.0.10",

@@ -39,0 +40,0 @@ "@onflow/sdk-resolve": "0.0.4",

import {interaction, pipe} from "@onflow/interaction"
import {send as baseSend} from "@onflow/send"
import {resolve} from "@onflow/sdk-resolve"
import {send as defaultSend} from "@onflow/send"
import {resolve as defaultResolve} from "@onflow/sdk-resolve"
import {config} from "@onflow/config"
export const send = async (args = [], opts = {}) => {
const sendFunction = await config().get("sdk.send", opts.send || defaultSend)
const resolveFunction = await config().get(
"sdk.resolve",
opts.resolve || defaultResolve(opts)
)
if (Array.isArray(args)) args = pipe(interaction(), args)
return baseSend(await resolve(opts)(args), opts)
return sendFunction(await resolveFunction(args), opts)
}

@@ -1,3 +0,21 @@

test("placeholder", () => {
expect(0).toBe(0)
import {send} from "./index"
test("injection as option", async () => {
const buildFunction = jest.fn(async (ix) => ix)
const resolveFunction = jest.fn(async (ix) => ix)
const sendFunction = jest.fn(async (ix) => ix)
await send([buildFunction], {
resolve: resolveFunction,
send: sendFunction,
})
expect(buildFunction).toHaveBeenCalledTimes(1)
expect(resolveFunction).toHaveBeenCalledTimes(1)
expect(sendFunction).toHaveBeenCalledTimes(1)
const ix = buildFunction.mock.calls[0][0]
expect(ix).toEqual(await resolveFunction.mock.calls[0][0])
expect(ix).toEqual(await sendFunction.mock.calls[0][0])
})

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

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