@frak-labs/core-sdk
Version:
Core SDK of the Frak wallet, low level library to interact directly with the frak ecosystem.
1 lines • 4.88 kB
JavaScript
;let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,r)=>{for(var t in r)__webpack_require__.o(r,t)&&!__webpack_require__.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},__webpack_require__.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{PressInteractionEncoder:()=>PressInteractionEncoder,ReferralInteractionEncoder:()=>ReferralInteractionEncoder,RetailInteractionEncoder:()=>RetailInteractionEncoder,PurchaseInteractionEncoder:()=>PurchaseInteractionEncoder,WebShopInteractionEncoder:()=>WebShopInteractionEncoder});let external_viem_namespaceObject=require("viem"),interactionTypes={press:{openArticle:"0xc0a24ffb",readArticle:"0xd5bd0fbe"},dapp:{proofVerifiableStorageUpdate:"0x2ab2aeef",callableVerifiableStorageUpdate:"0xa07da986"},webshop:{open:"0xb311798f"},referral:{referred:"0x010cc3b9",createLink:"0xb2c0f17c"},purchase:{started:"0xd87e90c3",completed:"0x8403aeb4",unsafeCompleted:"0x4d5b14e0"},retail:{customerMeeting:"0x74489004"}},productTypes={dapp:1,press:2,webshop:3,retail:4,referral:30,purchase:31},productTypesMask=Object.entries(productTypes).reduce((e,[r,t])=>(e[r]=BigInt(1)<<BigInt(t),e),{}),PressInteractionEncoder={openArticle({articleId:e}){let r=(0,external_viem_namespaceObject.concatHex)([interactionTypes.press.openArticle,(0,external_viem_namespaceObject.pad)(e,{size:32})]);return{handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.press),interactionData:r}},readArticle({articleId:e}){let r=(0,external_viem_namespaceObject.concatHex)([interactionTypes.press.readArticle,(0,external_viem_namespaceObject.pad)(e,{size:32})]);return{handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.press),interactionData:r}}},ReferralInteractionEncoder={createLink:()=>({handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.referral),interactionData:interactionTypes.referral.createLink}),referred({referrer:e}){let r=(0,external_viem_namespaceObject.concatHex)([interactionTypes.referral.referred,(0,external_viem_namespaceObject.pad)(e,{size:32})]);return{handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.referral),interactionData:r}}},PurchaseInteractionEncoder={startPurchase({purchaseId:e}){let r=(0,external_viem_namespaceObject.concatHex)([interactionTypes.purchase.started,(0,external_viem_namespaceObject.pad)(e,{size:32})]);return{handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.purchase),interactionData:r}},completedPurchase({purchaseId:e,proof:r}){let t=(0,external_viem_namespaceObject.encodeAbiParameters)([{type:"uint256"},{type:"bytes32[]"}],[BigInt(e),r]),a=(0,external_viem_namespaceObject.concatHex)([interactionTypes.purchase.completed,t]);return{handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.purchase),interactionData:a}},unsafeCompletedPurchase({purchaseId:e}){let r=(0,external_viem_namespaceObject.concatHex)([interactionTypes.purchase.unsafeCompleted,(0,external_viem_namespaceObject.pad)(e,{size:32})]);return{handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.purchase),interactionData:r}}},WebShopInteractionEncoder={open:()=>({handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.webshop),interactionData:interactionTypes.webshop.open})},RetailInteractionEncoder={customerMeeting({agencyId:e}){let r=(0,external_viem_namespaceObject.concatHex)([interactionTypes.retail.customerMeeting,(0,external_viem_namespaceObject.pad)(e,{size:32})]);return{handlerTypeDenominator:(0,external_viem_namespaceObject.toHex)(productTypes.retail),interactionData:r}}};for(var __webpack_i__ in exports.PressInteractionEncoder=__webpack_exports__.PressInteractionEncoder,exports.PurchaseInteractionEncoder=__webpack_exports__.PurchaseInteractionEncoder,exports.ReferralInteractionEncoder=__webpack_exports__.ReferralInteractionEncoder,exports.RetailInteractionEncoder=__webpack_exports__.RetailInteractionEncoder,exports.WebShopInteractionEncoder=__webpack_exports__.WebShopInteractionEncoder,__webpack_exports__)-1===["PressInteractionEncoder","PurchaseInteractionEncoder","ReferralInteractionEncoder","RetailInteractionEncoder","WebShopInteractionEncoder"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});