UNPKG

@mycrypto/unlock-scan

Version:

An efficient Unlock Protocol scanner

2 lines 729 B
import{decode,encode}from"@findeth/abi";import{call,toNestedBalanceMap,withId}from"@mycrypto/eth-scan";import{CALL_ID,CALL_TYPE,CONTRACT_ADDRESS,KEY_EXPIRATION_TIMESTAMP_FOR_ID,KEY_EXPIRATION_TIMESTAMP_FOR_TYPE}from"./constants";export const callMultiple=async(a,b,c,d,e)=>{var f;const g=null!==(f=null===e||void 0===e?void 0:e.contractAddress)&&void 0!==f?f:CONTRACT_ADDRESS,h=await b.reduce(async(b,d)=>{const e=await b,f=withId(KEY_EXPIRATION_TIMESTAMP_FOR_ID,encode(KEY_EXPIRATION_TIMESTAMP_FOR_TYPE,[d])),h=withId(CALL_ID,encode(CALL_TYPE,[c,Array(c.length).fill(f)])),i=decode(["(bool,bytes)[]"],(await call(a,g,h)))[0];return[...e,i]},Promise.resolve([]));return toNestedBalanceMap(b,c,h)}; //# sourceMappingURL=api.js.map