@arcblock/payment-service 1.29.2 → 1.29.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cf.d.ts +104 -0
- package/dist/cf.js +598 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.js +755 -359
- package/package.json +14 -6
- package/web/assets/Community-DjnKQ_eJ.js +1 -0
- package/web/assets/Holiday-B3mAiPaR.js +1 -0
- package/web/assets/Meeting-Boiro55U.js +1 -0
- package/web/assets/OffSick-CmlSODCj.js +1 -0
- package/web/assets/WorkingRemotely-CQReAoVA.js +1 -0
- package/web/assets/abtwallet-o1JAGJkW.png +0 -0
- package/web/assets/account-DETfFe4_.js +1 -0
- package/web/assets/action-B_DQJlip.js +1 -0
- package/web/assets/actions-BaDh4xWX.js +1 -0
- package/web/assets/actions-BknL4OyZ.js +1 -0
- package/web/assets/actions-Bt_jST94.js +1 -0
- package/web/assets/actions-BtaoyTWt.js +1 -0
- package/web/assets/actions-D9MHLBFH.js +1 -0
- package/web/assets/actions-DJyfN5OU.js +1 -0
- package/web/assets/actions-EPYeS5p4.js +1 -0
- package/web/assets/actions-QPa-8lfB.js +1 -0
- package/web/assets/actions-jxGAdGfb.js +1 -0
- package/web/assets/add-price-CD-utowo.js +1 -0
- package/web/assets/admin-_nEB-lHn.js +52 -0
- package/web/assets/aistro-NLUOUWwT.png +0 -0
- package/web/assets/android-Xe96zWxX.png +0 -0
- package/web/assets/assign-CkV5Q2LP.js +1 -0
- package/web/assets/attempts-DySeqBYU.js +1 -0
- package/web/assets/bedrock-yFRPpe__.png +0 -0
- package/web/assets/browser-Bb9g-cvG.js +1 -0
- package/web/assets/browser-DSLTxXlL.js +1 -0
- package/web/assets/cache-state-lld4zuDg.js +1 -0
- package/web/assets/change-payment-CPUCUEER.js +1 -0
- package/web/assets/change-plan-CxE-XfWc.js +1 -0
- package/web/assets/chrome-BPS46pXA.js +23 -0
- package/web/assets/click-boundary-y8dVA_tr.js +1 -0
- package/web/assets/collapse-BvbJGg1V.js +1 -0
- package/web/assets/collapse-CSrlJ0eG.js +1 -0
- package/web/assets/connect-CC_l_f6Q.js +5 -0
- package/web/assets/copyable-DpX04wZz.js +1 -0
- package/web/assets/create-3SsWCAOC.js +1 -0
- package/web/assets/create-BkQAaSvD.js +1 -0
- package/web/assets/create-BmcRybZ5.js +1 -0
- package/web/assets/create-Bs65p5Ne.js +1 -0
- package/web/assets/create-kG09X9gl.js +1 -0
- package/web/assets/create-tYebjhr9.js +1 -0
- package/web/assets/credit-grant-item-list-Bk27jIc7.js +1 -0
- package/web/assets/credit-overview-DmMSEs14.js +5 -0
- package/web/assets/currency-GstdXsJf.js +1 -0
- package/web/assets/currency-restrictions-DYLv4YyW.js +1 -0
- package/web/assets/currency-select-DGS-62-L.js +1 -0
- package/web/assets/dayjs-B9tvQIKg.js +1 -0
- package/web/assets/deepseek-C3x42pq3.png +0 -0
- package/web/assets/description-Ym17DL48.js +1 -0
- package/web/assets/detail-15zxCbV9.js +10 -0
- package/web/assets/detail-ASPdMJoW.js +1 -0
- package/web/assets/detail-BJTcK7mx.js +1 -0
- package/web/assets/detail-CIx9vkir.js +1 -0
- package/web/assets/detail-CT9Unyrf.js +1 -0
- package/web/assets/detail-Cb9HBSMw.js +1 -0
- package/web/assets/detail-Cr2wG4Th.js +1 -0
- package/web/assets/detail-CxYQYu_l.js +11 -0
- package/web/assets/detail-D5KRrQDx.js +1 -0
- package/web/assets/detail-D5NbV29V.js +1 -0
- package/web/assets/detail-DB56SG-k.js +1 -0
- package/web/assets/detail-DE3OOC5M.js +15 -0
- package/web/assets/detail-DG4l2CqN.js +1 -0
- package/web/assets/detail-DPCTQLOx.js +1 -0
- package/web/assets/detail-DVVzYhdV.js +1 -0
- package/web/assets/detail-Do9QO5L2.js +1 -0
- package/web/assets/detail-Dqc0OfCQ.js +1 -0
- package/web/assets/detail-DuO_Jn5X.js +1 -0
- package/web/assets/detail-DuWdZIyp.js +1 -0
- package/web/assets/detail-K9EVY3r2.js +1 -0
- package/web/assets/detail-OZeeKI69.js +24 -0
- package/web/assets/detail-cwHZbY62.js +1 -0
- package/web/assets/detail-uhlID8jD.js +15 -0
- package/web/assets/doubao-yPqHSkLx.png +0 -0
- package/web/assets/drawer-form-Cl0T1Yyt.js +24 -0
- package/web/assets/edit-3HUAnaXW.js +1 -0
- package/web/assets/editor-BF5I0siU.js +1 -0
- package/web/assets/embed-CsNqeCd0.js +1 -0
- package/web/assets/filter-toolbar-BydfQ-79.js +56 -0
- package/web/assets/form-BGm5NPDn.js +1 -0
- package/web/assets/form-BXAuSawq.js +9 -0
- package/web/assets/form-CKfKLGXP.js +16 -0
- package/web/assets/form-DSzMo9UD.js +66 -0
- package/web/assets/form-P4luyUpY.js +9 -0
- package/web/assets/gas-Qf0SSUfS.js +1 -0
- package/web/assets/gemini-DffKpc81.png +0 -0
- package/web/assets/generateCategoricalChart-BaWwaXky.js +55 -0
- package/web/assets/google-DT1VSJ0m.png +0 -0
- package/web/assets/header-ivXuPt06.js +1 -0
- package/web/assets/home-HbrLyxJL.js +2 -0
- package/web/assets/html2canvas.esm-3ybT_T2r.js +5 -0
- package/web/assets/ideogram-REIjy0Er.png +0 -0
- package/web/assets/index-0HK7CYm4.js +1 -0
- package/web/assets/index-1y9kjPIr.js +1 -0
- package/web/assets/index-2l22EYw9.js +1 -0
- package/web/assets/index-9xBRL_33.js +1 -0
- package/web/assets/index-B1pTTyGZ.js +1 -0
- package/web/assets/index-BFML4-2u.js +170 -0
- package/web/assets/index-BIoSdRvX.js +12 -0
- package/web/assets/index-BJ_E6bEO.js +1 -0
- package/web/assets/index-BMKZToMM.js +28 -0
- package/web/assets/index-BP53rZV9.js +1 -0
- package/web/assets/index-Bnyh4rlV.js +1 -0
- package/web/assets/index-BoQ7wf3O.js +1 -0
- package/web/assets/index-Br7_mvEw.js +1 -0
- package/web/assets/index-C0JaS08f.js +38 -0
- package/web/assets/index-C68x-aau.js +1 -0
- package/web/assets/index-C8s2QKoe.js +1 -0
- package/web/assets/index-CI_EY4YS.js +1 -0
- package/web/assets/index-CdkYrABk.js +1 -0
- package/web/assets/index-Clbt8nRm.js +1 -0
- package/web/assets/index-Cn7O-OP7.js +49 -0
- package/web/assets/index-Cw0ugaQL.js +1 -0
- package/web/assets/index-DE2KzqXl.js +1 -0
- package/web/assets/index-DPodCQ9c.js +1 -0
- package/web/assets/index-DU39aG5u.js +1 -0
- package/web/assets/index-DZpJPE1Z.js +1 -0
- package/web/assets/index-Dc954mDP.js +1 -0
- package/web/assets/index-DgSc1Qy8.js +684 -0
- package/web/assets/index-Dr_MwbKt.js +38 -0
- package/web/assets/index-Drav4oDH.js +61 -0
- package/web/assets/index-DtbqgSK4.js +1 -0
- package/web/assets/index-DuRu9NWB.js +14 -0
- package/web/assets/index-SYTpMMMH.js +13 -0
- package/web/assets/index-WMKOiUez.js +1 -0
- package/web/assets/index-dmHgoplS.js +1 -0
- package/web/assets/index-fByZjxLy.js +1 -0
- package/web/assets/index-fswPX_qe.js +1 -0
- package/web/assets/index-txVTkoDD.js +1 -0
- package/web/assets/index.es-BWnfUzLb.js +5 -0
- package/web/assets/info-card-C1yxhxJG.js +1 -0
- package/web/assets/info-metric-CNse3r66.js +1 -0
- package/web/assets/info-row-DOK2whMn.js +1 -0
- package/web/assets/info-row-group-BeUhWnnY.js +1 -0
- package/web/assets/ios-CBDmY-ic.png +0 -0
- package/web/assets/lexend-latin-400-normal-CHypAkT3.woff +0 -0
- package/web/assets/lexend-latin-400-normal-CwRJVcUA.woff2 +0 -0
- package/web/assets/lexend-latin-600-normal-DSBzZxpA.woff +0 -0
- package/web/assets/lexend-latin-600-normal-DdvlkEkX.woff2 +0 -0
- package/web/assets/lexend-latin-ext-400-normal-D38JI5AK.woff2 +0 -0
- package/web/assets/lexend-latin-ext-400-normal-D9P7pMo-.woff +0 -0
- package/web/assets/lexend-latin-ext-600-normal-BXtyp5LP.woff +0 -0
- package/web/assets/lexend-latin-ext-600-normal-hDcqLAH9.woff2 +0 -0
- package/web/assets/lexend-vietnamese-400-normal-DoLa7jNB.woff2 +0 -0
- package/web/assets/lexend-vietnamese-400-normal-mPlHoWg5.woff +0 -0
- package/web/assets/lexend-vietnamese-600-normal-BxEVPgxw.woff +0 -0
- package/web/assets/lexend-vietnamese-600-normal-Cr1ePs6O.woff2 +0 -0
- package/web/assets/libphonenumber-CyphiuxQ.js +7 -0
- package/web/assets/link-3eeclTeS.js +1 -0
- package/web/assets/link-DMWJcQvZ.js +1 -0
- package/web/assets/list-1OG83xc4.js +1 -0
- package/web/assets/list-C521zE_7.js +1 -0
- package/web/assets/list-CNmzJKIQ.js +1 -0
- package/web/assets/list-CO0X4L3-.js +1 -0
- package/web/assets/list-D-I0msRW.js +35 -0
- package/web/assets/list-D1aevUOI.js +5 -0
- package/web/assets/list-DnePqZ2K.js +1 -0
- package/web/assets/list-jHj_5yy3.js +1 -0
- package/web/assets/lodash-B4Ozcv0x.js +20 -0
- package/web/assets/lottie-error-DeJ4jU66.js +1 -0
- package/web/assets/lottie-loading-Npqo86wA.js +1 -0
- package/web/assets/lottie-react.esm-BuFP9VDV.js +256 -0
- package/web/assets/lottie-welcome-oyMgXGo-.js +1 -0
- package/web/assets/metadata-CMSHcSXi.js +55 -0
- package/web/assets/meter-event-lmNMgmIu.js +1 -0
- package/web/assets/metrics-C7U41HWk.js +1 -0
- package/web/assets/ollama-C7MZn2d_.png +0 -0
- package/web/assets/openai-DlpqJdrb.png +0 -0
- package/web/assets/overview-CH1HnSP-.js +1 -0
- package/web/assets/overview-Cs3-8n4e.js +6 -0
- package/web/assets/past-due-CGGRZmXY.js +5 -0
- package/web/assets/pay-CSpHBUh_.js +4 -0
- package/web/assets/payment-kit-DYSjmihw.png +0 -0
- package/web/assets/payment-method-info-BsOBbA3m.js +16 -0
- package/web/assets/poe-B588TgZu.png +0 -0
- package/web/assets/preview-CjYh9dTg.js +1 -0
- package/web/assets/preview-DjYRpRA8.js +1 -0
- package/web/assets/pricing-table-C3Lkhq46.js +36 -0
- package/web/assets/pricing-table-edE6TJGX.js +1 -0
- package/web/assets/product-select-0ScZE2e8.js +1 -0
- package/web/assets/react-stripe.esm-BZIKAsrR.js +2 -0
- package/web/assets/recharge-DcPtT8vt.js +14 -0
- package/web/assets/related-credit-grants-BygNGPfb.js +124 -0
- package/web/assets/roboto-latin-400-normal-BVyCgWwA.woff +0 -0
- package/web/assets/roboto-latin-400-normal-DXyFPIdK.woff2 +0 -0
- package/web/assets/roboto-latin-500-normal-C6iW8rdg.woff2 +0 -0
- package/web/assets/roboto-latin-500-normal-rpP1_v3s.woff +0 -0
- package/web/assets/roboto-latin-700-normal-BWcFiwQV.woff +0 -0
- package/web/assets/roboto-latin-700-normal-CbYYDfWS.woff2 +0 -0
- package/web/assets/roboto-latin-ext-400-normal-BSFkPfbf.woff +0 -0
- package/web/assets/roboto-latin-ext-400-normal-DgXbz5gU.woff2 +0 -0
- package/web/assets/roboto-latin-ext-500-normal-DvHxAkTn.woff +0 -0
- package/web/assets/roboto-latin-ext-500-normal-OQJhyaXd.woff2 +0 -0
- package/web/assets/roboto-latin-ext-700-normal-Ba-CAIIA.woff +0 -0
- package/web/assets/roboto-latin-ext-700-normal-DchBbzVz.woff2 +0 -0
- package/web/assets/safe-did-address-B0fFbUph.js +1 -0
- package/web/assets/source-data-viewer-By_Utay-.js +1 -0
- package/web/assets/status-l6pD08fw.js +1 -0
- package/web/assets/stripe.esm-BCCu7gPj.js +1 -0
- package/web/assets/style-BWb904Pt.css +1 -0
- package/web/assets/subscription-DcwhSOpa.js +1 -0
- package/web/assets/subscription-Dq22e3D1.js +1 -0
- package/web/assets/table-BRU4Enia.js +1 -0
- package/web/assets/tax-code-select-CWhIIiXi.js +1 -0
- package/web/assets/tax-utils-DqNX34-r.js +1 -0
- package/web/assets/tokenList-9PBdKlKn.js +1 -0
- package/web/assets/ubuntu-mono-cyrillic-400-normal-Di_0TARV.woff +0 -0
- package/web/assets/ubuntu-mono-cyrillic-400-normal-OGyu3tt3.woff2 +0 -0
- package/web/assets/ubuntu-mono-cyrillic-ext-400-normal-C5u8faa9.woff2 +0 -0
- package/web/assets/ubuntu-mono-cyrillic-ext-400-normal-CL-A5l1V.woff +0 -0
- package/web/assets/ubuntu-mono-greek-400-normal-CCUzT4Jh.woff2 +0 -0
- package/web/assets/ubuntu-mono-greek-400-normal-DR50Gfyl.woff +0 -0
- package/web/assets/ubuntu-mono-greek-ext-400-normal-BNZd3ZNJ.woff +0 -0
- package/web/assets/ubuntu-mono-greek-ext-400-normal-CUE8Ia0W.woff2 +0 -0
- package/web/assets/ubuntu-mono-latin-400-normal-DpWeehTz.woff +0 -0
- package/web/assets/ubuntu-mono-latin-400-normal-l4cqI2xd.woff2 +0 -0
- package/web/assets/ubuntu-mono-latin-ext-400-normal-C-izf5FM.woff +0 -0
- package/web/assets/ubuntu-mono-latin-ext-400-normal-Cadvr_Yo.woff2 +0 -0
- package/web/assets/uploader-DRXDz_r0.js +9 -0
- package/web/assets/usage-records-jjJMZ6DI.js +1 -0
- package/web/assets/util-mDHAL0lx.js +1 -0
- package/web/assets/vendor-arcblock-ChFCRdyx.js +175 -0
- package/web/assets/vendor-blocklet-D_i_QeSo.js +2742 -0
- package/web/assets/vendor-mui-BXZut9Pz.js +225 -0
- package/web/assets/vendor-react-BPknnnEA.js +1 -0
- package/web/currencies/0xBTC.png +0 -0
- package/web/currencies/1INCH.svg +1 -0
- package/web/currencies/AAVE.svg +1 -0
- package/web/currencies/ABT.svg +16 -0
- package/web/currencies/ACX.png +0 -0
- package/web/currencies/ADX.svg +12 -0
- package/web/currencies/AIKEK.png +0 -0
- package/web/currencies/AJNA.svg +12 -0
- package/web/currencies/AKIRA.png +0 -0
- package/web/currencies/ALEX.png +0 -0
- package/web/currencies/ALI.png +0 -0
- package/web/currencies/ALT.svg +12 -0
- package/web/currencies/AMKT.svg +5 -0
- package/web/currencies/AMP.svg +7 -0
- package/web/currencies/APU.png +0 -0
- package/web/currencies/APW.svg +21 -0
- package/web/currencies/APX.png +0 -0
- package/web/currencies/ARC.png +0 -0
- package/web/currencies/ARIA20.svg +1 -0
- package/web/currencies/ARPA.svg +1 -0
- package/web/currencies/ATH.svg +1 -0
- package/web/currencies/AVC.png +0 -0
- package/web/currencies/AVRK.png +0 -0
- package/web/currencies/AXGT.svg +1 -0
- package/web/currencies/AZUR.svg +20 -0
- package/web/currencies/BAL.png +0 -0
- package/web/currencies/BANK.png +0 -0
- package/web/currencies/BAXA.svg +3 -0
- package/web/currencies/BCAT.png +0 -0
- package/web/currencies/BEPRO.svg +1 -0
- package/web/currencies/BERRY.svg +1 -0
- package/web/currencies/BICO.svg +11 -0
- package/web/currencies/BITBOT.jpg +0 -0
- package/web/currencies/BITCOIN.png +0 -0
- package/web/currencies/BKN.svg +1 -0
- package/web/currencies/BLUE.png +0 -0
- package/web/currencies/BNB.png +0 -0
- package/web/currencies/BOBA.svg +16 -0
- package/web/currencies/BOBO.png +0 -0
- package/web/currencies/BOND.svg +10 -0
- package/web/currencies/BOTTO.svg +4 -0
- package/web/currencies/BRIGHT.svg +83 -0
- package/web/currencies/BTRST.svg +1 -0
- package/web/currencies/BURN.png +0 -0
- package/web/currencies/BitANT.png +0 -0
- package/web/currencies/BitBTC.png +0 -0
- package/web/currencies/CARD.svg +1 -0
- package/web/currencies/CBX.svg +1 -0
- package/web/currencies/CHI.svg +1 -0
- package/web/currencies/CIG.svg +21 -0
- package/web/currencies/CNG.svg +9 -0
- package/web/currencies/COC.svg +8 -0
- package/web/currencies/COLLAB.svg +8 -0
- package/web/currencies/COMP.svg +1 -0
- package/web/currencies/COW.svg +1 -0
- package/web/currencies/CRV.png +0 -0
- package/web/currencies/CRYO.svg +1 -0
- package/web/currencies/CTRAVL.svg +1 -0
- package/web/currencies/CTSI.svg +1 -0
- package/web/currencies/CTX.svg +1 -0
- package/web/currencies/CUSD.png +0 -0
- package/web/currencies/CXT.svg +11 -0
- package/web/currencies/D2D.svg +6 -0
- package/web/currencies/DAI.svg +13 -0
- package/web/currencies/DCN.svg +47 -0
- package/web/currencies/DF.svg +15 -0
- package/web/currencies/DHT.svg +1 -0
- package/web/currencies/DIMO.svg +1 -0
- package/web/currencies/DMS.png +0 -0
- package/web/currencies/DODO.svg +6 -0
- package/web/currencies/DOGEGF.png +0 -0
- package/web/currencies/DOLA.svg +1 -0
- package/web/currencies/DOSE.svg +1 -0
- package/web/currencies/DUCK.png +0 -0
- package/web/currencies/DYP.png +0 -0
- package/web/currencies/EIGEN.svg +13 -0
- package/web/currencies/ENS.png +0 -0
- package/web/currencies/EPOCH.svg +1 -0
- package/web/currencies/EQB.svg +4 -0
- package/web/currencies/EQZ.png +0 -0
- package/web/currencies/ERN.png +0 -0
- package/web/currencies/ERNTST.png +0 -0
- package/web/currencies/EST.png +0 -0
- package/web/currencies/ETH.svg +13 -0
- package/web/currencies/ETHIX.svg +1 -0
- package/web/currencies/EVERY.svg +13 -0
- package/web/currencies/F.svg +1 -0
- package/web/currencies/FACTR.png +0 -0
- package/web/currencies/FANS.svg +11 -0
- package/web/currencies/FARM.png +0 -0
- package/web/currencies/FCR.png +0 -0
- package/web/currencies/FET.svg +21 -0
- package/web/currencies/FIS.svg +22 -0
- package/web/currencies/FLASH.svg +22 -0
- package/web/currencies/FLy.png +0 -0
- package/web/currencies/FOAM.svg +23 -0
- package/web/currencies/FORTH.svg +1 -0
- package/web/currencies/FOX.svg +8 -0
- package/web/currencies/FRAX.png +0 -0
- package/web/currencies/FU.svg +17 -0
- package/web/currencies/FVT.svg +1 -0
- package/web/currencies/FXN.svg +25 -0
- package/web/currencies/FXS.png +0 -0
- package/web/currencies/Froglic.png +0 -0
- package/web/currencies/GALAXIS.svg +1 -0
- package/web/currencies/GCH.png +0 -0
- package/web/currencies/GENOME.svg +23 -0
- package/web/currencies/GGTK.svg +1 -0
- package/web/currencies/GHST.svg +15 -0
- package/web/currencies/GIGACHAD.png +0 -0
- package/web/currencies/GIV.svg +6 -0
- package/web/currencies/GLS.svg +22 -0
- package/web/currencies/GOLD.png +0 -0
- package/web/currencies/GRG.png +0 -0
- package/web/currencies/GROW.svg +1 -0
- package/web/currencies/GRT.svg +11 -0
- package/web/currencies/GTC.svg +5 -0
- package/web/currencies/GURU.svg +1 -0
- package/web/currencies/GYEN.svg +1 -0
- package/web/currencies/GYSR.png +0 -0
- package/web/currencies/HAIR.svg +1 -0
- package/web/currencies/HAN.svg +25 -0
- package/web/currencies/HANeP.svg +1 -0
- package/web/currencies/HAUS.png +0 -0
- package/web/currencies/HEU.svg +5 -0
- package/web/currencies/HOBA.png +0 -0
- package/web/currencies/HUNT.svg +1 -0
- package/web/currencies/IBEX.png +0 -0
- package/web/currencies/IDRISS.svg +4 -0
- package/web/currencies/IOTX.png +0 -0
- package/web/currencies/IPOR.svg +1 -0
- package/web/currencies/IPT.svg +7 -0
- package/web/currencies/IRARA.svg +1 -0
- package/web/currencies/ISK.png +0 -0
- package/web/currencies/IYKYK.svg +14 -0
- package/web/currencies/JAM.svg +20 -0
- package/web/currencies/JRT.svg +8 -0
- package/web/currencies/KAGE.png +0 -0
- package/web/currencies/KAI.svg +23 -0
- package/web/currencies/KIBSHI.png +0 -0
- package/web/currencies/KNC.png +0 -0
- package/web/currencies/KOMPETE.png +0 -0
- package/web/currencies/KROM.png +0 -0
- package/web/currencies/LCX.svg +6 -0
- package/web/currencies/LDO.svg +5 -0
- package/web/currencies/LIF3.svg +27 -0
- package/web/currencies/LINK.png +0 -0
- package/web/currencies/LIZ.png +0 -0
- package/web/currencies/LMEOW.png +0 -0
- package/web/currencies/LOCG.png +0 -0
- package/web/currencies/LORDS.png +0 -0
- package/web/currencies/LPF.svg +18 -0
- package/web/currencies/LQTY.svg +1 -0
- package/web/currencies/LRC.png +0 -0
- package/web/currencies/LRDS.svg +44 -0
- package/web/currencies/LSK.png +0 -0
- package/web/currencies/LUSD.svg +1 -0
- package/web/currencies/LYRA.png +0 -0
- package/web/currencies/MASK.svg +4 -0
- package/web/currencies/MASQ.png +0 -0
- package/web/currencies/MBS.png +0 -0
- package/web/currencies/MCADE.svg +26 -0
- package/web/currencies/MET.svg +15 -0
- package/web/currencies/MINDS.svg +32 -0
- package/web/currencies/MKR.png +0 -0
- package/web/currencies/MLN.svg +1 -0
- package/web/currencies/MOCHI.svg +1 -0
- package/web/currencies/MOM.svg +5 -0
- package/web/currencies/MONKE.png +0 -0
- package/web/currencies/MOOV.svg +5 -0
- package/web/currencies/MORPHO.svg +14 -0
- package/web/currencies/MPWR.svg +5 -0
- package/web/currencies/MTA.svg +15 -0
- package/web/currencies/MTL.png +0 -0
- package/web/currencies/MUGLOO.png +0 -0
- package/web/currencies/Mog.png +0 -0
- package/web/currencies/NAVI.svg +1 -0
- package/web/currencies/NCT.svg +49 -0
- package/web/currencies/NET.svg +11 -0
- package/web/currencies/NEURON.svg +38 -0
- package/web/currencies/NFD.png +0 -0
- package/web/currencies/NOGS.png +0 -0
- package/web/currencies/NOUNS.png +0 -0
- package/web/currencies/NOVA.png +0 -0
- package/web/currencies/NSTR.svg +4 -0
- package/web/currencies/Neiro.png +0 -0
- package/web/currencies/OCEAN.png +0 -0
- package/web/currencies/OGN.svg +8 -0
- package/web/currencies/OL.svg +21 -0
- package/web/currencies/OLAS.svg +7 -0
- package/web/currencies/OM.png +0 -0
- package/web/currencies/OMETA.svg +7 -0
- package/web/currencies/OMI.svg +42 -0
- package/web/currencies/OPENLOOT.svg +21 -0
- package/web/currencies/OPN.svg +1 -0
- package/web/currencies/OS.svg +1 -0
- package/web/currencies/OUTb.svg +4 -0
- package/web/currencies/OVR.png +0 -0
- package/web/currencies/PAGE.svg +1 -0
- package/web/currencies/PAL.svg +1 -0
- package/web/currencies/PAPER.svg +4 -0
- package/web/currencies/PENDLE.png +0 -0
- package/web/currencies/PEPE.png +0 -0
- package/web/currencies/PERP.png +0 -0
- package/web/currencies/PHTK.svg +14 -0
- package/web/currencies/PIP.svg +11 -0
- package/web/currencies/POGS.png +0 -0
- package/web/currencies/POOL.svg +22 -0
- package/web/currencies/POP.svg +8 -0
- package/web/currencies/PORK.png +0 -0
- package/web/currencies/PRE.svg +66 -0
- package/web/currencies/PREMIA.svg +4 -0
- package/web/currencies/PRF.png +0 -0
- package/web/currencies/PRO.svg +1 -0
- package/web/currencies/PSP.svg +35 -0
- package/web/currencies/PSTAKE.png +0 -0
- package/web/currencies/PSY.svg +26 -0
- package/web/currencies/RAC.png +0 -0
- package/web/currencies/RAI.svg +1 -0
- package/web/currencies/RAZOR.svg +1 -0
- package/web/currencies/REKT.png +0 -0
- package/web/currencies/RFKJ.png +0 -0
- package/web/currencies/RFWSTETH.svg +36 -0
- package/web/currencies/RGT.png +0 -0
- package/web/currencies/RICE.svg +22 -0
- package/web/currencies/RIZE.svg +21 -0
- package/web/currencies/RPL.svg +1 -0
- package/web/currencies/RSC.svg +6 -0
- package/web/currencies/RSR.png +0 -0
- package/web/currencies/RSS3.png +0 -0
- package/web/currencies/Reach.svg +17 -0
- package/web/currencies/SAIL.png +0 -0
- package/web/currencies/SALD.png +0 -0
- package/web/currencies/SARCO.png +0 -0
- package/web/currencies/SCM.svg +1 -0
- package/web/currencies/SCRY.svg +13 -0
- package/web/currencies/SDL.svg +1 -0
- package/web/currencies/SEAM.svg +5 -0
- package/web/currencies/SEXY.svg +1 -0
- package/web/currencies/SHU.png +0 -0
- package/web/currencies/SIPHER.png +0 -0
- package/web/currencies/SKAI.svg +1 -0
- package/web/currencies/SLN.png +0 -0
- package/web/currencies/SMT.svg +1 -0
- package/web/currencies/SMURFCAT.png +0 -0
- package/web/currencies/SNT.svg +14 -0
- package/web/currencies/SNX.svg +20 -0
- package/web/currencies/SOFI.png +0 -0
- package/web/currencies/SOFT.svg +1 -0
- package/web/currencies/SOVRN.svg +13 -0
- package/web/currencies/SPANK.png +0 -0
- package/web/currencies/SPC.png +0 -0
- package/web/currencies/SPOT.svg +1 -0
- package/web/currencies/SQD.png +0 -0
- package/web/currencies/SQT.svg +14 -0
- package/web/currencies/STNT.svg +38 -0
- package/web/currencies/STPT.png +0 -0
- package/web/currencies/SUDO.svg +6 -0
- package/web/currencies/SUKU.png +0 -0
- package/web/currencies/SUPER.svg +6 -0
- package/web/currencies/SUSHI.svg +19 -0
- package/web/currencies/SYNTH.svg +1 -0
- package/web/currencies/ShibDoge.png +0 -0
- package/web/currencies/Silo.svg +4 -0
- package/web/currencies/StaFi.svg +65 -0
- package/web/currencies/T.svg +4 -0
- package/web/currencies/TEN.svg +1 -0
- package/web/currencies/TETU.svg +6 -0
- package/web/currencies/THALES.png +0 -0
- package/web/currencies/THING.png +0 -0
- package/web/currencies/THX.svg +22 -0
- package/web/currencies/TKAI.svg +1 -0
- package/web/currencies/TKN.png +0 -0
- package/web/currencies/TODL.png +0 -0
- package/web/currencies/TOWER.svg +1 -0
- package/web/currencies/TRAC.png +0 -0
- package/web/currencies/TRB.png +0 -0
- package/web/currencies/TRUE.svg +11 -0
- package/web/currencies/TRX.svg +4 -0
- package/web/currencies/TSC.png +0 -0
- package/web/currencies/TT.png +0 -0
- package/web/currencies/TUSD.png +0 -0
- package/web/currencies/TYBENG.png +0 -0
- package/web/currencies/TheDAO.svg +1 -0
- package/web/currencies/U.png +0 -0
- package/web/currencies/UBI.svg +5 -0
- package/web/currencies/UCASH.svg +1 -0
- package/web/currencies/UDT.svg +4 -0
- package/web/currencies/UMA.png +0 -0
- package/web/currencies/UNI.png +0 -0
- package/web/currencies/USA.png +0 -0
- package/web/currencies/USC.svg +23 -0
- package/web/currencies/USD3.svg +13 -0
- package/web/currencies/USDD.png +0 -0
- package/web/currencies/USDS.png +0 -0
- package/web/currencies/USDbC.png +0 -0
- package/web/currencies/UST.png +0 -0
- package/web/currencies/VALX.png +0 -0
- package/web/currencies/VIDYA.png +0 -0
- package/web/currencies/VITA.svg +10 -0
- package/web/currencies/VSP.svg +15 -0
- package/web/currencies/VUSD.svg +1 -0
- package/web/currencies/WAAC.png +0 -0
- package/web/currencies/WAD.png +0 -0
- package/web/currencies/WALLET.svg +1 -0
- package/web/currencies/WAMPL.svg +53 -0
- package/web/currencies/WBTC.png +0 -0
- package/web/currencies/WCT.svg +5 -0
- package/web/currencies/WEXO.png +0 -0
- package/web/currencies/WLD.jpeg +0 -0
- package/web/currencies/WMC.png +0 -0
- package/web/currencies/WOO.png +0 -0
- package/web/currencies/Wildfire.svg +1 -0
- package/web/currencies/XCHF.png +0 -0
- package/web/currencies/XCN.svg +1 -0
- package/web/currencies/XMT.svg +1 -0
- package/web/currencies/XYO.svg +1 -0
- package/web/currencies/YFI.svg +4 -0
- package/web/currencies/YFX.svg +11 -0
- package/web/currencies/YGG.svg +11 -0
- package/web/currencies/YOKAI.png +0 -0
- package/web/currencies/YYY.svg +1 -0
- package/web/currencies/ZENT.svg +12 -0
- package/web/currencies/ZRX.png +0 -0
- package/web/currencies/ZUN.svg +24 -0
- package/web/currencies/ZUSD.svg +1 -0
- package/web/currencies/ZYN.png +0 -0
- package/web/currencies/aCRV.png +0 -0
- package/web/currencies/btc.png +0 -0
- package/web/currencies/bwAJNA.svg +1 -0
- package/web/currencies/cSTONE.svg +23 -0
- package/web/currencies/cbETH.svg +9 -0
- package/web/currencies/crvUSD.png +0 -0
- package/web/currencies/cvxFXS.png +0 -0
- package/web/currencies/dai.png +0 -0
- package/web/currencies/dollar.png +0 -0
- package/web/currencies/ePendle.png +0 -0
- package/web/currencies/frxETH.png +0 -0
- package/web/currencies/fxUSD.svg +5 -0
- package/web/currencies/iFARM.png +0 -0
- package/web/currencies/iZi.png +0 -0
- package/web/currencies/imgnAI.svg +1 -0
- package/web/currencies/mpETH.svg +4 -0
- package/web/currencies/nETH.svg +11 -0
- package/web/currencies/rETH.svg +1 -0
- package/web/currencies/rgUSD.svg +5 -0
- package/web/currencies/rnETH.svg +11 -0
- package/web/currencies/sDAI.svg +13 -0
- package/web/currencies/sFRAX.png +0 -0
- package/web/currencies/sUSDS.png +0 -0
- package/web/currencies/scWETHv2.svg +1 -0
- package/web/currencies/send.svg +12 -0
- package/web/currencies/stETH.png +1 -0
- package/web/currencies/stZENT.svg +12 -0
- package/web/currencies/stkLYRA.svg +26 -0
- package/web/currencies/tGS.png +0 -0
- package/web/currencies/tSTAR.png +0 -0
- package/web/currencies/usdc.png +0 -0
- package/web/currencies/usdt.png +0 -0
- package/web/currencies/veKWENTA.svg +24 -0
- package/web/currencies/wHOGE.svg +14 -0
- package/web/currencies/wOpenX.svg +140 -0
- package/web/currencies/wPOKT.svg +17 -0
- package/web/currencies/wTBT.svg +1 -0
- package/web/currencies/weETH.svg +23 -0
- package/web/currencies/wstETH.svg +11 -0
- package/web/currencies/yETH.svg +8 -0
- package/web/currencies/zunETH.svg +46 -0
- package/web/currencies/zunUSD.svg +33 -0
- package/web/fonts/noto-sans-sc-chinese-simplified-500-normal.ttf +0 -0
- package/web/index.html +72 -0
- package/web/methods/arcblock.png +0 -0
- package/web/methods/base.png +0 -0
- package/web/methods/binance.png +0 -0
- package/web/methods/coinbase.png +0 -0
- package/web/methods/default.png +0 -0
- package/web/methods/ethereum.jpg +0 -0
- package/web/methods/ethereum.png +0 -0
- package/web/methods/stripe.png +0 -0
package/dist/index.js
CHANGED
|
@@ -441,9 +441,9 @@ var init_env = __esm({
|
|
|
441
441
|
"../../blocklets/core/api/src/libs/env.ts"() {
|
|
442
442
|
"use strict";
|
|
443
443
|
import_env = require("@blocklet/sdk/lib/env");
|
|
444
|
-
numConfig = (key,
|
|
444
|
+
numConfig = (key, fallback) => {
|
|
445
445
|
const v = readConfig(key);
|
|
446
|
-
return v ? +v :
|
|
446
|
+
return v ? +v : fallback;
|
|
447
447
|
};
|
|
448
448
|
paymentStatCronTime = () => "0 1 0 * * *";
|
|
449
449
|
subscriptionCronTime = () => readConfig("SUBSCRIPTION_CRON_TIME") || "0 */30 * * * *";
|
|
@@ -787,6 +787,13 @@ var init_sql_migrations = __esm({
|
|
|
787
787
|
});
|
|
788
788
|
|
|
789
789
|
// ../../blocklets/core/api/src/libs/drivers/identity.ts
|
|
790
|
+
var identity_exports = {};
|
|
791
|
+
__export(identity_exports, {
|
|
792
|
+
createDefaultIdentityDriver: () => createDefaultIdentityDriver,
|
|
793
|
+
getIdentityDriver: () => getIdentityDriver,
|
|
794
|
+
resolveTenantForHost: () => resolveTenantForHost,
|
|
795
|
+
setIdentityDriver: () => setIdentityDriver
|
|
796
|
+
});
|
|
790
797
|
function createDefaultIdentityDriver() {
|
|
791
798
|
return {
|
|
792
799
|
resolveInstanceDidForHost() {
|
|
@@ -979,37 +986,64 @@ var init_drivers = __esm({
|
|
|
979
986
|
}
|
|
980
987
|
});
|
|
981
988
|
|
|
982
|
-
// ../../blocklets/core/api/src/
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
989
|
+
// ../../blocklets/core/api/src/host-node/serve-static-arc.ts
|
|
990
|
+
var serve_static_arc_exports = {};
|
|
991
|
+
__export(serve_static_arc_exports, {
|
|
992
|
+
createNodeStaticHandler: () => createNodeStaticHandler,
|
|
993
|
+
default: () => serve_static_arc_default
|
|
994
|
+
});
|
|
995
|
+
function acceptsHtml(accept) {
|
|
996
|
+
if (!accept) return true;
|
|
997
|
+
return accept.includes("text/html") || accept.includes("application/xhtml+xml") || accept.includes("*/*");
|
|
998
|
+
}
|
|
999
|
+
function createNodeStaticHandler(webRoot) {
|
|
1000
|
+
const indexPath = import_path.default.join(webRoot, "index.html");
|
|
1001
|
+
if (!import_fs.default.existsSync(indexPath)) {
|
|
1002
|
+
throw new Error(`createNodeStaticHandler: webRoot has no index.html: ${indexPath}`);
|
|
995
1003
|
}
|
|
996
|
-
|
|
1004
|
+
let cachedIndex = null;
|
|
1005
|
+
return (app42) => {
|
|
1006
|
+
const { serveStatic } = require("@hono/node-server/serve-static");
|
|
1007
|
+
app42.use("*", async (c, next) => {
|
|
1008
|
+
const method = c.req.method.toUpperCase();
|
|
1009
|
+
if (method !== "GET" && method !== "HEAD" || !acceptsHtml(c.req.header("accept") || "") || import_constant.RESOURCE_PATTERN.test(c.req.path)) {
|
|
1010
|
+
return next();
|
|
1011
|
+
}
|
|
1012
|
+
if (cachedIndex == null) cachedIndex = import_fs.default.readFileSync(indexPath, "utf8");
|
|
1013
|
+
return c.html(cachedIndex);
|
|
1014
|
+
});
|
|
1015
|
+
app42.use("*", serveStatic({ root: webRoot }));
|
|
1016
|
+
};
|
|
997
1017
|
}
|
|
998
|
-
var
|
|
999
|
-
var
|
|
1000
|
-
"../../blocklets/core/api/src/
|
|
1018
|
+
var import_fs, import_path, import_constant, serve_static_arc_default;
|
|
1019
|
+
var init_serve_static_arc = __esm({
|
|
1020
|
+
"../../blocklets/core/api/src/host-node/serve-static-arc.ts"() {
|
|
1001
1021
|
"use strict";
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
warn: (...args) => resolveLogger().warn(...args)
|
|
1007
|
-
};
|
|
1008
|
-
logger_default = logger;
|
|
1022
|
+
import_fs = __toESM(require("fs"));
|
|
1023
|
+
import_path = __toESM(require("path"));
|
|
1024
|
+
import_constant = require("@blocklet/constant");
|
|
1025
|
+
serve_static_arc_default = createNodeStaticHandler;
|
|
1009
1026
|
}
|
|
1010
1027
|
});
|
|
1011
1028
|
|
|
1012
1029
|
// ../../blocklets/core/api/src/libs/context.ts
|
|
1030
|
+
var context_exports = {};
|
|
1031
|
+
__export(context_exports, {
|
|
1032
|
+
INVALID_TENANT_TABLE: () => INVALID_TENANT_TABLE,
|
|
1033
|
+
TENANT_CONTEXT_MISSING: () => TENANT_CONTEXT_MISSING,
|
|
1034
|
+
TENANT_HOST_UNRESOLVED: () => TENANT_HOST_UNRESOLVED,
|
|
1035
|
+
TENANT_MISMATCH: () => TENANT_MISMATCH,
|
|
1036
|
+
TenantError: () => TenantError,
|
|
1037
|
+
assertValidInstanceDid: () => assertValidInstanceDid,
|
|
1038
|
+
context: () => context,
|
|
1039
|
+
getDefaultInstanceDid: () => getDefaultInstanceDid,
|
|
1040
|
+
getInstanceDid: () => getInstanceDid,
|
|
1041
|
+
getTenantMode: () => getTenantMode,
|
|
1042
|
+
isSystemContext: () => isSystemContext,
|
|
1043
|
+
resolveRowTenant: () => resolveRowTenant,
|
|
1044
|
+
setDefaultInstanceDid: () => setDefaultInstanceDid,
|
|
1045
|
+
withTenant: () => withTenant
|
|
1046
|
+
});
|
|
1013
1047
|
function withTenant(instanceDid, fn3) {
|
|
1014
1048
|
return context.withTenant(instanceDid, fn3);
|
|
1015
1049
|
}
|
|
@@ -1069,6 +1103,16 @@ var init_context = __esm({
|
|
|
1069
1103
|
if (getTenantMode() === "single") return getDefaultInstanceDid();
|
|
1070
1104
|
throw new TenantError(TENANT_CONTEXT_MISSING, "tenant context is missing in multi-tenant mode");
|
|
1071
1105
|
}
|
|
1106
|
+
/**
|
|
1107
|
+
* Non-throwing peek at the established tenant context — returns the stored
|
|
1108
|
+
* instanceDid or undefined when no context is set (regardless of tenant mode).
|
|
1109
|
+
* Used by the DID-Connect tenant-context middleware to decide whether the
|
|
1110
|
+
* request is already scoped (e.g. the CF worker wrapped /api/* in withTenant) or
|
|
1111
|
+
* needs its own Host→tenant resolution.
|
|
1112
|
+
*/
|
|
1113
|
+
peekInstanceDid() {
|
|
1114
|
+
return this.storage.getStore()?.instanceDid;
|
|
1115
|
+
}
|
|
1072
1116
|
/**
|
|
1073
1117
|
* Run fn as a system operation: TenantModel scoping is bypassed for the span
|
|
1074
1118
|
* of fn so legitimate cross-tenant reads can load rows regardless of tenant.
|
|
@@ -1110,6 +1154,231 @@ var init_context = __esm({
|
|
|
1110
1154
|
}
|
|
1111
1155
|
});
|
|
1112
1156
|
|
|
1157
|
+
// ../../blocklets/core/api/src/libs/logger.ts
|
|
1158
|
+
function resolveLogger() {
|
|
1159
|
+
if (resolved) return resolved;
|
|
1160
|
+
try {
|
|
1161
|
+
const createLogger = require("@blocklet/logger");
|
|
1162
|
+
resolved = createLogger("app");
|
|
1163
|
+
} catch {
|
|
1164
|
+
resolved = {
|
|
1165
|
+
debug: (...args) => console.debug(...args),
|
|
1166
|
+
info: (...args) => console.info(...args),
|
|
1167
|
+
error: (...args) => console.error(...args),
|
|
1168
|
+
warn: (...args) => console.warn(...args)
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1171
|
+
return resolved;
|
|
1172
|
+
}
|
|
1173
|
+
var resolved, logger, logger_default;
|
|
1174
|
+
var init_logger = __esm({
|
|
1175
|
+
"../../blocklets/core/api/src/libs/logger.ts"() {
|
|
1176
|
+
"use strict";
|
|
1177
|
+
logger = {
|
|
1178
|
+
debug: (...args) => resolveLogger().debug(...args),
|
|
1179
|
+
info: (...args) => resolveLogger().info(...args),
|
|
1180
|
+
error: (...args) => resolveLogger().error(...args),
|
|
1181
|
+
warn: (...args) => resolveLogger().warn(...args)
|
|
1182
|
+
};
|
|
1183
|
+
logger_default = logger;
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
|
|
1187
|
+
// ../../blocklets/core/api/src/libs/did-connect/tenant-identity.ts
|
|
1188
|
+
var tenant_identity_exports = {};
|
|
1189
|
+
__export(tenant_identity_exports, {
|
|
1190
|
+
clearTenantIdentityCache: () => clearTenantIdentityCache,
|
|
1191
|
+
createEmbeddedIdentityServices: () => createEmbeddedIdentityServices,
|
|
1192
|
+
getCachedTenantIdentity: () => getCachedTenantIdentity,
|
|
1193
|
+
hasDynamicIdentity: () => hasDynamicIdentity,
|
|
1194
|
+
resolveTenantIdentity: () => resolveTenantIdentity,
|
|
1195
|
+
warmTenantIdentity: () => warmTenantIdentity
|
|
1196
|
+
});
|
|
1197
|
+
function cacheIdentity(instanceDid, value) {
|
|
1198
|
+
identityCache.set(instanceDid, { value, expiry: Date.now() + IDENTITY_TTL_MS });
|
|
1199
|
+
if (identityCache.size > IDENTITY_CACHE_MAX) {
|
|
1200
|
+
const oldest = identityCache.keys().next().value;
|
|
1201
|
+
if (oldest !== void 0) identityCache.delete(oldest);
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
function clearTenantIdentityCache(instanceDid) {
|
|
1205
|
+
if (instanceDid) identityCache.delete(instanceDid);
|
|
1206
|
+
else identityCache.clear();
|
|
1207
|
+
}
|
|
1208
|
+
function hasDynamicIdentity() {
|
|
1209
|
+
return typeof getIdentityDriver().getInstanceAppIdentity === "function";
|
|
1210
|
+
}
|
|
1211
|
+
async function resolveTenantIdentity(instanceDidArg) {
|
|
1212
|
+
const instanceDid = instanceDidArg ?? getInstanceDid();
|
|
1213
|
+
const cached = identityCache.get(instanceDid);
|
|
1214
|
+
if (cached && cached.expiry > Date.now()) return cached.value;
|
|
1215
|
+
const driver = getIdentityDriver();
|
|
1216
|
+
if (typeof driver.getInstanceAppIdentity !== "function") {
|
|
1217
|
+
throw new Error(
|
|
1218
|
+
"resolveTenantIdentity: the active IdentityDriver does not implement getInstanceAppIdentity \u2014 a non-blocklet-server DID-Connect runtime requires an AUTH_SERVICE-backed identity driver"
|
|
1219
|
+
);
|
|
1220
|
+
}
|
|
1221
|
+
const identity = await driver.getInstanceAppIdentity(instanceDid);
|
|
1222
|
+
if (!identity || !identity.appSk) {
|
|
1223
|
+
throw new Error(`resolveTenantIdentity: no app signing key for instance "${instanceDid}" (fail-closed)`);
|
|
1224
|
+
}
|
|
1225
|
+
if (identity.appSk.length < 66) {
|
|
1226
|
+
throw new Error(
|
|
1227
|
+
`resolveTenantIdentity: appSk for instance "${instanceDid}" is too short (${identity.appSk.length} chars) to derive a wallet (fail-closed)`
|
|
1228
|
+
);
|
|
1229
|
+
}
|
|
1230
|
+
const wallet2 = (0, import_wallet.fromSecretKey)(identity.appSk, walletType);
|
|
1231
|
+
const ethWallet2 = (0, import_wallet.fromSecretKey)(identity.appSk.slice(0, 66), ethWalletType);
|
|
1232
|
+
const permanentWallet = identity.appPsk ? (0, import_wallet.fromSecretKey)(identity.appPsk, walletType) : wallet2;
|
|
1233
|
+
const value = {
|
|
1234
|
+
instanceDid,
|
|
1235
|
+
wallet: wallet2,
|
|
1236
|
+
ethWallet: ethWallet2,
|
|
1237
|
+
permanentWallet,
|
|
1238
|
+
appInfo: identity.appInfo ?? {}
|
|
1239
|
+
};
|
|
1240
|
+
cacheIdentity(instanceDid, value);
|
|
1241
|
+
return value;
|
|
1242
|
+
}
|
|
1243
|
+
function getCachedTenantIdentity(instanceDidArg) {
|
|
1244
|
+
const instanceDid = instanceDidArg ?? getInstanceDid();
|
|
1245
|
+
const cached = identityCache.get(instanceDid);
|
|
1246
|
+
if (!cached || cached.expiry <= Date.now()) {
|
|
1247
|
+
throw new Error(
|
|
1248
|
+
`tenant identity for "${instanceDid}" is not resolved (fail-closed) \u2014 warmTenantIdentity must run in the request/job scope before any wallet access`
|
|
1249
|
+
);
|
|
1250
|
+
}
|
|
1251
|
+
return cached.value;
|
|
1252
|
+
}
|
|
1253
|
+
async function warmTenantIdentity(instanceDidArg) {
|
|
1254
|
+
if (!hasDynamicIdentity()) return;
|
|
1255
|
+
try {
|
|
1256
|
+
await resolveTenantIdentity(instanceDidArg);
|
|
1257
|
+
} catch (err) {
|
|
1258
|
+
logger_default.warn("[tenant-identity] warm failed \u2014 wallet access will fail-closed", {
|
|
1259
|
+
error: err instanceof Error ? err.message : String(err)
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
function createEmbeddedIdentityServices() {
|
|
1264
|
+
return {
|
|
1265
|
+
getBusinessWallet(chain) {
|
|
1266
|
+
const identity = getCachedTenantIdentity();
|
|
1267
|
+
return chain === "ethereum" ? identity.ethWallet : identity.wallet;
|
|
1268
|
+
},
|
|
1269
|
+
directory() {
|
|
1270
|
+
return EMBEDDED_DIRECTORY;
|
|
1271
|
+
}
|
|
1272
|
+
};
|
|
1273
|
+
}
|
|
1274
|
+
var Mcrypto, import_wallet, walletType, ethWalletType, IDENTITY_TTL_MS, IDENTITY_CACHE_MAX, identityCache, EMBEDDED_DIRECTORY;
|
|
1275
|
+
var init_tenant_identity = __esm({
|
|
1276
|
+
"../../blocklets/core/api/src/libs/did-connect/tenant-identity.ts"() {
|
|
1277
|
+
"use strict";
|
|
1278
|
+
Mcrypto = __toESM(require("@ocap/mcrypto"));
|
|
1279
|
+
import_wallet = require("@ocap/wallet");
|
|
1280
|
+
init_context();
|
|
1281
|
+
init_drivers();
|
|
1282
|
+
init_logger();
|
|
1283
|
+
walletType = {
|
|
1284
|
+
role: Mcrypto.types.RoleType.ROLE_APPLICATION,
|
|
1285
|
+
pk: Mcrypto.types.KeyType.ED25519,
|
|
1286
|
+
hash: Mcrypto.types.HashType.SHA3
|
|
1287
|
+
};
|
|
1288
|
+
ethWalletType = (0, import_wallet.WalletType)("ethereum");
|
|
1289
|
+
IDENTITY_TTL_MS = 5 * 60 * 1e3;
|
|
1290
|
+
IDENTITY_CACHE_MAX = 512;
|
|
1291
|
+
identityCache = /* @__PURE__ */ new Map();
|
|
1292
|
+
EMBEDDED_DIRECTORY = {
|
|
1293
|
+
getUser(did) {
|
|
1294
|
+
if (!did) return { user: null };
|
|
1295
|
+
return {
|
|
1296
|
+
user: { did, fullName: did, email: "", phone: "", remark: "", connectedAccounts: [{ provider: "wallet", did }] }
|
|
1297
|
+
};
|
|
1298
|
+
},
|
|
1299
|
+
getUsers() {
|
|
1300
|
+
return { users: [] };
|
|
1301
|
+
},
|
|
1302
|
+
getVault() {
|
|
1303
|
+
return null;
|
|
1304
|
+
},
|
|
1305
|
+
getBlocklet() {
|
|
1306
|
+
return { id: "", site: { id: "" } };
|
|
1307
|
+
}
|
|
1308
|
+
};
|
|
1309
|
+
}
|
|
1310
|
+
});
|
|
1311
|
+
|
|
1312
|
+
// ../../blocklets/core/api/src/libs/did-connect/runtime-did-connect-js.ts
|
|
1313
|
+
function createDidConnectJsRuntime(opts) {
|
|
1314
|
+
const fallbackAppInfo = { ...DEFAULT_APP_INFO, ...opts.defaultAppInfo ?? {} };
|
|
1315
|
+
return {
|
|
1316
|
+
tokenStorage: opts.tokenStorage,
|
|
1317
|
+
createAuthenticator() {
|
|
1318
|
+
const { WalletAuthenticator } = require("@arcblock/did-connect-js");
|
|
1319
|
+
const config4 = {
|
|
1320
|
+
// Function-valued, per-tenant: resolve the signing wallet from the host
|
|
1321
|
+
// IdentityDriver.getInstanceAppIdentity each time the authenticator signs.
|
|
1322
|
+
// `.toJSON()` matches the standalone worker (the SDK reconstructs the full
|
|
1323
|
+
// wallet — incl. sk — via fromJSON before signing).
|
|
1324
|
+
wallet: async () => {
|
|
1325
|
+
const { wallet: wallet2 } = await resolveTenantIdentity();
|
|
1326
|
+
return wallet2.toJSON();
|
|
1327
|
+
},
|
|
1328
|
+
appInfo: async ({ baseUrl } = {}) => {
|
|
1329
|
+
const { appInfo } = await resolveTenantIdentity();
|
|
1330
|
+
return {
|
|
1331
|
+
name: appInfo.name || fallbackAppInfo.name,
|
|
1332
|
+
description: appInfo.description || fallbackAppInfo.description,
|
|
1333
|
+
icon: appInfo.icon || fallbackAppInfo.icon,
|
|
1334
|
+
link: appInfo.link || baseUrl
|
|
1335
|
+
};
|
|
1336
|
+
},
|
|
1337
|
+
timeout: opts.timeout ?? 3e4
|
|
1338
|
+
};
|
|
1339
|
+
if (opts.chainInfo) config4.chainInfo = opts.chainInfo;
|
|
1340
|
+
if (opts.txEncoder) config4.txEncoder = opts.txEncoder;
|
|
1341
|
+
return new WalletAuthenticator(config4);
|
|
1342
|
+
},
|
|
1343
|
+
createHandlers({ authenticator: authenticator2, tokenStorage }) {
|
|
1344
|
+
const { WalletHandlers } = require("@arcblock/did-connect-js");
|
|
1345
|
+
return new WalletHandlers({ authenticator: authenticator2, tokenStorage });
|
|
1346
|
+
}
|
|
1347
|
+
};
|
|
1348
|
+
}
|
|
1349
|
+
var DEFAULT_APP_INFO;
|
|
1350
|
+
var init_runtime_did_connect_js = __esm({
|
|
1351
|
+
"../../blocklets/core/api/src/libs/did-connect/runtime-did-connect-js.ts"() {
|
|
1352
|
+
"use strict";
|
|
1353
|
+
init_tenant_identity();
|
|
1354
|
+
DEFAULT_APP_INFO = {
|
|
1355
|
+
name: "Payment Kit",
|
|
1356
|
+
description: "Payment Kit",
|
|
1357
|
+
icon: "https://www.arcblock.io/favicon.ico"
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
|
|
1362
|
+
// ../../blocklets/core/api/src/host-node/did-connect-runtime-node.ts
|
|
1363
|
+
var did_connect_runtime_node_exports = {};
|
|
1364
|
+
__export(did_connect_runtime_node_exports, {
|
|
1365
|
+
createNodeDidConnectRuntime: () => createNodeDidConnectRuntime
|
|
1366
|
+
});
|
|
1367
|
+
function createNodeDidConnectRuntime(opts) {
|
|
1368
|
+
const { createTxEncoder } = require("@ocap/client/encode");
|
|
1369
|
+
return createDidConnectJsRuntime({
|
|
1370
|
+
tokenStorage: opts?.tokenStorage,
|
|
1371
|
+
txEncoder: createTxEncoder(),
|
|
1372
|
+
timeout: opts?.timeout ?? 3e4
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
var init_did_connect_runtime_node = __esm({
|
|
1376
|
+
"../../blocklets/core/api/src/host-node/did-connect-runtime-node.ts"() {
|
|
1377
|
+
"use strict";
|
|
1378
|
+
init_runtime_did_connect_js();
|
|
1379
|
+
}
|
|
1380
|
+
});
|
|
1381
|
+
|
|
1113
1382
|
// ../../blocklets/core/api/src/middlewares/hono/xss.ts
|
|
1114
1383
|
function xss() {
|
|
1115
1384
|
return async (c, next) => {
|
|
@@ -1329,9 +1598,12 @@ var auth_exports = {};
|
|
|
1329
1598
|
__export(auth_exports, {
|
|
1330
1599
|
authenticator: () => authenticator,
|
|
1331
1600
|
blocklet: () => blocklet,
|
|
1601
|
+
createBlockletServerDidConnectRuntime: () => createBlockletServerDidConnectRuntime,
|
|
1332
1602
|
ethWallet: () => ethWallet,
|
|
1333
1603
|
getVaultAddress: () => getVaultAddress,
|
|
1334
1604
|
handlers: () => handlers,
|
|
1605
|
+
setDidConnectRuntime: () => setDidConnectRuntime,
|
|
1606
|
+
setDidConnectTokenStorage: () => setDidConnectTokenStorage,
|
|
1335
1607
|
wallet: () => wallet
|
|
1336
1608
|
});
|
|
1337
1609
|
function lazyProxy(factory) {
|
|
@@ -1360,18 +1632,81 @@ function lazyProxy(factory) {
|
|
|
1360
1632
|
function ensureNotificationPatch() {
|
|
1361
1633
|
if (notificationPatched) return;
|
|
1362
1634
|
notificationPatched = true;
|
|
1363
|
-
const { getWallet
|
|
1635
|
+
const { getWallet, getAccessWallet } = require("@blocklet/sdk/lib/wallet");
|
|
1364
1636
|
const notificationExports = require("@blocklet/sdk/service/notification");
|
|
1365
1637
|
notificationExports.getSender = () => ({
|
|
1366
|
-
appDid: blockletAppId() ||
|
|
1638
|
+
appDid: blockletAppId() || getWallet(void 0, "", "sk").address,
|
|
1367
1639
|
wallet: getAccessWallet()
|
|
1368
1640
|
});
|
|
1369
1641
|
logger_default.info("[sdk-patch] notification.getSender overridden", { expectedAppId: blockletAppId() });
|
|
1370
1642
|
}
|
|
1371
1643
|
function makeWallet(...args) {
|
|
1372
1644
|
ensureNotificationPatch();
|
|
1373
|
-
const { getWallet
|
|
1374
|
-
return
|
|
1645
|
+
const { getWallet } = require("@blocklet/sdk/lib/wallet");
|
|
1646
|
+
return getWallet(...args);
|
|
1647
|
+
}
|
|
1648
|
+
function activeBusinessWallet(chain) {
|
|
1649
|
+
const driver = getIdentityDriver();
|
|
1650
|
+
if (typeof driver.getBusinessWallet === "function") {
|
|
1651
|
+
return driver.getBusinessWallet(chain);
|
|
1652
|
+
}
|
|
1653
|
+
return chain === "ethereum" ? envEthWallet : envWallet;
|
|
1654
|
+
}
|
|
1655
|
+
function businessWalletProxy(chain) {
|
|
1656
|
+
return new Proxy({}, {
|
|
1657
|
+
get(_t, prop) {
|
|
1658
|
+
const w = activeBusinessWallet(chain);
|
|
1659
|
+
const value = w[prop];
|
|
1660
|
+
if (typeof value !== "function") return value;
|
|
1661
|
+
if (value._isMockFunction) return value;
|
|
1662
|
+
return value.bind(w);
|
|
1663
|
+
},
|
|
1664
|
+
set(_t, prop, value) {
|
|
1665
|
+
activeBusinessWallet(chain)[prop] = value;
|
|
1666
|
+
return true;
|
|
1667
|
+
},
|
|
1668
|
+
has(_t, prop) {
|
|
1669
|
+
return prop in activeBusinessWallet(chain);
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
}
|
|
1673
|
+
function setDidConnectRuntime(runtime) {
|
|
1674
|
+
injectedRuntime = runtime;
|
|
1675
|
+
}
|
|
1676
|
+
function setDidConnectTokenStorage(storage) {
|
|
1677
|
+
injectedTokenStorage = storage;
|
|
1678
|
+
}
|
|
1679
|
+
function createBlockletServerDidConnectRuntime() {
|
|
1680
|
+
return {
|
|
1681
|
+
createAuthenticator() {
|
|
1682
|
+
const { WalletAuthenticator } = require("@blocklet/sdk/lib/wallet-authenticator");
|
|
1683
|
+
const { createTxEncoder } = require("@ocap/client/encode");
|
|
1684
|
+
return new WalletAuthenticator({ wallet: makeWallet(void 0, "", "sk"), txEncoder: createTxEncoder() });
|
|
1685
|
+
},
|
|
1686
|
+
createHandlers({ authenticator: auth28, tokenStorage }) {
|
|
1687
|
+
const { WalletHandlers } = require("@blocklet/sdk/lib/wallet-handler");
|
|
1688
|
+
return new WalletHandlers({ authenticator: auth28, tokenStorage });
|
|
1689
|
+
}
|
|
1690
|
+
};
|
|
1691
|
+
}
|
|
1692
|
+
function activeRuntime() {
|
|
1693
|
+
return injectedRuntime ?? createBlockletServerDidConnectRuntime();
|
|
1694
|
+
}
|
|
1695
|
+
function buildTokenStorage() {
|
|
1696
|
+
if (injectedRuntime?.tokenStorage) return injectedRuntime.tokenStorage;
|
|
1697
|
+
if (injectedTokenStorage) return injectedTokenStorage;
|
|
1698
|
+
const AuthStorage = require("@arcblock/did-connect-storage-nedb");
|
|
1699
|
+
return new AuthStorage({
|
|
1700
|
+
// `env.dataDir` (the blocklet runtime data dir) is undefined in a bare
|
|
1701
|
+
// embedded host like arc — `store/sequelize.ts` already guards its own
|
|
1702
|
+
// use, but this DID-Connect token store was the one unguarded path and
|
|
1703
|
+
// crashed `buildConnectRoutesHono` with `path.join(undefined, …)`. Fall
|
|
1704
|
+
// back to the OS temp dir (DID-Connect session tokens are ephemeral; the
|
|
1705
|
+
// blocklet server still gets its real dataDir natively).
|
|
1706
|
+
dbPath: import_path2.default.join(env_default.dataDir || import_os.default.tmpdir(), "auth.db"),
|
|
1707
|
+
// @ts-ignore
|
|
1708
|
+
onload: console.warn
|
|
1709
|
+
});
|
|
1375
1710
|
}
|
|
1376
1711
|
async function getVaultAddress() {
|
|
1377
1712
|
try {
|
|
@@ -1385,33 +1720,32 @@ async function getVaultAddress() {
|
|
|
1385
1720
|
return null;
|
|
1386
1721
|
}
|
|
1387
1722
|
}
|
|
1388
|
-
var
|
|
1723
|
+
var import_os, import_path2, notificationPatched, envWallet, envEthWallet, wallet, ethWallet, injectedRuntime, injectedTokenStorage, authenticator, handlers, blocklet;
|
|
1389
1724
|
var init_auth = __esm({
|
|
1390
1725
|
"../../blocklets/core/api/src/libs/auth.ts"() {
|
|
1391
1726
|
"use strict";
|
|
1392
|
-
|
|
1727
|
+
import_os = __toESM(require("os"));
|
|
1728
|
+
import_path2 = __toESM(require("path"));
|
|
1393
1729
|
init_env();
|
|
1730
|
+
init_drivers();
|
|
1394
1731
|
init_logger();
|
|
1395
1732
|
notificationPatched = false;
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1733
|
+
envWallet = lazyProxy(() => makeWallet());
|
|
1734
|
+
envEthWallet = lazyProxy(() => makeWallet("ethereum"));
|
|
1735
|
+
wallet = businessWalletProxy("arcblock");
|
|
1736
|
+
ethWallet = businessWalletProxy("ethereum");
|
|
1737
|
+
injectedRuntime = null;
|
|
1738
|
+
injectedTokenStorage = null;
|
|
1739
|
+
authenticator = lazyProxy(() => activeRuntime().createAuthenticator());
|
|
1402
1740
|
handlers = lazyProxy(() => {
|
|
1403
|
-
const
|
|
1404
|
-
|
|
1405
|
-
return new WalletHandlers({
|
|
1406
|
-
authenticator,
|
|
1407
|
-
tokenStorage: new AuthStorage({
|
|
1408
|
-
dbPath: import_path.default.join(env_default.dataDir, "auth.db"),
|
|
1409
|
-
// @ts-ignore
|
|
1410
|
-
onload: console.warn
|
|
1411
|
-
})
|
|
1412
|
-
});
|
|
1741
|
+
const tokenStorage = buildTokenStorage();
|
|
1742
|
+
return activeRuntime().createHandlers({ authenticator, tokenStorage });
|
|
1413
1743
|
});
|
|
1414
1744
|
blocklet = lazyProxy(() => {
|
|
1745
|
+
const driver = getIdentityDriver();
|
|
1746
|
+
if (typeof driver.directory === "function") {
|
|
1747
|
+
return driver.directory();
|
|
1748
|
+
}
|
|
1415
1749
|
ensureNotificationPatch();
|
|
1416
1750
|
const { BlockletService: BlockletService2 } = require("@blocklet/sdk/service/auth");
|
|
1417
1751
|
return new BlockletService2();
|
|
@@ -6310,7 +6644,7 @@ function authenticate({
|
|
|
6310
6644
|
if (embed && embedToken && embedId) {
|
|
6311
6645
|
let embedOk = false;
|
|
6312
6646
|
try {
|
|
6313
|
-
const w =
|
|
6647
|
+
const w = wallet;
|
|
6314
6648
|
const verified = await w.verify(embedId, embedToken);
|
|
6315
6649
|
if (!verified) {
|
|
6316
6650
|
return c.json({ error: `Invalid signature for embed: ${embedId}` }, 401);
|
|
@@ -6377,19 +6711,15 @@ function authenticate({
|
|
|
6377
6711
|
return c.json({ error: "Not authorized to perform this action" }, 403);
|
|
6378
6712
|
};
|
|
6379
6713
|
}
|
|
6380
|
-
var import_verify_sign, import_verify_session
|
|
6714
|
+
var import_verify_sign, import_verify_session;
|
|
6381
6715
|
var init_security = __esm({
|
|
6382
6716
|
"../../blocklets/core/api/src/middlewares/hono/security.ts"() {
|
|
6383
6717
|
"use strict";
|
|
6384
6718
|
import_verify_sign = require("@blocklet/sdk/lib/util/verify-sign");
|
|
6385
6719
|
import_verify_session = require("@blocklet/sdk/lib/util/verify-session");
|
|
6386
|
-
import_wallet = require("@blocklet/sdk/lib/wallet");
|
|
6387
6720
|
init_env();
|
|
6721
|
+
init_auth();
|
|
6388
6722
|
init_customer();
|
|
6389
|
-
wallet2 = () => {
|
|
6390
|
-
cachedWallet ??= (0, import_wallet.getWallet)();
|
|
6391
|
-
return cachedWallet;
|
|
6392
|
-
};
|
|
6393
6723
|
}
|
|
6394
6724
|
});
|
|
6395
6725
|
|
|
@@ -8814,8 +9144,8 @@ async function getVerifier(bundleId, environment) {
|
|
|
8814
9144
|
const cached = verifierCache.get(key);
|
|
8815
9145
|
if (cached) return cached;
|
|
8816
9146
|
const mod = await import("@apple/app-store-server-library");
|
|
8817
|
-
const
|
|
8818
|
-
const verifier = new mod.SignedDataVerifier(APPLE_ROOT_CERTS, false,
|
|
9147
|
+
const env12 = environment === "production" ? mod.Environment.PRODUCTION : mod.Environment.SANDBOX;
|
|
9148
|
+
const verifier = new mod.SignedDataVerifier(APPLE_ROOT_CERTS, false, env12, bundleId);
|
|
8819
9149
|
verifierCache.set(key, verifier);
|
|
8820
9150
|
return verifier;
|
|
8821
9151
|
}
|
|
@@ -8861,8 +9191,8 @@ async function getApiClient(creds) {
|
|
|
8861
9191
|
const cached = apiClientCache.get(key);
|
|
8862
9192
|
if (cached) return cached;
|
|
8863
9193
|
const mod = await import("@apple/app-store-server-library");
|
|
8864
|
-
const
|
|
8865
|
-
const client = new mod.AppStoreServerAPIClient(creds.privateKeyPem, creds.keyId, creds.issuerId, creds.bundleId,
|
|
9194
|
+
const env12 = creds.environment === "production" ? mod.Environment.PRODUCTION : mod.Environment.SANDBOX;
|
|
9195
|
+
const client = new mod.AppStoreServerAPIClient(creds.privateKeyPem, creds.keyId, creds.issuerId, creds.bundleId, env12);
|
|
8866
9196
|
apiClientCache.set(key, client);
|
|
8867
9197
|
return client;
|
|
8868
9198
|
}
|
|
@@ -9289,12 +9619,17 @@ var init_client2 = __esm({
|
|
|
9289
9619
|
});
|
|
9290
9620
|
|
|
9291
9621
|
// ../../blocklets/core/api/src/store/sequelize.ts
|
|
9622
|
+
var sequelize_exports = {};
|
|
9623
|
+
__export(sequelize_exports, {
|
|
9624
|
+
sequelize: () => sequelize,
|
|
9625
|
+
setDefaultSequelize: () => setDefaultSequelize
|
|
9626
|
+
});
|
|
9292
9627
|
function buildSequelize() {
|
|
9293
9628
|
const seq = new import_sequelize16.Sequelize({
|
|
9294
9629
|
dialect: "sqlite",
|
|
9295
9630
|
logging: sqlLog(),
|
|
9296
9631
|
benchmark: sqlLog() && sqlBenchmark(),
|
|
9297
|
-
storage: (0,
|
|
9632
|
+
storage: (0, import_path3.join)(env_default.dataDir, "payment-kit.db"),
|
|
9298
9633
|
pool: {
|
|
9299
9634
|
min: sequelizeOptionsPoolMin(),
|
|
9300
9635
|
max: sequelizeOptionsPoolMax(),
|
|
@@ -9310,12 +9645,15 @@ function buildSequelize() {
|
|
|
9310
9645
|
pragma("PRAGMA cache_size = -16000");
|
|
9311
9646
|
return seq;
|
|
9312
9647
|
}
|
|
9313
|
-
|
|
9648
|
+
function setDefaultSequelize(seq) {
|
|
9649
|
+
instance = seq;
|
|
9650
|
+
}
|
|
9651
|
+
var import_sqlite3, import_path3, import_cls_hooked, import_sequelize16, namespace, instance, getSequelize, sequelize;
|
|
9314
9652
|
var init_sequelize = __esm({
|
|
9315
9653
|
"../../blocklets/core/api/src/store/sequelize.ts"() {
|
|
9316
9654
|
"use strict";
|
|
9317
9655
|
import_sqlite3 = require("sqlite3");
|
|
9318
|
-
|
|
9656
|
+
import_path3 = require("path");
|
|
9319
9657
|
import_cls_hooked = __toESM(require("cls-hooked"));
|
|
9320
9658
|
import_sequelize16 = require("sequelize");
|
|
9321
9659
|
init_env();
|
|
@@ -14849,9 +15187,9 @@ var init_remote_signer = __esm({
|
|
|
14849
15187
|
"use strict";
|
|
14850
15188
|
import_ethers = require("ethers");
|
|
14851
15189
|
RemoteSigner = class _RemoteSigner extends import_ethers.ethers.AbstractSigner {
|
|
14852
|
-
constructor(
|
|
15190
|
+
constructor(wallet2, provider) {
|
|
14853
15191
|
super(provider);
|
|
14854
|
-
this.wallet =
|
|
15192
|
+
this.wallet = wallet2;
|
|
14855
15193
|
}
|
|
14856
15194
|
/**
|
|
14857
15195
|
* Returns the address of the signer
|
|
@@ -14888,8 +15226,8 @@ var init_remote_signer = __esm({
|
|
|
14888
15226
|
* Signs typed data (EIP-712)
|
|
14889
15227
|
* Optional but useful for signing structured data
|
|
14890
15228
|
*/
|
|
14891
|
-
async signTypedData(domain,
|
|
14892
|
-
const hash = import_ethers.ethers.TypedDataEncoder.hash(domain,
|
|
15229
|
+
async signTypedData(domain, types3, value) {
|
|
15230
|
+
const hash = import_ethers.ethers.TypedDataEncoder.hash(domain, types3, value);
|
|
14893
15231
|
const signature = await this.wallet.signETH(hash, false);
|
|
14894
15232
|
return import_ethers.ethers.hexlify(signature);
|
|
14895
15233
|
}
|
|
@@ -19013,10 +19351,10 @@ var init_discount2 = __esm({
|
|
|
19013
19351
|
});
|
|
19014
19352
|
|
|
19015
19353
|
// ../../blocklets/core/api/src/libs/slippage.ts
|
|
19016
|
-
function normalizeSlippagePercent3(value,
|
|
19354
|
+
function normalizeSlippagePercent3(value, fallback = DEFAULT_SLIPPAGE_PERCENT3) {
|
|
19017
19355
|
const normalized = typeof value === "string" ? Number(value) : Number(value);
|
|
19018
19356
|
if (!Number.isFinite(normalized) || normalized < 0) {
|
|
19019
|
-
return
|
|
19357
|
+
return fallback;
|
|
19020
19358
|
}
|
|
19021
19359
|
return normalized;
|
|
19022
19360
|
}
|
|
@@ -29022,13 +29360,21 @@ function injectJobTenant(job) {
|
|
|
29022
29360
|
}
|
|
29023
29361
|
return { ...job, instance_did: context.getInstanceDid() };
|
|
29024
29362
|
}
|
|
29363
|
+
async function warmThenRun(onJob, job) {
|
|
29364
|
+
const { warmTenantIdentity: warmTenantIdentity2 } = (
|
|
29365
|
+
// eslint-disable-next-line global-require
|
|
29366
|
+
(init_tenant_identity(), __toCommonJS(tenant_identity_exports))
|
|
29367
|
+
);
|
|
29368
|
+
await warmTenantIdentity2();
|
|
29369
|
+
return onJob(job);
|
|
29370
|
+
}
|
|
29025
29371
|
function runJobWithTenant(job, onJob) {
|
|
29026
29372
|
const tenant = job?.instance_did;
|
|
29027
29373
|
if (tenant) {
|
|
29028
|
-
return withTenant(tenant, () => onJob
|
|
29374
|
+
return withTenant(tenant, () => warmThenRun(onJob, job));
|
|
29029
29375
|
}
|
|
29030
29376
|
if (getTenantMode() === "single") {
|
|
29031
|
-
return withTenant(getDefaultInstanceDid(), () => onJob
|
|
29377
|
+
return withTenant(getDefaultInstanceDid(), () => warmThenRun(onJob, job));
|
|
29032
29378
|
}
|
|
29033
29379
|
const err = new TenantError(TENANT_CONTEXT_MISSING, "legacy job without tenant refused in multi mode");
|
|
29034
29380
|
err.nonRetryable = true;
|
|
@@ -39734,6 +40080,7 @@ var init_payment2 = __esm({
|
|
|
39734
40080
|
init_token();
|
|
39735
40081
|
init_audit();
|
|
39736
40082
|
init_auth();
|
|
40083
|
+
init_context();
|
|
39737
40084
|
init_dayjs();
|
|
39738
40085
|
init_error();
|
|
39739
40086
|
init_event2();
|
|
@@ -40677,16 +41024,23 @@ var init_payment2 = __esm({
|
|
|
40677
41024
|
capture_method: "automatic"
|
|
40678
41025
|
}
|
|
40679
41026
|
});
|
|
40680
|
-
|
|
40681
|
-
const
|
|
40682
|
-
|
|
40683
|
-
|
|
40684
|
-
|
|
40685
|
-
|
|
40686
|
-
|
|
40687
|
-
|
|
41027
|
+
for (const x of payments) {
|
|
41028
|
+
const dispatch = async () => {
|
|
41029
|
+
const supportAutoCharge = await PaymentMethod.supportAutoCharge(x.payment_method_id);
|
|
41030
|
+
if (supportAutoCharge === false) {
|
|
41031
|
+
return;
|
|
41032
|
+
}
|
|
41033
|
+
const exist = await paymentQueue.get(x.id);
|
|
41034
|
+
if (!exist) {
|
|
41035
|
+
paymentQueue.push({ id: x.id, job: { paymentIntentId: x.id } });
|
|
41036
|
+
}
|
|
41037
|
+
};
|
|
41038
|
+
try {
|
|
41039
|
+
await (x.instance_did ? withTenant(x.instance_did, dispatch) : dispatch());
|
|
41040
|
+
} catch (error) {
|
|
41041
|
+
logger_default.error("startPaymentQueue: re-queue failed", { id: x.id, error });
|
|
40688
41042
|
}
|
|
40689
|
-
}
|
|
41043
|
+
}
|
|
40690
41044
|
};
|
|
40691
41045
|
paymentQueue.on("failed", ({ id, job, error }) => {
|
|
40692
41046
|
logger_default.error("Payment job failed", { id, job, error });
|
|
@@ -41402,12 +41756,12 @@ async function createPaymentStat(date) {
|
|
|
41402
41756
|
})
|
|
41403
41757
|
);
|
|
41404
41758
|
}
|
|
41405
|
-
var
|
|
41759
|
+
var import_fs2, import_path4, import_util121, import_sequelize67;
|
|
41406
41760
|
var init_payment_stat2 = __esm({
|
|
41407
41761
|
"../../blocklets/core/api/src/crons/payment-stat.ts"() {
|
|
41408
41762
|
"use strict";
|
|
41409
|
-
|
|
41410
|
-
|
|
41763
|
+
import_fs2 = __toESM(require("fs"));
|
|
41764
|
+
import_path4 = __toESM(require("path"));
|
|
41411
41765
|
import_util121 = require("@ocap/util");
|
|
41412
41766
|
import_sequelize67 = require("sequelize");
|
|
41413
41767
|
init_dayjs();
|
|
@@ -46289,7 +46643,7 @@ var init_customers = __esm({
|
|
|
46289
46643
|
import_hono8 = require("hono");
|
|
46290
46644
|
import_joi8 = __toESM(require("joi"));
|
|
46291
46645
|
import_pick18 = __toESM(require("lodash/pick"));
|
|
46292
|
-
import_isEmail = __toESM(require("validator/
|
|
46646
|
+
import_isEmail = __toESM(require("validator/lib/isEmail"));
|
|
46293
46647
|
import_sequelize71 = require("sequelize");
|
|
46294
46648
|
import_util126 = require("@ocap/util");
|
|
46295
46649
|
init_stake();
|
|
@@ -47037,8 +47391,8 @@ var init_payment_methods = __esm({
|
|
|
47037
47391
|
if (!raw.settings.app_store?.bundle_id) {
|
|
47038
47392
|
return c.json({ error: "app_store bundle_id is required" }, 400);
|
|
47039
47393
|
}
|
|
47040
|
-
const
|
|
47041
|
-
if (
|
|
47394
|
+
const env12 = raw.settings.app_store?.environment;
|
|
47395
|
+
if (env12 !== "production" && env12 !== "sandbox") {
|
|
47042
47396
|
return c.json({ error: "app_store environment must be production or sandbox" }, 400);
|
|
47043
47397
|
}
|
|
47044
47398
|
const hasAnyServerCred = !!(raw.settings.app_store?.issuer_id || raw.settings.app_store?.key_id || raw.settings.app_store?.private_key_pem);
|
|
@@ -56248,11 +56602,11 @@ var init_credit_transactions = __esm({
|
|
|
56248
56602
|
});
|
|
56249
56603
|
|
|
56250
56604
|
// ../../blocklets/core/api/src/libs/reference-cache.ts
|
|
56251
|
-
function evictExpired(
|
|
56252
|
-
if (
|
|
56605
|
+
function evictExpired(cache2) {
|
|
56606
|
+
if (cache2.size <= CACHE_MAX_SIZE) return;
|
|
56253
56607
|
const now = Date.now();
|
|
56254
|
-
for (const [k, v] of
|
|
56255
|
-
if (v.expires < now)
|
|
56608
|
+
for (const [k, v] of cache2) {
|
|
56609
|
+
if (v.expires < now) cache2.delete(k);
|
|
56256
56610
|
}
|
|
56257
56611
|
}
|
|
56258
56612
|
function ensureCacheHooks() {
|
|
@@ -60132,11 +60486,11 @@ function isSelf(userDid, customerDid) {
|
|
|
60132
60486
|
const b = canonicalDid(customerDid);
|
|
60133
60487
|
return !!a && a === b;
|
|
60134
60488
|
}
|
|
60135
|
-
function parseLivemode(value,
|
|
60489
|
+
function parseLivemode(value, fallback) {
|
|
60136
60490
|
if (typeof value === "boolean") return value;
|
|
60137
60491
|
if (value === "true") return true;
|
|
60138
60492
|
if (value === "false") return false;
|
|
60139
|
-
return
|
|
60493
|
+
return fallback;
|
|
60140
60494
|
}
|
|
60141
60495
|
var import_hono26, import_joi25, app26, auth18, checkQuerySchema, listQuerySchema, entitlements_default;
|
|
60142
60496
|
var init_entitlements = __esm({
|
|
@@ -61571,7 +61925,7 @@ async function processDirectTransfer({
|
|
|
61571
61925
|
}
|
|
61572
61926
|
throw new Error(`Unsupported chain type: ${chainType}`);
|
|
61573
61927
|
}
|
|
61574
|
-
var import_client4, import_util158, import_ethers5, import_hono33, import_joi29, import_pick31,
|
|
61928
|
+
var import_client4, import_util158, import_ethers5, import_hono33, import_joi29, import_pick31, import_sequelize91, app33, authAdmin5, auth23, paginationSchema9, searchSchema7, refundRequestSchema2, syncRefundRequestSchema, refunds_default;
|
|
61575
61929
|
var init_refunds = __esm({
|
|
61576
61930
|
"../../blocklets/core/api/src/routes/hono/refunds.ts"() {
|
|
61577
61931
|
"use strict";
|
|
@@ -61581,7 +61935,6 @@ var init_refunds = __esm({
|
|
|
61581
61935
|
import_hono33 = require("hono");
|
|
61582
61936
|
import_joi29 = __toESM(require("joi"));
|
|
61583
61937
|
import_pick31 = __toESM(require("lodash/pick"));
|
|
61584
|
-
import_wallet3 = require("@blocklet/sdk/lib/wallet");
|
|
61585
61938
|
import_sequelize91 = require("sequelize");
|
|
61586
61939
|
init_token();
|
|
61587
61940
|
init_api();
|
|
@@ -61800,7 +62153,7 @@ var init_refunds = __esm({
|
|
|
61800
62153
|
return c.json(existingRefund);
|
|
61801
62154
|
}
|
|
61802
62155
|
}
|
|
61803
|
-
const systemDid =
|
|
62156
|
+
const systemDid = wallet.address;
|
|
61804
62157
|
const finalCustomerName = customerName || "Broker";
|
|
61805
62158
|
let finalCustomer = await Customer.findOne({
|
|
61806
62159
|
where: { did: systemDid }
|
|
@@ -65283,17 +65636,17 @@ var init_snapshot = __esm({
|
|
|
65283
65636
|
// ../../blocklets/core/api/src/libs/archive/store.ts
|
|
65284
65637
|
function getArchiveDir() {
|
|
65285
65638
|
const dataDir = import_config4.default.env?.dataDir || "/tmp";
|
|
65286
|
-
const archiveDir =
|
|
65287
|
-
if (!
|
|
65288
|
-
|
|
65639
|
+
const archiveDir = import_path5.default.join(dataDir, "archive");
|
|
65640
|
+
if (!import_fs3.default.existsSync(archiveDir)) {
|
|
65641
|
+
import_fs3.default.mkdirSync(archiveDir, { recursive: true });
|
|
65289
65642
|
}
|
|
65290
65643
|
return archiveDir;
|
|
65291
65644
|
}
|
|
65292
65645
|
function getArchiveFilePath(fileName) {
|
|
65293
|
-
return
|
|
65646
|
+
return import_path5.default.join(getArchiveDir(), fileName);
|
|
65294
65647
|
}
|
|
65295
65648
|
function getArchiveFilePathForYear(year) {
|
|
65296
|
-
return
|
|
65649
|
+
return import_path5.default.join(getArchiveDir(), `archive-${year}.db`);
|
|
65297
65650
|
}
|
|
65298
65651
|
function getRecordYear(record) {
|
|
65299
65652
|
const createdAt = record?.created_at;
|
|
@@ -65380,13 +65733,13 @@ async function ensureArchiveTable(tableName, mainSequelize, archiveSequelize) {
|
|
|
65380
65733
|
}
|
|
65381
65734
|
function listArchiveFiles() {
|
|
65382
65735
|
const archiveDir = getArchiveDir();
|
|
65383
|
-
const files =
|
|
65736
|
+
const files = import_fs3.default.readdirSync(archiveDir).filter((name) => name.endsWith(".db"));
|
|
65384
65737
|
files.sort();
|
|
65385
|
-
return files.map((name) =>
|
|
65738
|
+
return files.map((name) => import_path5.default.join(archiveDir, name));
|
|
65386
65739
|
}
|
|
65387
65740
|
function getFileSize(filePath) {
|
|
65388
65741
|
try {
|
|
65389
|
-
return
|
|
65742
|
+
return import_fs3.default.statSync(filePath).size;
|
|
65390
65743
|
} catch (error) {
|
|
65391
65744
|
logger_default.warn("stat archive file failed", { filePath, error });
|
|
65392
65745
|
return 0;
|
|
@@ -65401,8 +65754,8 @@ function cleanupOldArchiveFiles(maxFiles) {
|
|
|
65401
65754
|
const removed = [];
|
|
65402
65755
|
for (const filePath of toRemove) {
|
|
65403
65756
|
try {
|
|
65404
|
-
|
|
65405
|
-
removed.push(
|
|
65757
|
+
import_fs3.default.unlinkSync(filePath);
|
|
65758
|
+
removed.push(import_path5.default.basename(filePath));
|
|
65406
65759
|
logger_default.info("removed old archive file", { filePath });
|
|
65407
65760
|
} catch (error) {
|
|
65408
65761
|
logger_default.warn("failed to remove old archive file", { filePath, error });
|
|
@@ -65410,12 +65763,12 @@ function cleanupOldArchiveFiles(maxFiles) {
|
|
|
65410
65763
|
}
|
|
65411
65764
|
return removed;
|
|
65412
65765
|
}
|
|
65413
|
-
var
|
|
65766
|
+
var import_fs3, import_path5, import_config4, import_sequelize97;
|
|
65414
65767
|
var init_store2 = __esm({
|
|
65415
65768
|
"../../blocklets/core/api/src/libs/archive/store.ts"() {
|
|
65416
65769
|
"use strict";
|
|
65417
|
-
|
|
65418
|
-
|
|
65770
|
+
import_fs3 = __toESM(require("fs"));
|
|
65771
|
+
import_path5 = __toESM(require("path"));
|
|
65419
65772
|
import_config4 = __toESM(require("@blocklet/sdk/lib/config"));
|
|
65420
65773
|
import_sequelize97 = require("sequelize");
|
|
65421
65774
|
init_logger();
|
|
@@ -65496,11 +65849,11 @@ function serializeJsonFields(record) {
|
|
|
65496
65849
|
return result;
|
|
65497
65850
|
}
|
|
65498
65851
|
function checkDiskSpace(minFreeDiskMB) {
|
|
65499
|
-
if (typeof
|
|
65852
|
+
if (typeof import_fs4.default.statfsSync !== "function") {
|
|
65500
65853
|
return;
|
|
65501
65854
|
}
|
|
65502
65855
|
const archiveDir = getArchiveDir();
|
|
65503
|
-
const stats =
|
|
65856
|
+
const stats = import_fs4.default.statfsSync(archiveDir);
|
|
65504
65857
|
const freeBytes = stats.bavail * stats.bsize;
|
|
65505
65858
|
const freeMB = Math.floor(freeBytes / (1024 * 1024));
|
|
65506
65859
|
if (freeMB < minFreeDiskMB) {
|
|
@@ -65858,7 +66211,7 @@ async function runArchiveJob(options) {
|
|
|
65858
66211
|
const filePath = getArchiveFilePath(fileName);
|
|
65859
66212
|
totalFileSize += getFileSize(filePath);
|
|
65860
66213
|
try {
|
|
65861
|
-
const fileChecksum = import_crypto4.default.createHash("sha256").update(
|
|
66214
|
+
const fileChecksum = import_crypto4.default.createHash("sha256").update(import_fs4.default.readFileSync(filePath)).digest("hex");
|
|
65862
66215
|
checksums.push(`${fileName}:${fileChecksum.substring(0, 8)}`);
|
|
65863
66216
|
} catch {
|
|
65864
66217
|
checksums.push(`${fileName}:error`);
|
|
@@ -65895,12 +66248,12 @@ async function runArchiveJob(options) {
|
|
|
65895
66248
|
await releaseArchiveLock(instanceId);
|
|
65896
66249
|
}
|
|
65897
66250
|
}
|
|
65898
|
-
var import_crypto4,
|
|
66251
|
+
var import_crypto4, import_fs4, import_nanoid3, import_sequelize98, ACTIVE_SUBSCRIPTION_STATUSES, TABLE_MODELS;
|
|
65899
66252
|
var init_executor = __esm({
|
|
65900
66253
|
"../../blocklets/core/api/src/libs/archive/executor.ts"() {
|
|
65901
66254
|
"use strict";
|
|
65902
66255
|
import_crypto4 = __toESM(require("crypto"));
|
|
65903
|
-
|
|
66256
|
+
import_fs4 = __toESM(require("fs"));
|
|
65904
66257
|
import_nanoid3 = require("nanoid");
|
|
65905
66258
|
import_sequelize98 = require("sequelize");
|
|
65906
66259
|
init_dayjs();
|
|
@@ -66020,7 +66373,7 @@ async function queryArchive(params, actorId) {
|
|
|
66020
66373
|
});
|
|
66021
66374
|
if (Array.isArray(rows) && rows.length > 0) {
|
|
66022
66375
|
results.push(...rows);
|
|
66023
|
-
touchedFiles.push(
|
|
66376
|
+
touchedFiles.push(import_path6.default.basename(filePath));
|
|
66024
66377
|
}
|
|
66025
66378
|
} catch (error) {
|
|
66026
66379
|
logger_default.warn("archive query failed", { filePath, error });
|
|
@@ -66036,11 +66389,11 @@ async function queryArchive(params, actorId) {
|
|
|
66036
66389
|
await recordArchiveQuery(touchedFiles, actorId);
|
|
66037
66390
|
return { data, total, archiveFiles: touchedFiles };
|
|
66038
66391
|
}
|
|
66039
|
-
var
|
|
66392
|
+
var import_path6, import_sequelize100, TENANT_TABLE_SET2, VALID_TABLE_NAME;
|
|
66040
66393
|
var init_query = __esm({
|
|
66041
66394
|
"../../blocklets/core/api/src/libs/archive/query.ts"() {
|
|
66042
66395
|
"use strict";
|
|
66043
|
-
|
|
66396
|
+
import_path6 = __toESM(require("path"));
|
|
66044
66397
|
import_sequelize100 = require("sequelize");
|
|
66045
66398
|
init_logger();
|
|
66046
66399
|
init_context();
|
|
@@ -66537,12 +66890,12 @@ var collect_exports = {};
|
|
|
66537
66890
|
__export(collect_exports, {
|
|
66538
66891
|
default: () => collect_default
|
|
66539
66892
|
});
|
|
66540
|
-
var import_util172,
|
|
66893
|
+
var import_util172, import_wallet3, collect_default;
|
|
66541
66894
|
var init_collect = __esm({
|
|
66542
66895
|
"../../blocklets/core/api/src/routes/connect/collect.ts"() {
|
|
66543
66896
|
"use strict";
|
|
66544
66897
|
import_util172 = require("@ocap/util");
|
|
66545
|
-
|
|
66898
|
+
import_wallet3 = require("@ocap/wallet");
|
|
66546
66899
|
init_token();
|
|
66547
66900
|
init_tx();
|
|
66548
66901
|
init_auth();
|
|
@@ -66678,7 +67031,7 @@ var init_collect = __esm({
|
|
|
66678
67031
|
const { buffer: buffer2 } = await client.encodeTransferV3Tx({ tx });
|
|
66679
67032
|
const txHash = await client.sendTransferV3Tx(
|
|
66680
67033
|
// @ts-ignore
|
|
66681
|
-
{ tx, wallet: (0,
|
|
67034
|
+
{ tx, wallet: (0, import_wallet3.fromAddress)(userDid) },
|
|
66682
67035
|
await getGasPayerExtra(buffer2, client.pickGasPayerHeaders(request))
|
|
66683
67036
|
);
|
|
66684
67037
|
await afterTxExecution({
|
|
@@ -66724,11 +67077,11 @@ var collect_batch_exports = {};
|
|
|
66724
67077
|
__export(collect_batch_exports, {
|
|
66725
67078
|
default: () => collect_batch_default
|
|
66726
67079
|
});
|
|
66727
|
-
var
|
|
67080
|
+
var import_wallet4, import_util174, collect_batch_default;
|
|
66728
67081
|
var init_collect_batch = __esm({
|
|
66729
67082
|
"../../blocklets/core/api/src/routes/connect/collect-batch.ts"() {
|
|
66730
67083
|
"use strict";
|
|
66731
|
-
|
|
67084
|
+
import_wallet4 = require("@ocap/wallet");
|
|
66732
67085
|
import_util174 = require("@ocap/util");
|
|
66733
67086
|
init_token();
|
|
66734
67087
|
init_tx();
|
|
@@ -66845,7 +67198,7 @@ var init_collect_batch = __esm({
|
|
|
66845
67198
|
const { buffer: buffer2 } = await client.encodeTransferV3Tx({ tx });
|
|
66846
67199
|
const txHash = await client.sendTransferV3Tx(
|
|
66847
67200
|
// @ts-ignore
|
|
66848
|
-
{ tx, wallet: (0,
|
|
67201
|
+
{ tx, wallet: (0, import_wallet4.fromAddress)(userDid) },
|
|
66849
67202
|
await getGasPayerExtra(buffer2, client.pickGasPayerHeaders(request))
|
|
66850
67203
|
);
|
|
66851
67204
|
await afterTxExecution({ tx_hash: txHash, payer: userDid, type: "transfer" });
|
|
@@ -66911,12 +67264,12 @@ var pay_exports = {};
|
|
|
66911
67264
|
__export(pay_exports, {
|
|
66912
67265
|
default: () => pay_default
|
|
66913
67266
|
});
|
|
66914
|
-
var import_util176,
|
|
67267
|
+
var import_util176, import_wallet5, pay_default;
|
|
66915
67268
|
var init_pay = __esm({
|
|
66916
67269
|
"../../blocklets/core/api/src/routes/connect/pay.ts"() {
|
|
66917
67270
|
"use strict";
|
|
66918
67271
|
import_util176 = require("@ocap/util");
|
|
66919
|
-
|
|
67272
|
+
import_wallet5 = require("@ocap/wallet");
|
|
66920
67273
|
init_token();
|
|
66921
67274
|
init_tx();
|
|
66922
67275
|
init_auth();
|
|
@@ -67039,7 +67392,7 @@ var init_pay = __esm({
|
|
|
67039
67392
|
const { buffer: buffer2 } = await client.encodeTransferV3Tx({ tx });
|
|
67040
67393
|
const txHash = await client.sendTransferV3Tx(
|
|
67041
67394
|
// @ts-ignore
|
|
67042
|
-
{ tx, wallet: (0,
|
|
67395
|
+
{ tx, wallet: (0, import_wallet5.fromAddress)(userDid) },
|
|
67043
67396
|
await getGasPayerExtra(buffer2, client.pickGasPayerHeaders(request))
|
|
67044
67397
|
);
|
|
67045
67398
|
const quoteValidation = await validateQuoteForPayment({
|
|
@@ -68436,11 +68789,11 @@ var recharge_exports = {};
|
|
|
68436
68789
|
__export(recharge_exports, {
|
|
68437
68790
|
default: () => recharge_default
|
|
68438
68791
|
});
|
|
68439
|
-
var
|
|
68792
|
+
var import_wallet6, import_util182, recharge_default;
|
|
68440
68793
|
var init_recharge = __esm({
|
|
68441
68794
|
"../../blocklets/core/api/src/routes/connect/recharge.ts"() {
|
|
68442
68795
|
"use strict";
|
|
68443
|
-
|
|
68796
|
+
import_wallet6 = require("@ocap/wallet");
|
|
68444
68797
|
import_util182 = require("@ocap/util");
|
|
68445
68798
|
init_token();
|
|
68446
68799
|
init_tx();
|
|
@@ -68555,7 +68908,7 @@ var init_recharge = __esm({
|
|
|
68555
68908
|
const { buffer: buffer2 } = await client.encodeTransferV3Tx({ tx });
|
|
68556
68909
|
const txHash = await client.sendTransferV3Tx(
|
|
68557
68910
|
// @ts-ignore
|
|
68558
|
-
{ tx, wallet: (0,
|
|
68911
|
+
{ tx, wallet: (0, import_wallet6.fromAddress)(userDid) },
|
|
68559
68912
|
await getGasPayerExtra(buffer2, client.pickGasPayerHeaders(request))
|
|
68560
68913
|
);
|
|
68561
68914
|
logger_default.info("Recharge successful", {
|
|
@@ -69167,11 +69520,11 @@ async function triggerAutoRecharge(customer) {
|
|
|
69167
69520
|
});
|
|
69168
69521
|
}
|
|
69169
69522
|
}
|
|
69170
|
-
var
|
|
69523
|
+
var import_wallet7, import_util185, import_p_all6, recharge_account_default;
|
|
69171
69524
|
var init_recharge_account = __esm({
|
|
69172
69525
|
"../../blocklets/core/api/src/routes/connect/recharge-account.ts"() {
|
|
69173
69526
|
"use strict";
|
|
69174
|
-
|
|
69527
|
+
import_wallet7 = require("@ocap/wallet");
|
|
69175
69528
|
import_util185 = require("@ocap/util");
|
|
69176
69529
|
import_p_all6 = __toESM(require("p-all"));
|
|
69177
69530
|
init_token();
|
|
@@ -69334,7 +69687,7 @@ var init_recharge_account = __esm({
|
|
|
69334
69687
|
const { buffer: buffer2 } = await client.encodeTransferV3Tx({ tx });
|
|
69335
69688
|
const txHash = await client.sendTransferV3Tx(
|
|
69336
69689
|
// @ts-ignore
|
|
69337
|
-
{ tx, wallet: (0,
|
|
69690
|
+
{ tx, wallet: (0, import_wallet7.fromAddress)(userDid) },
|
|
69338
69691
|
await getGasPayerExtra(buffer2, client.pickGasPayerHeaders(request))
|
|
69339
69692
|
);
|
|
69340
69693
|
await afterTxExecution({
|
|
@@ -69985,137 +70338,6 @@ var init_change_payer = __esm({
|
|
|
69985
70338
|
}
|
|
69986
70339
|
});
|
|
69987
70340
|
|
|
69988
|
-
// ../../blocklets/core/api/src/middlewares/hono/fallback.ts
|
|
69989
|
-
var fallback_exports = {};
|
|
69990
|
-
__export(fallback_exports, {
|
|
69991
|
-
default: () => fallback_default,
|
|
69992
|
-
fallback: () => fallback
|
|
69993
|
-
});
|
|
69994
|
-
function acceptsHtml(accept) {
|
|
69995
|
-
if (!accept) return true;
|
|
69996
|
-
return accept.includes("text/html") || accept.includes("application/xhtml+xml") || accept.includes("*/*");
|
|
69997
|
-
}
|
|
69998
|
-
function fallback(file, options = {}) {
|
|
69999
|
-
const filePath = options.root ? (0, import_path6.join)(options.root, file) : file;
|
|
70000
|
-
if (!import_fs4.default.existsSync(filePath)) {
|
|
70001
|
-
throw new Error(`Fallback file not found at: ${filePath}`);
|
|
70002
|
-
}
|
|
70003
|
-
return async (c, next) => {
|
|
70004
|
-
const method = c.req.method.toUpperCase();
|
|
70005
|
-
if (method !== "GET" && method !== "HEAD" || !acceptsHtml(c.req.header("accept") || "") || import_constant.RESOURCE_PATTERN.test(c.req.path)) {
|
|
70006
|
-
return next();
|
|
70007
|
-
}
|
|
70008
|
-
const pageGroup = c.req.header("x-page-group") || "";
|
|
70009
|
-
const pathPrefix = c.req.header("x-path-prefix") || "";
|
|
70010
|
-
const cacheKey = getCacheKey(c.req.path, filePath, pageGroup, pathPrefix);
|
|
70011
|
-
const { theme } = (0, import_config7.getBlockletSettings)();
|
|
70012
|
-
if (cacheEnabled) {
|
|
70013
|
-
const cached = cache2.get(cacheKey);
|
|
70014
|
-
const cacheTtl = options.cacheTtl || DEFAULT_CACHE_TTL;
|
|
70015
|
-
if (cached && Date.now() - cached.timestamp < cacheTtl && cached.pageGroup === pageGroup && cached.pathPrefix === pathPrefix) {
|
|
70016
|
-
c.header("X-Cache", "HIT");
|
|
70017
|
-
c.header("ETag", cached.etag);
|
|
70018
|
-
return c.html(cached.html);
|
|
70019
|
-
}
|
|
70020
|
-
}
|
|
70021
|
-
const pageData = await tryWithTimeout2(
|
|
70022
|
-
options.getPageData ? () => options.getPageData(c) : () => Promise.resolve({}),
|
|
70023
|
-
options.timeout || 5e3
|
|
70024
|
-
);
|
|
70025
|
-
validatePageData(pageData, options.maxLength || 1e3);
|
|
70026
|
-
const title = (0, import_escape.default)(pageData.title || import_config7.env.appName);
|
|
70027
|
-
const description = (0, import_escape.default)(pageData.description || import_config7.env.appDescription);
|
|
70028
|
-
const ogImage = pageData.ogImage || (0, import_ufo15.joinURL)(import_config7.env.appUrl || "/", import_constants24.SERVICE_PREFIX, "/blocklet/og.png");
|
|
70029
|
-
let source = await import_fs4.default.promises.readFile(filePath, "utf8");
|
|
70030
|
-
if (title) {
|
|
70031
|
-
source = source.includes("<title>") ? source.replace(TITLE_TAG_REGEX, `<title>${title}</title>`) : source.replace(HEAD_END_TAG, `<title>${title}</title>${HEAD_END_TAG}`);
|
|
70032
|
-
}
|
|
70033
|
-
if (description && !source.includes('<meta name="description"')) {
|
|
70034
|
-
source = source.replace(
|
|
70035
|
-
HEAD_END_TAG,
|
|
70036
|
-
`<meta name="description" content="${description}" data-react-helmet="true" />${HEAD_END_TAG}`
|
|
70037
|
-
);
|
|
70038
|
-
}
|
|
70039
|
-
if (!source.includes('meta property="og:image"')) {
|
|
70040
|
-
source = source.replace(
|
|
70041
|
-
HEAD_END_TAG,
|
|
70042
|
-
`${buildOpenGraph({ title, description, ogImage }, import_config7.env.appUrl || "/")}
|
|
70043
|
-
${HEAD_END_TAG}`
|
|
70044
|
-
);
|
|
70045
|
-
}
|
|
70046
|
-
if (pageData.embed) {
|
|
70047
|
-
source = source.replace(
|
|
70048
|
-
HEAD_END_TAG,
|
|
70049
|
-
`<link rel="blocklet-open-embed" type="application/json" href="${pageData.embed}" />${HEAD_END_TAG}`
|
|
70050
|
-
);
|
|
70051
|
-
}
|
|
70052
|
-
const blockletJs = (0, import_config7.getBlockletJs)(pageGroup, pathPrefix);
|
|
70053
|
-
if (blockletJs && options.injectBlockletJs !== false) {
|
|
70054
|
-
source = source.replace('<script src="__blocklet__.js"></script>', `<script>${blockletJs}</script>`).replace('<script src="__meta__.js"></script>', `<script>${blockletJs}</script>`);
|
|
70055
|
-
}
|
|
70056
|
-
const themeStyles = (0, import_theme.buildThemeStyles)(theme);
|
|
70057
|
-
const themeScript = (0, import_theme.buildThemeScript)(theme);
|
|
70058
|
-
if (!source.includes('<style id="blocklet-theme">')) {
|
|
70059
|
-
source = source.replace(HEAD_END_TAG, `${themeStyles}${HEAD_END_TAG}`);
|
|
70060
|
-
}
|
|
70061
|
-
if (!source.includes('<script id="blocklet-theme-script">')) {
|
|
70062
|
-
source = source.replace(HEAD_END_TAG, `${themeScript}${HEAD_END_TAG}`);
|
|
70063
|
-
}
|
|
70064
|
-
const etag = generateETag(source);
|
|
70065
|
-
cache2.set(cacheKey, { html: source, timestamp: Date.now(), etag, pageGroup, pathPrefix });
|
|
70066
|
-
if (options.cacheTtl) {
|
|
70067
|
-
c.header("Cache-Control", `public, max-age=${options.cacheTtl}`);
|
|
70068
|
-
} else {
|
|
70069
|
-
c.header("Surrogate-Control", "no-store");
|
|
70070
|
-
c.header("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate");
|
|
70071
|
-
c.header("Expires", "0");
|
|
70072
|
-
}
|
|
70073
|
-
c.header("X-Cache", "MISS");
|
|
70074
|
-
c.header("ETag", etag);
|
|
70075
|
-
return c.html(source);
|
|
70076
|
-
};
|
|
70077
|
-
}
|
|
70078
|
-
var import_fs4, import_path6, import_crypto5, import_ufo15, import_escape, import_constant, import_theme, import_config7, import_constants24, DEFAULT_CACHE_TTL, cache2, cacheEnabled, TITLE_TAG_REGEX, HEAD_END_TAG, buildOpenGraph, validatePageData, generateETag, getCacheKey, tryWithTimeout2, fallback_default;
|
|
70079
|
-
var init_fallback = __esm({
|
|
70080
|
-
"../../blocklets/core/api/src/middlewares/hono/fallback.ts"() {
|
|
70081
|
-
"use strict";
|
|
70082
|
-
import_fs4 = __toESM(require("fs"));
|
|
70083
|
-
import_path6 = require("path");
|
|
70084
|
-
import_crypto5 = __toESM(require("crypto"));
|
|
70085
|
-
import_ufo15 = require("ufo");
|
|
70086
|
-
import_escape = __toESM(require("lodash/escape"));
|
|
70087
|
-
import_constant = require("@blocklet/constant");
|
|
70088
|
-
import_theme = require("@blocklet/theme");
|
|
70089
|
-
import_config7 = require("@blocklet/sdk/lib/config");
|
|
70090
|
-
import_constants24 = require("@blocklet/sdk/lib/util/constants");
|
|
70091
|
-
init_env();
|
|
70092
|
-
DEFAULT_CACHE_TTL = 60 * 1e3;
|
|
70093
|
-
cache2 = /* @__PURE__ */ new Map();
|
|
70094
|
-
cacheEnabled = readConfig("FALLBACK_CACHE_ENABLED") === "true" || isTestEnv();
|
|
70095
|
-
TITLE_TAG_REGEX = /<title>(.+)<\/title>/;
|
|
70096
|
-
HEAD_END_TAG = "</head>";
|
|
70097
|
-
buildOpenGraph = (pageData, appUrl) => [
|
|
70098
|
-
`<meta property="og:title" content="${pageData.title}" data-react-helmet="true" />`,
|
|
70099
|
-
`<meta property="og:description" content="${pageData.description}" data-react-helmet="true" />`,
|
|
70100
|
-
'<meta property="og:type" content="website" data-react-helmet="true" />',
|
|
70101
|
-
`<meta property="og:url" content="${appUrl}" data-react-helmet="true" />`,
|
|
70102
|
-
`<meta property="og:image" content="${pageData.ogImage}" data-react-helmet="true" />`,
|
|
70103
|
-
'<meta name="twitter:card" content="summary_large_image" data-react-helmet="true" />'
|
|
70104
|
-
].join("\n");
|
|
70105
|
-
validatePageData = (data, maxLength) => {
|
|
70106
|
-
if (data.title && data.title.length > maxLength) throw new Error("Title too long");
|
|
70107
|
-
if (data.description && data.description.length > maxLength) throw new Error("Description too long");
|
|
70108
|
-
};
|
|
70109
|
-
generateETag = (content) => `W/"${import_crypto5.default.createHash("sha1").update(content).digest("base64")}"`;
|
|
70110
|
-
getCacheKey = (pathname, filePath, pageGroup, pathPrefix) => import_crypto5.default.createHash("sha1").update(`${pathname}:${filePath}:${pageGroup}:${pathPrefix}`).digest("base64");
|
|
70111
|
-
tryWithTimeout2 = (asyncFn, timeout) => new Promise((resolve, reject) => {
|
|
70112
|
-
const timer = setTimeout(() => reject(new Error(`Operation timed out after ${timeout} ms`)), timeout);
|
|
70113
|
-
Promise.resolve().then(asyncFn).then((result) => resolve(result)).catch((err) => reject(err)).finally(() => clearTimeout(timer));
|
|
70114
|
-
});
|
|
70115
|
-
fallback_default = fallback;
|
|
70116
|
-
}
|
|
70117
|
-
});
|
|
70118
|
-
|
|
70119
70341
|
// ../../blocklets/core/api/src/crons/currency.ts
|
|
70120
70342
|
var currency_exports = {};
|
|
70121
70343
|
__export(currency_exports, {
|
|
@@ -72348,6 +72570,7 @@ var init_refund3 = __esm({
|
|
|
72348
72570
|
init_subscription2();
|
|
72349
72571
|
init_token();
|
|
72350
72572
|
init_auth();
|
|
72573
|
+
init_context();
|
|
72351
72574
|
init_error();
|
|
72352
72575
|
init_event2();
|
|
72353
72576
|
init_logger();
|
|
@@ -72725,13 +72948,20 @@ var init_refund3 = __esm({
|
|
|
72725
72948
|
});
|
|
72726
72949
|
startRefundQueue = async () => {
|
|
72727
72950
|
const refunds = await systemFindAll(Refund, { where: { status: ["pending"] } });
|
|
72728
|
-
|
|
72729
|
-
const
|
|
72730
|
-
|
|
72731
|
-
|
|
72732
|
-
|
|
72951
|
+
for (const x of refunds) {
|
|
72952
|
+
const dispatch = async () => {
|
|
72953
|
+
const exist = await refundQueue.get(x.id);
|
|
72954
|
+
if (!exist) {
|
|
72955
|
+
refundQueue.push({ id: x.id, job: { refundId: x.id } });
|
|
72956
|
+
logger_default.info("Re-queued pending refund", { id: x.id });
|
|
72957
|
+
}
|
|
72958
|
+
};
|
|
72959
|
+
try {
|
|
72960
|
+
await (x.instance_did ? withTenant(x.instance_did, dispatch) : dispatch());
|
|
72961
|
+
} catch (error) {
|
|
72962
|
+
logger_default.error("startRefundQueue: re-queue failed", { id: x.id, error });
|
|
72733
72963
|
}
|
|
72734
|
-
}
|
|
72964
|
+
}
|
|
72735
72965
|
};
|
|
72736
72966
|
refundQueue.on("failed", ({ id, job, error }) => {
|
|
72737
72967
|
logger_default.error("refund job failed", { id, job, error });
|
|
@@ -73491,11 +73721,11 @@ var init_fulfillment_coordinator = __esm({
|
|
|
73491
73721
|
});
|
|
73492
73722
|
|
|
73493
73723
|
// ../../blocklets/core/api/src/queues/vendors/status-check.ts
|
|
73494
|
-
var
|
|
73724
|
+
var import_ufo15, import_payment_vendor4, startVendorStatusCheckSchedule, handleVendorStatusCheck, vendorStatusCheckQueue;
|
|
73495
73725
|
var init_status_check = __esm({
|
|
73496
73726
|
"../../blocklets/core/api/src/queues/vendors/status-check.ts"() {
|
|
73497
73727
|
"use strict";
|
|
73498
|
-
|
|
73728
|
+
import_ufo15 = require("ufo");
|
|
73499
73729
|
import_payment_vendor4 = require("@blocklet/payment-vendor");
|
|
73500
73730
|
init_queue2();
|
|
73501
73731
|
init_checkout_session();
|
|
@@ -73580,7 +73810,7 @@ var init_status_check = __esm({
|
|
|
73580
73810
|
const url = productVendor?.app_url;
|
|
73581
73811
|
logger_default.info("found vendor url", { url, productVendor });
|
|
73582
73812
|
if (url) {
|
|
73583
|
-
const serverStatusUrl = (0,
|
|
73813
|
+
const serverStatusUrl = (0, import_ufo15.joinURL)(
|
|
73584
73814
|
url,
|
|
73585
73815
|
productVendor?.metadata?.mountPoint,
|
|
73586
73816
|
"/api/vendor/status",
|
|
@@ -73652,7 +73882,7 @@ var init_status_check = __esm({
|
|
|
73652
73882
|
|
|
73653
73883
|
// ../../blocklets/core/api/src/crons/overdue-detection.ts
|
|
73654
73884
|
function getAppName() {
|
|
73655
|
-
return
|
|
73885
|
+
return import_config7.env.appName;
|
|
73656
73886
|
}
|
|
73657
73887
|
async function createOverdueDetection() {
|
|
73658
73888
|
logger_default.info("Start health report generation");
|
|
@@ -73672,16 +73902,16 @@ async function createOverdueDetection() {
|
|
|
73672
73902
|
logger_default.error("Failed to create health report", error);
|
|
73673
73903
|
}
|
|
73674
73904
|
}
|
|
73675
|
-
var import_notification29, import_component18,
|
|
73905
|
+
var import_notification29, import_component18, import_config7, import_util196, import_sequelize107, import_ufo16, HealthReportTemplate;
|
|
73676
73906
|
var init_overdue_detection = __esm({
|
|
73677
73907
|
"../../blocklets/core/api/src/crons/overdue-detection.ts"() {
|
|
73678
73908
|
"use strict";
|
|
73679
73909
|
import_notification29 = __toESM(require("@blocklet/sdk/service/notification"));
|
|
73680
73910
|
import_component18 = require("@blocklet/sdk/lib/component");
|
|
73681
|
-
|
|
73911
|
+
import_config7 = require("@blocklet/sdk/lib/config");
|
|
73682
73912
|
import_util196 = require("@ocap/util");
|
|
73683
73913
|
import_sequelize107 = require("sequelize");
|
|
73684
|
-
|
|
73914
|
+
import_ufo16 = require("ufo");
|
|
73685
73915
|
init_notification2();
|
|
73686
73916
|
init_dayjs();
|
|
73687
73917
|
init_env();
|
|
@@ -74007,9 +74237,9 @@ var init_overdue_detection = __esm({
|
|
|
74007
74237
|
throw new Error("get owner did failed");
|
|
74008
74238
|
}
|
|
74009
74239
|
const locale = await getUserLocale(userDid);
|
|
74010
|
-
const viewDataOverviewUrl = (0, import_component18.getUrl)((0,
|
|
74011
|
-
const viewSubscriptionsUrl = (0, import_component18.getUrl)((0,
|
|
74012
|
-
const viewOverdueUrl = (0, import_component18.getUrl)((0,
|
|
74240
|
+
const viewDataOverviewUrl = (0, import_component18.getUrl)((0, import_ufo16.withQuery)("admin/billing", { locale }));
|
|
74241
|
+
const viewSubscriptionsUrl = (0, import_component18.getUrl)((0, import_ufo16.withQuery)("admin/billing/subscriptions", { locale }));
|
|
74242
|
+
const viewOverdueUrl = (0, import_component18.getUrl)((0, import_ufo16.withQuery)("admin/billing/overdue", { locale }));
|
|
74013
74243
|
return {
|
|
74014
74244
|
locale,
|
|
74015
74245
|
userDid,
|
|
@@ -74222,6 +74452,7 @@ var init_event3 = __esm({
|
|
|
74222
74452
|
import_sequelize108 = require("sequelize");
|
|
74223
74453
|
init_env();
|
|
74224
74454
|
init_scoped();
|
|
74455
|
+
init_context();
|
|
74225
74456
|
init_event2();
|
|
74226
74457
|
init_logger();
|
|
74227
74458
|
init_queue2();
|
|
@@ -74278,16 +74509,26 @@ var init_event3 = __esm({
|
|
|
74278
74509
|
where: {
|
|
74279
74510
|
pending_webhooks: { [import_sequelize108.Op.gt]: 0 }
|
|
74280
74511
|
},
|
|
74281
|
-
attributes: ["id"]
|
|
74512
|
+
attributes: ["id", "instance_did"]
|
|
74282
74513
|
});
|
|
74283
74514
|
logger_default.info(`Found ${docs.length} events with pending webhooks`);
|
|
74284
|
-
|
|
74285
|
-
|
|
74286
|
-
|
|
74287
|
-
|
|
74288
|
-
|
|
74515
|
+
for (const x of docs) {
|
|
74516
|
+
if (!x.instance_did) {
|
|
74517
|
+
logger_default.warn("skip pending-webhook event with no tenant", { id: x.id });
|
|
74518
|
+
} else {
|
|
74519
|
+
try {
|
|
74520
|
+
await withTenant(x.instance_did, async () => {
|
|
74521
|
+
const exist = await eventQueue.get(x.id);
|
|
74522
|
+
if (!exist) {
|
|
74523
|
+
logger_default.info(`Pushing event ${x.id} to queue`);
|
|
74524
|
+
eventQueue.push({ id: x.id, job: { eventId: x.id }, persist: false });
|
|
74525
|
+
}
|
|
74526
|
+
});
|
|
74527
|
+
} catch (error) {
|
|
74528
|
+
logger_default.error("failed to recover pending-webhook event", { id: x.id, error });
|
|
74529
|
+
}
|
|
74289
74530
|
}
|
|
74290
|
-
}
|
|
74531
|
+
}
|
|
74291
74532
|
logger_default.info("Finished starting event queue");
|
|
74292
74533
|
};
|
|
74293
74534
|
eventQueue.on("failed", ({ id, job, error }) => {
|
|
@@ -74342,6 +74583,45 @@ var init_retry_pending_events = __esm({
|
|
|
74342
74583
|
}
|
|
74343
74584
|
});
|
|
74344
74585
|
|
|
74586
|
+
// ../../blocklets/core/api/src/crons/tenant-fanout.ts
|
|
74587
|
+
async function listProvisionedTenants() {
|
|
74588
|
+
const { PaymentMethod: PaymentMethod3 } = (init_models(), __toCommonJS(models_exports));
|
|
74589
|
+
const rows = await systemFindAll(PaymentMethod3, {
|
|
74590
|
+
attributes: ["instance_did"],
|
|
74591
|
+
raw: true
|
|
74592
|
+
});
|
|
74593
|
+
const dids = /* @__PURE__ */ new Set();
|
|
74594
|
+
for (const row of rows) {
|
|
74595
|
+
if (row?.instance_did) dids.add(row.instance_did);
|
|
74596
|
+
}
|
|
74597
|
+
return [...dids];
|
|
74598
|
+
}
|
|
74599
|
+
function perTenant(name, fn3, listTenants = listProvisionedTenants) {
|
|
74600
|
+
return async () => {
|
|
74601
|
+
if (getTenantMode() === "single") {
|
|
74602
|
+
await fn3();
|
|
74603
|
+
return;
|
|
74604
|
+
}
|
|
74605
|
+
const dids = await listTenants();
|
|
74606
|
+
if (dids.length === 0) return;
|
|
74607
|
+
logger_default.info("cron.tenant.fanout", { cron: name, tenantCount: dids.length });
|
|
74608
|
+
for (const instanceDid of dids) {
|
|
74609
|
+
await withTenant(instanceDid, async () => fn3()).catch(
|
|
74610
|
+
(error) => logger_default.error("cron tenant pass failed", { cron: name, instanceDid, error })
|
|
74611
|
+
);
|
|
74612
|
+
}
|
|
74613
|
+
};
|
|
74614
|
+
}
|
|
74615
|
+
var init_tenant_fanout = __esm({
|
|
74616
|
+
"../../blocklets/core/api/src/crons/tenant-fanout.ts"() {
|
|
74617
|
+
"use strict";
|
|
74618
|
+
init_context();
|
|
74619
|
+
init_logger();
|
|
74620
|
+
init_tenant();
|
|
74621
|
+
init_scoped();
|
|
74622
|
+
}
|
|
74623
|
+
});
|
|
74624
|
+
|
|
74345
74625
|
// ../../blocklets/core/api/src/crons/subscription-trial-will-end.ts
|
|
74346
74626
|
var import_dayjs45, import_sequelize110, SubscriptionTrialWillEndSchedule;
|
|
74347
74627
|
var init_subscription_trial_will_end2 = __esm({
|
|
@@ -74633,6 +74913,7 @@ var init_payout3 = __esm({
|
|
|
74633
74913
|
init_payment();
|
|
74634
74914
|
init_queue2();
|
|
74635
74915
|
init_auth();
|
|
74916
|
+
init_context();
|
|
74636
74917
|
init_token();
|
|
74637
74918
|
init_payment_method();
|
|
74638
74919
|
init_payment_currency();
|
|
@@ -74679,23 +74960,30 @@ var init_payout3 = __esm({
|
|
|
74679
74960
|
status: "pending"
|
|
74680
74961
|
}
|
|
74681
74962
|
});
|
|
74682
|
-
|
|
74683
|
-
const
|
|
74684
|
-
|
|
74685
|
-
if (
|
|
74686
|
-
|
|
74687
|
-
|
|
74688
|
-
|
|
74689
|
-
|
|
74690
|
-
|
|
74691
|
-
|
|
74692
|
-
|
|
74693
|
-
|
|
74694
|
-
|
|
74695
|
-
|
|
74963
|
+
for (const payout of payouts) {
|
|
74964
|
+
const dispatch = async () => {
|
|
74965
|
+
const exist = await payoutQueue.get(payout.id);
|
|
74966
|
+
if (!exist) {
|
|
74967
|
+
if (payout.next_attempt && payout.next_attempt > dayjs_default().unix()) {
|
|
74968
|
+
payoutQueue.push({
|
|
74969
|
+
id: payout.id,
|
|
74970
|
+
job: { payoutId: payout.id, retryOnError: true },
|
|
74971
|
+
runAt: payout.next_attempt
|
|
74972
|
+
});
|
|
74973
|
+
} else {
|
|
74974
|
+
payoutQueue.push({
|
|
74975
|
+
id: payout.id,
|
|
74976
|
+
job: { payoutId: payout.id, retryOnError: true }
|
|
74977
|
+
});
|
|
74978
|
+
}
|
|
74696
74979
|
}
|
|
74980
|
+
};
|
|
74981
|
+
try {
|
|
74982
|
+
await (payout.instance_did ? withTenant(payout.instance_did, dispatch) : dispatch());
|
|
74983
|
+
} catch (error) {
|
|
74984
|
+
logger_default.error("startPayoutQueue: re-queue failed", { id: payout.id, error });
|
|
74697
74985
|
}
|
|
74698
|
-
}
|
|
74986
|
+
}
|
|
74699
74987
|
};
|
|
74700
74988
|
events.on("payout.created", async (payout) => {
|
|
74701
74989
|
if (payout.status === "pending") {
|
|
@@ -75121,19 +75409,19 @@ function init() {
|
|
|
75121
75409
|
{
|
|
75122
75410
|
name: "subscription.will.renew",
|
|
75123
75411
|
time: notificationCronTime(),
|
|
75124
|
-
fn: () => new SubscriptionWillRenewSchedule().run(),
|
|
75412
|
+
fn: perTenant("subscription.will.renew", () => new SubscriptionWillRenewSchedule().run()),
|
|
75125
75413
|
options: { runOnInit: true }
|
|
75126
75414
|
},
|
|
75127
75415
|
{
|
|
75128
75416
|
name: "subscription.trial.will.end",
|
|
75129
75417
|
time: notificationCronTime(),
|
|
75130
|
-
fn: () => new SubscriptionTrialWillEndSchedule().run(),
|
|
75418
|
+
fn: perTenant("subscription.trial.will.end", () => new SubscriptionTrialWillEndSchedule().run()),
|
|
75131
75419
|
options: { runOnInit: true }
|
|
75132
75420
|
},
|
|
75133
75421
|
{
|
|
75134
75422
|
name: "customer.subscription.will_canceled",
|
|
75135
75423
|
time: notificationCronTime(),
|
|
75136
|
-
fn: () => new SubscriptionWillCanceledSchedule().run(),
|
|
75424
|
+
fn: perTenant("customer.subscription.will_canceled", () => new SubscriptionWillCanceledSchedule().run()),
|
|
75137
75425
|
options: { runOnInit: true }
|
|
75138
75426
|
},
|
|
75139
75427
|
{
|
|
@@ -75154,34 +75442,34 @@ function init() {
|
|
|
75154
75442
|
{
|
|
75155
75443
|
name: "checkoutSession.cleanup.expired",
|
|
75156
75444
|
time: expiredSessionCleanupCronTime(),
|
|
75157
|
-
fn: async () => {
|
|
75445
|
+
fn: perTenant("checkoutSession.cleanup.expired", async () => {
|
|
75158
75446
|
const removedCount = await CheckoutSession.cleanupExpiredSessions();
|
|
75159
75447
|
logger_default.info("CheckoutSession.cleanupExpiredSessions", { removedCount });
|
|
75160
|
-
},
|
|
75448
|
+
}),
|
|
75161
75449
|
options: { runOnInit: true }
|
|
75162
75450
|
},
|
|
75163
75451
|
{
|
|
75164
75452
|
name: "stripe.invoice.sync",
|
|
75165
75453
|
time: stripeInvoiceCronTime(),
|
|
75166
|
-
fn: batchHandleStripeInvoices,
|
|
75454
|
+
fn: perTenant("stripe.invoice.sync", batchHandleStripeInvoices),
|
|
75167
75455
|
options: { runOnInit: false }
|
|
75168
75456
|
},
|
|
75169
75457
|
{
|
|
75170
75458
|
name: "stripe.payment.sync",
|
|
75171
75459
|
time: stripePaymentCronTime(),
|
|
75172
|
-
fn: batchHandleStripePayments,
|
|
75460
|
+
fn: perTenant("stripe.payment.sync", batchHandleStripePayments),
|
|
75173
75461
|
options: { runOnInit: false }
|
|
75174
75462
|
},
|
|
75175
75463
|
{
|
|
75176
75464
|
name: "stripe.subscription.sync",
|
|
75177
75465
|
time: stripeSubscriptionCronTime(),
|
|
75178
|
-
fn: batchHandleStripeSubscriptions,
|
|
75466
|
+
fn: perTenant("stripe.subscription.sync", batchHandleStripeSubscriptions),
|
|
75179
75467
|
options: { runOnInit: false }
|
|
75180
75468
|
},
|
|
75181
75469
|
{
|
|
75182
75470
|
name: "customer.stake.revoked",
|
|
75183
75471
|
time: revokeStakeCronTime(),
|
|
75184
|
-
fn: checkStakeRevokeTx,
|
|
75472
|
+
fn: perTenant("customer.stake.revoked", checkStakeRevokeTx),
|
|
75185
75473
|
options: { runOnInit: false }
|
|
75186
75474
|
},
|
|
75187
75475
|
{
|
|
@@ -75190,7 +75478,7 @@ function init() {
|
|
|
75190
75478
|
// webhook missed). See blocklets/core/api/src/integrations/iap-reconcile.ts.
|
|
75191
75479
|
name: "iap.reconcile",
|
|
75192
75480
|
time: iapReconcileCronTime(),
|
|
75193
|
-
fn: () => runIapReconcile(),
|
|
75481
|
+
fn: perTenant("iap.reconcile", () => runIapReconcile()),
|
|
75194
75482
|
options: { runOnInit: false }
|
|
75195
75483
|
},
|
|
75196
75484
|
{
|
|
@@ -75199,19 +75487,19 @@ function init() {
|
|
|
75199
75487
|
// See blocklets/core/api/src/crons/retry-pending-events.ts.
|
|
75200
75488
|
name: "event.retry",
|
|
75201
75489
|
time: eventRetryCronTime(),
|
|
75202
|
-
fn: () => retryPendingEvents(),
|
|
75490
|
+
fn: perTenant("event.retry", () => retryPendingEvents()),
|
|
75203
75491
|
options: { runOnInit: false }
|
|
75204
75492
|
},
|
|
75205
75493
|
{
|
|
75206
75494
|
name: "payment.stat",
|
|
75207
75495
|
time: paymentStatCronTime(),
|
|
75208
|
-
fn: () => createPaymentStat(),
|
|
75496
|
+
fn: perTenant("payment.stat", () => createPaymentStat()),
|
|
75209
75497
|
options: { runOnInit: false }
|
|
75210
75498
|
},
|
|
75211
75499
|
{
|
|
75212
75500
|
name: "payment.daily.report",
|
|
75213
75501
|
time: overdueDetectionCronTime(),
|
|
75214
|
-
fn: () => createOverdueDetection(),
|
|
75502
|
+
fn: perTenant("payment.daily.report", () => createOverdueDetection()),
|
|
75215
75503
|
options: { runOnInit: false }
|
|
75216
75504
|
},
|
|
75217
75505
|
{
|
|
@@ -75264,6 +75552,7 @@ var init_crons = __esm({
|
|
|
75264
75552
|
init_overdue_detection();
|
|
75265
75553
|
init_payment_stat2();
|
|
75266
75554
|
init_retry_pending_events();
|
|
75555
|
+
init_tenant_fanout();
|
|
75267
75556
|
init_subscription_trial_will_end2();
|
|
75268
75557
|
init_subscription_will_canceled2();
|
|
75269
75558
|
init_subscription_will_renew2();
|
|
@@ -75283,7 +75572,7 @@ async function getPackResource(type) {
|
|
|
75283
75572
|
const resources = await (0, import_component19.getPackResources)({
|
|
75284
75573
|
types: [
|
|
75285
75574
|
{
|
|
75286
|
-
did:
|
|
75575
|
+
did: import_config9.env.componentDid,
|
|
75287
75576
|
type
|
|
75288
75577
|
}
|
|
75289
75578
|
]
|
|
@@ -75293,17 +75582,17 @@ async function getPackResource(type) {
|
|
|
75293
75582
|
}
|
|
75294
75583
|
return null;
|
|
75295
75584
|
} catch (error) {
|
|
75296
|
-
console.error(`failed to get ${type} pack resource from ${
|
|
75585
|
+
console.error(`failed to get ${type} pack resource from ${import_config9.env.componentDid}`, error);
|
|
75297
75586
|
return null;
|
|
75298
75587
|
}
|
|
75299
75588
|
}
|
|
75300
75589
|
async function getResourcesByType(type) {
|
|
75301
75590
|
try {
|
|
75302
75591
|
const pack = await getPackResource(type);
|
|
75303
|
-
const resources = await (0, import_component19.getResources)({ types: [{ did:
|
|
75592
|
+
const resources = await (0, import_component19.getResources)({ types: [{ did: import_config9.env.componentDid, type }], skipRunningCheck: true });
|
|
75304
75593
|
return pack ? [pack, ...resources] : resources;
|
|
75305
75594
|
} catch (error) {
|
|
75306
|
-
console.error(`failed to get ${type} resources from ${
|
|
75595
|
+
console.error(`failed to get ${type} resources from ${import_config9.env.componentDid}`, error);
|
|
75307
75596
|
return [];
|
|
75308
75597
|
}
|
|
75309
75598
|
}
|
|
@@ -75319,7 +75608,7 @@ async function initPaywallResources() {
|
|
|
75319
75608
|
console.info("try import paywall resource", resource);
|
|
75320
75609
|
const config4 = JSON.parse(
|
|
75321
75610
|
replace(import_fs5.default.readFileSync(import_path7.default.join(configPath, "config.json"), "utf8"), {
|
|
75322
|
-
...
|
|
75611
|
+
...import_config9.env,
|
|
75323
75612
|
monthPrice: resource.env?.MONTH_PRICE || "5",
|
|
75324
75613
|
yearPrice: resource.env?.YEAR_PRICE || "30",
|
|
75325
75614
|
passport: resource.env?.PASSPORT_NAME || "discussionSubscriber"
|
|
@@ -75509,14 +75798,14 @@ async function initPaywallResources() {
|
|
|
75509
75798
|
}
|
|
75510
75799
|
}
|
|
75511
75800
|
}
|
|
75512
|
-
var import_fs5, import_path7, import_component19,
|
|
75801
|
+
var import_fs5, import_path7, import_component19, import_config9, import_util199;
|
|
75513
75802
|
var init_resource3 = __esm({
|
|
75514
75803
|
"../../blocklets/core/api/src/libs/resource.ts"() {
|
|
75515
75804
|
"use strict";
|
|
75516
75805
|
import_fs5 = __toESM(require("fs"));
|
|
75517
75806
|
import_path7 = __toESM(require("path"));
|
|
75518
75807
|
import_component19 = require("@blocklet/sdk/lib/component");
|
|
75519
|
-
|
|
75808
|
+
import_config9 = require("@blocklet/sdk/lib/config");
|
|
75520
75809
|
import_util199 = require("@ocap/util");
|
|
75521
75810
|
init_passport();
|
|
75522
75811
|
init_locales();
|
|
@@ -75533,15 +75822,15 @@ __export(resource_exports2, {
|
|
|
75533
75822
|
initResourceHandler: () => initResourceHandler
|
|
75534
75823
|
});
|
|
75535
75824
|
function initResourceHandler() {
|
|
75536
|
-
|
|
75537
|
-
|
|
75538
|
-
|
|
75825
|
+
import_config10.events.on(import_config10.Events.componentAdded, handlePaywallResources);
|
|
75826
|
+
import_config10.events.on(import_config10.Events.componentStarted, handlePaywallResources);
|
|
75827
|
+
import_config10.events.on(import_config10.Events.envUpdate, handlePaywallResources);
|
|
75539
75828
|
}
|
|
75540
|
-
var
|
|
75829
|
+
var import_config10, handlePaywallResources;
|
|
75541
75830
|
var init_resource4 = __esm({
|
|
75542
75831
|
"../../blocklets/core/api/src/integrations/blocklet/resource.ts"() {
|
|
75543
75832
|
"use strict";
|
|
75544
|
-
|
|
75833
|
+
import_config10 = require("@blocklet/sdk/lib/config");
|
|
75545
75834
|
init_logger();
|
|
75546
75835
|
init_resource3();
|
|
75547
75836
|
handlePaywallResources = () => {
|
|
@@ -76036,16 +76325,23 @@ async function startCheckoutSessionQueue() {
|
|
|
76036
76325
|
expires_at: { [import_sequelize113.Op.lte]: now }
|
|
76037
76326
|
}
|
|
76038
76327
|
});
|
|
76039
|
-
|
|
76040
|
-
const
|
|
76041
|
-
|
|
76042
|
-
|
|
76043
|
-
|
|
76044
|
-
|
|
76045
|
-
|
|
76046
|
-
|
|
76328
|
+
for (const checkoutSession of checkoutSessions) {
|
|
76329
|
+
const dispatch = async () => {
|
|
76330
|
+
const exist = await checkoutSessionQueue.get(checkoutSession.id);
|
|
76331
|
+
if (!exist) {
|
|
76332
|
+
checkoutSessionQueue.push({
|
|
76333
|
+
id: checkoutSession.id,
|
|
76334
|
+
job: { id: checkoutSession.id, action: "expire" },
|
|
76335
|
+
runAt: checkoutSession.expires_at
|
|
76336
|
+
});
|
|
76337
|
+
}
|
|
76338
|
+
};
|
|
76339
|
+
try {
|
|
76340
|
+
await (checkoutSession.instance_did ? withTenant(checkoutSession.instance_did, dispatch) : dispatch());
|
|
76341
|
+
} catch (error) {
|
|
76342
|
+
logger_default.error("startCheckoutSessionQueue: re-queue failed", { id: checkoutSession.id, error });
|
|
76047
76343
|
}
|
|
76048
|
-
}
|
|
76344
|
+
}
|
|
76049
76345
|
}
|
|
76050
76346
|
var import_sequelize113, checkoutSessionQueue;
|
|
76051
76347
|
var init_checkout_session2 = __esm({
|
|
@@ -76056,6 +76352,7 @@ var init_checkout_session2 = __esm({
|
|
|
76056
76352
|
init_nft();
|
|
76057
76353
|
init_passport();
|
|
76058
76354
|
init_shared();
|
|
76355
|
+
init_context();
|
|
76059
76356
|
init_dayjs();
|
|
76060
76357
|
init_event2();
|
|
76061
76358
|
init_logger();
|
|
@@ -76621,6 +76918,9 @@ var init_discount_status = __esm({
|
|
|
76621
76918
|
});
|
|
76622
76919
|
|
|
76623
76920
|
// ../../blocklets/core/api/src/middlewares/hono/csrf.ts
|
|
76921
|
+
function csrfSecret() {
|
|
76922
|
+
return readConfig("PAYMENT_CSRF_SECRET") || (0, import_csrf.getCsrfSecret)();
|
|
76923
|
+
}
|
|
76624
76924
|
function csrf() {
|
|
76625
76925
|
return async (c, next) => {
|
|
76626
76926
|
const method = c.req.method.toUpperCase();
|
|
@@ -76628,7 +76928,7 @@ function csrf() {
|
|
|
76628
76928
|
const existingCsrf = (0, import_cookie.getCookie)(c, "x-csrf-token");
|
|
76629
76929
|
if (method === "GET") {
|
|
76630
76930
|
if (loginToken) {
|
|
76631
|
-
const newCsrf = (0, import_csrf.sign)((
|
|
76931
|
+
const newCsrf = (0, import_csrf.sign)(csrfSecret(), loginToken);
|
|
76632
76932
|
if (newCsrf !== existingCsrf) {
|
|
76633
76933
|
(0, import_cookie.setCookie)(c, "x-csrf-token", newCsrf, { sameSite: "Strict", secure: true });
|
|
76634
76934
|
}
|
|
@@ -76639,9 +76939,9 @@ function csrf() {
|
|
|
76639
76939
|
if (c.req.path.includes("/mcp")) return next();
|
|
76640
76940
|
if (isEmpty9(loginToken)) return next();
|
|
76641
76941
|
if (isEmpty9(existingCsrf)) return next();
|
|
76642
|
-
if ((0,
|
|
76942
|
+
if ((0, import_wallet8.isDidWalletConnect)(c.req.header())) return next();
|
|
76643
76943
|
const headerCsrf = c.req.header("x-csrf-token");
|
|
76644
|
-
if (existingCsrf === headerCsrf && (0, import_csrf.verify)((
|
|
76944
|
+
if (existingCsrf === headerCsrf && (0, import_csrf.verify)(csrfSecret(), existingCsrf, loginToken)) {
|
|
76645
76945
|
return next();
|
|
76646
76946
|
}
|
|
76647
76947
|
return c.text("Invalid request: csrf token mismatch, please refresh the page try again", 403);
|
|
@@ -76649,13 +76949,14 @@ function csrf() {
|
|
|
76649
76949
|
return next();
|
|
76650
76950
|
};
|
|
76651
76951
|
}
|
|
76652
|
-
var import_cookie, import_csrf,
|
|
76952
|
+
var import_cookie, import_csrf, import_wallet8, isEmpty9, MUTATING;
|
|
76653
76953
|
var init_csrf = __esm({
|
|
76654
76954
|
"../../blocklets/core/api/src/middlewares/hono/csrf.ts"() {
|
|
76655
76955
|
"use strict";
|
|
76656
76956
|
import_cookie = require("hono/cookie");
|
|
76657
76957
|
import_csrf = require("@blocklet/sdk/lib/util/csrf");
|
|
76658
|
-
|
|
76958
|
+
import_wallet8 = require("@blocklet/sdk/lib/util/wallet");
|
|
76959
|
+
init_env();
|
|
76659
76960
|
isEmpty9 = (v) => v === void 0 || v === null || v === "";
|
|
76660
76961
|
MUTATING = ["POST", "PUT", "PATCH", "DELETE"];
|
|
76661
76962
|
}
|
|
@@ -76680,8 +76981,8 @@ function cdn() {
|
|
|
76680
76981
|
let transformer;
|
|
76681
76982
|
return async (c, next) => {
|
|
76682
76983
|
await next();
|
|
76683
|
-
const assetHost =
|
|
76684
|
-
const did =
|
|
76984
|
+
const assetHost = import_config11.env.assetCdnHost;
|
|
76985
|
+
const did = import_config11.env.componentDid;
|
|
76685
76986
|
if (!assetHost || !did) return;
|
|
76686
76987
|
if (!shouldProcess(c.req.method.toUpperCase(), c.req.path, c.req.header("accept") || "")) return;
|
|
76687
76988
|
const contentType = c.res.headers.get("content-type") || "";
|
|
@@ -76694,12 +76995,12 @@ function cdn() {
|
|
|
76694
76995
|
c.res = rebuilt;
|
|
76695
76996
|
};
|
|
76696
76997
|
}
|
|
76697
|
-
var import_asset_host_transformer,
|
|
76998
|
+
var import_asset_host_transformer, import_config11, import_constant2, import_constant3;
|
|
76698
76999
|
var init_cdn = __esm({
|
|
76699
77000
|
"../../blocklets/core/api/src/middlewares/hono/cdn.ts"() {
|
|
76700
77001
|
"use strict";
|
|
76701
77002
|
import_asset_host_transformer = require("@blocklet/sdk/lib/util/asset-host-transformer");
|
|
76702
|
-
|
|
77003
|
+
import_config11 = require("@blocklet/sdk/lib/config");
|
|
76703
77004
|
import_constant2 = require("@abtnode/constant");
|
|
76704
77005
|
import_constant3 = require("@blocklet/constant");
|
|
76705
77006
|
init_env();
|
|
@@ -76745,6 +77046,7 @@ function contextMiddleware() {
|
|
|
76745
77046
|
throw err;
|
|
76746
77047
|
}
|
|
76747
77048
|
return context.run({ requestId, requestedBy, instanceDid }, async () => {
|
|
77049
|
+
await warmTenantIdentity(instanceDid);
|
|
76748
77050
|
await next();
|
|
76749
77051
|
});
|
|
76750
77052
|
};
|
|
@@ -76758,6 +77060,7 @@ var init_context2 = __esm({
|
|
|
76758
77060
|
init_context();
|
|
76759
77061
|
init_tenant();
|
|
76760
77062
|
init_identity();
|
|
77063
|
+
init_tenant_identity();
|
|
76761
77064
|
}
|
|
76762
77065
|
});
|
|
76763
77066
|
|
|
@@ -76821,7 +77124,9 @@ function createFetchHandler(app42) {
|
|
|
76821
77124
|
const method = request.method.toUpperCase();
|
|
76822
77125
|
const hasBody = method !== "GET" && method !== "HEAD";
|
|
76823
77126
|
const body = hasBody ? await request.arrayBuffer() : void 0;
|
|
76824
|
-
|
|
77127
|
+
const headers = new Headers(request.headers);
|
|
77128
|
+
if (!headers.has("x-path-prefix")) headers.set("x-path-prefix", basePath);
|
|
77129
|
+
return app42.fetch(new Request(url.toString(), { method, headers, body }));
|
|
76825
77130
|
}
|
|
76826
77131
|
return app42.fetch(request);
|
|
76827
77132
|
});
|
|
@@ -76872,10 +77177,17 @@ function connectHandlerModules() {
|
|
|
76872
77177
|
function buildConnectRoutesHono() {
|
|
76873
77178
|
const { handlers: handlers2 } = (init_auth(), __toCommonJS(auth_exports));
|
|
76874
77179
|
const connectApp = new import_hono42.Hono();
|
|
77180
|
+
connectApp.use("*", async (c, next) => {
|
|
77181
|
+
const { context: requestCtx } = (init_context(), __toCommonJS(context_exports));
|
|
77182
|
+
if (requestCtx.peekInstanceDid()) return next();
|
|
77183
|
+
const { resolveTenantForHost: resolveTenantForHost2 } = (init_identity(), __toCommonJS(identity_exports));
|
|
77184
|
+
const instanceDid = await resolveTenantForHost2(c.req.header("host"));
|
|
77185
|
+
return requestCtx.withTenant(instanceDid, () => next());
|
|
77186
|
+
});
|
|
76875
77187
|
for (const h of connectHandlerModules()) handlers2.attach(Object.assign({ app: connectApp }, h));
|
|
76876
77188
|
return connectApp;
|
|
76877
77189
|
}
|
|
76878
|
-
function buildHonoApp(configureNative, getConnectApp) {
|
|
77190
|
+
function buildHonoApp(configureNative, getConnectApp, attachStatic) {
|
|
76879
77191
|
const app42 = new import_hono42.Hono();
|
|
76880
77192
|
app42.onError((err, c) => {
|
|
76881
77193
|
logger_default.error("handle router error", err);
|
|
@@ -76891,14 +77203,7 @@ function buildHonoApp(configureNative, getConnectApp) {
|
|
|
76891
77203
|
if (getConnectApp) {
|
|
76892
77204
|
app42.route("/", getConnectApp());
|
|
76893
77205
|
}
|
|
76894
|
-
|
|
76895
|
-
const { serveStatic } = require("@hono/node-server/serve-static");
|
|
76896
|
-
const { fallback: fallback2 } = (init_fallback(), __toCommonJS(fallback_exports));
|
|
76897
|
-
const staticDir = import_path8.default.resolve(blockletAppDir(), "dist");
|
|
76898
|
-
const staticRoot = import_path8.default.relative(process.cwd(), staticDir) || ".";
|
|
76899
|
-
app42.use("*", fallback2("index.html", { root: staticDir }));
|
|
76900
|
-
app42.use("*", serveStatic({ root: staticRoot }));
|
|
76901
|
-
}
|
|
77206
|
+
attachStatic?.(app42);
|
|
76902
77207
|
return app42;
|
|
76903
77208
|
}
|
|
76904
77209
|
function requireTenant() {
|
|
@@ -76942,7 +77247,9 @@ async function bootstrapTenant(instanceDid) {
|
|
|
76942
77247
|
const { ensureWebhookRegistered: ensureWebhookRegistered2 } = (init_setup(), __toCommonJS(setup_exports));
|
|
76943
77248
|
const { ensureCreateOverdraftProtectionPrices: ensureCreateOverdraftProtectionPrices2 } = (init_overdraft_protection(), __toCommonJS(overdraft_protection_exports));
|
|
76944
77249
|
const { scheduleHealthChecks: scheduleHealthChecks2 } = (init_exchange_rate_health(), __toCommonJS(exchange_rate_health_exports));
|
|
77250
|
+
const { warmTenantIdentity: warmTenantIdentity2 } = (init_tenant_identity(), __toCommonJS(tenant_identity_exports));
|
|
76945
77251
|
await context.withTenant(instanceDid, async () => {
|
|
77252
|
+
await warmTenantIdentity2(instanceDid);
|
|
76946
77253
|
await Promise.resolve(syncCurrencyLogo2()).catch(
|
|
76947
77254
|
(error) => logger_default.error("bootstrapTenant: syncCurrencyLogo failed", { instanceDid, error })
|
|
76948
77255
|
);
|
|
@@ -76960,6 +77267,65 @@ async function bootstrapTenant(instanceDid) {
|
|
|
76960
77267
|
);
|
|
76961
77268
|
});
|
|
76962
77269
|
}
|
|
77270
|
+
async function provisionTenant(instanceDid) {
|
|
77271
|
+
if (!instanceDid || typeof instanceDid !== "string") {
|
|
77272
|
+
throw new TenantError(TENANT_CONTEXT_MISSING, "provisionTenant requires an instanceDid");
|
|
77273
|
+
}
|
|
77274
|
+
const { fromTokenToUnit: fromTokenToUnit31 } = require("@ocap/util");
|
|
77275
|
+
const { PaymentMethod: PaymentMethod3, PaymentCurrency: PaymentCurrency3 } = (init_models(), __toCommonJS(models_exports));
|
|
77276
|
+
const CHAINS = [
|
|
77277
|
+
{ chainId: "main", livemode: true, symbol: "ABT", label: "ArcBlock Main", contract: "z35nNRvYxBoHitx9yZ5ATS88psfShzPPBLxYD" },
|
|
77278
|
+
{ chainId: "beta", livemode: false, symbol: "TBA", label: "ArcBlock Beta", contract: "z35n6UoHSi9MED4uaQy6ozFgKPaZj2UKrurBG" }
|
|
77279
|
+
];
|
|
77280
|
+
await context.withTenant(instanceDid, async () => {
|
|
77281
|
+
const existing = await PaymentMethod3.findOne({ where: { type: "arcblock" } });
|
|
77282
|
+
if (existing) return;
|
|
77283
|
+
for (const chain of CHAINS) {
|
|
77284
|
+
const logo = "/methods/arcblock.png";
|
|
77285
|
+
const method = await PaymentMethod3.create({
|
|
77286
|
+
instance_did: instanceDid,
|
|
77287
|
+
active: true,
|
|
77288
|
+
livemode: chain.livemode,
|
|
77289
|
+
locked: true,
|
|
77290
|
+
type: "arcblock",
|
|
77291
|
+
name: chain.label,
|
|
77292
|
+
description: `Process payments with tokens on ArcBlock ${chain.chainId} chain`,
|
|
77293
|
+
logo,
|
|
77294
|
+
confirmation: { type: "immediate" },
|
|
77295
|
+
settings: {
|
|
77296
|
+
arcblock: {
|
|
77297
|
+
chain_id: chain.chainId,
|
|
77298
|
+
api_host: `https://${chain.chainId}.abtnetwork.io/api/`,
|
|
77299
|
+
explorer_host: `https://${chain.chainId}.abtnetwork.io/explorer/`
|
|
77300
|
+
}
|
|
77301
|
+
},
|
|
77302
|
+
features: { recurring: true, refund: true, dispute: false },
|
|
77303
|
+
metadata: {}
|
|
77304
|
+
});
|
|
77305
|
+
const currency = await PaymentCurrency3.create({
|
|
77306
|
+
instance_did: instanceDid,
|
|
77307
|
+
active: true,
|
|
77308
|
+
livemode: chain.livemode,
|
|
77309
|
+
locked: true,
|
|
77310
|
+
is_base_currency: true,
|
|
77311
|
+
payment_method_id: method.id,
|
|
77312
|
+
type: "standard",
|
|
77313
|
+
name: chain.symbol,
|
|
77314
|
+
description: chain.symbol,
|
|
77315
|
+
logo,
|
|
77316
|
+
symbol: chain.symbol,
|
|
77317
|
+
decimal: 18,
|
|
77318
|
+
minimum_payment_amount: fromTokenToUnit31(0.1, 18).toString(),
|
|
77319
|
+
maximum_precision: 6,
|
|
77320
|
+
maximum_payment_amount: fromTokenToUnit31(1e8, 18).toString(),
|
|
77321
|
+
contract: chain.contract,
|
|
77322
|
+
metadata: {}
|
|
77323
|
+
});
|
|
77324
|
+
await method.update({ default_currency_id: currency.id });
|
|
77325
|
+
}
|
|
77326
|
+
logger_default.info("provisionTenant: seeded arcblock payment methods + currencies", { instanceDid });
|
|
77327
|
+
});
|
|
77328
|
+
}
|
|
76963
77329
|
async function startBackgroundServices() {
|
|
76964
77330
|
if (servicesStarted) {
|
|
76965
77331
|
logger_default.info("payment core background services already started, skipping");
|
|
@@ -77059,6 +77425,8 @@ function createEmbeddedPaymentService(slots) {
|
|
|
77059
77425
|
throw new MissingConfigError("BLOCKLET_APP_PID");
|
|
77060
77426
|
}
|
|
77061
77427
|
const { initialize: initialize2 } = (init_models(), __toCommonJS(models_exports));
|
|
77428
|
+
const { setDefaultSequelize: setDefaultSequelize2 } = (init_sequelize(), __toCommonJS(sequelize_exports));
|
|
77429
|
+
setDefaultSequelize2(slots.db.sequelize);
|
|
77062
77430
|
initialize2(slots.db.sequelize);
|
|
77063
77431
|
if (slots.locks) {
|
|
77064
77432
|
const { setLocksDriver: setLocksDriver2 } = (init_lock(), __toCommonJS(lock_exports));
|
|
@@ -77068,6 +77436,11 @@ function createEmbeddedPaymentService(slots) {
|
|
|
77068
77436
|
if (slots.queue) setQueueHostHooks3(slots.queue);
|
|
77069
77437
|
if (slots.cron) setCronDriver3(slots.cron);
|
|
77070
77438
|
if (slots.secrets) setSecretsDriver3(slots.secrets);
|
|
77439
|
+
if (slots.didConnectRuntime || slots.storage) {
|
|
77440
|
+
const { setDidConnectRuntime: setDidConnectRuntime2, setDidConnectTokenStorage: setDidConnectTokenStorage2 } = (init_auth(), __toCommonJS(auth_exports));
|
|
77441
|
+
if (slots.didConnectRuntime) setDidConnectRuntime2(slots.didConnectRuntime);
|
|
77442
|
+
if (slots.storage) setDidConnectTokenStorage2(slots.storage);
|
|
77443
|
+
}
|
|
77071
77444
|
if (slots.identity) setIdentityDriver3(slots.identity);
|
|
77072
77445
|
if (slots.tenancy && slots.tenancy.mode === "single" && slots.tenancy.instanceDid) {
|
|
77073
77446
|
const { setDefaultInstanceDid: setDefaultInstanceDid2 } = (init_tenant(), __toCommonJS(tenant_exports));
|
|
@@ -77086,10 +77459,15 @@ function createEmbeddedPaymentService(slots) {
|
|
|
77086
77459
|
const getHonoApp = memo(() => {
|
|
77087
77460
|
const { configureNativePipeline: configureNativePipeline2, fullPipeline: fullPipeline2 } = (init_pipeline(), __toCommonJS(pipeline_exports));
|
|
77088
77461
|
const { mountMigratedResources: mountMigratedResources2 } = (init_hono(), __toCommonJS(hono_exports));
|
|
77089
|
-
return buildHonoApp(
|
|
77090
|
-
|
|
77091
|
-
|
|
77092
|
-
|
|
77462
|
+
return buildHonoApp(
|
|
77463
|
+
(native) => {
|
|
77464
|
+
configureNativePipeline2(native);
|
|
77465
|
+
mountMigratedResources2(native, { appShell: fullPipeline2() });
|
|
77466
|
+
},
|
|
77467
|
+
getConnectRoutesHono,
|
|
77468
|
+
// S3-CF Phase 1 ①: host-provided static/SPA shell (node injects it; CF omits).
|
|
77469
|
+
slots.staticHandler
|
|
77470
|
+
);
|
|
77093
77471
|
});
|
|
77094
77472
|
let fetchHandler = null;
|
|
77095
77473
|
const getFetchHandler = () => {
|
|
@@ -77130,14 +77508,14 @@ function createEmbeddedPaymentService(slots) {
|
|
|
77130
77508
|
},
|
|
77131
77509
|
rpc,
|
|
77132
77510
|
lifecycle,
|
|
77133
|
-
bootstrapTenant
|
|
77511
|
+
bootstrapTenant,
|
|
77512
|
+
provisionTenant
|
|
77134
77513
|
};
|
|
77135
77514
|
}
|
|
77136
|
-
var
|
|
77515
|
+
var import_error12, import_hono42, PaymentCoreSlotError, MissingConfigError, TenancySlotError, VALID_TENANT_MODES, servicesStarted, listInstanceDidsHook;
|
|
77137
77516
|
var init_service2 = __esm({
|
|
77138
77517
|
"../../blocklets/core/api/src/service.ts"() {
|
|
77139
77518
|
"use strict";
|
|
77140
|
-
import_path8 = __toESM(require("path"));
|
|
77141
77519
|
import_error12 = require("@blocklet/error");
|
|
77142
77520
|
import_hono42 = require("hono");
|
|
77143
77521
|
init_env();
|
|
@@ -77183,10 +77561,13 @@ __export(src_exports, {
|
|
|
77183
77561
|
createD1LocksDriver: () => createD1LocksDriver2,
|
|
77184
77562
|
createDefaultIdentityDriver: () => createDefaultIdentityDriver2,
|
|
77185
77563
|
createDefaultSecretsDriver: () => createDefaultSecretsDriver2,
|
|
77564
|
+
createEmbeddedIdentityServices: () => createEmbeddedIdentityServices2,
|
|
77186
77565
|
createEmbeddedPaymentService: () => createEmbeddedPaymentService2,
|
|
77187
77566
|
createKeyringSecretsDriver: () => createKeyringSecretsDriver2,
|
|
77188
77567
|
createMemoryLocksDriver: () => createMemoryLocksDriver2,
|
|
77189
77568
|
createNodeDbDriver: () => createNodeDbDriver2,
|
|
77569
|
+
createNodeDidConnectRuntime: () => createNodeDidConnectRuntime2,
|
|
77570
|
+
createNodeStaticHandler: () => createNodeStaticHandler2,
|
|
77190
77571
|
getCronDriver: () => getCronDriver2,
|
|
77191
77572
|
getIdentityDriver: () => getIdentityDriver2,
|
|
77192
77573
|
getPaymentCoreSqlMigrations: () => getPaymentCoreSqlMigrations,
|
|
@@ -77282,6 +77663,18 @@ function shouldRunInWindow2(expr, date) {
|
|
|
77282
77663
|
}
|
|
77283
77664
|
|
|
77284
77665
|
// src/index.ts
|
|
77666
|
+
function createNodeStaticHandler2(webRoot) {
|
|
77667
|
+
const mod = (init_serve_static_arc(), __toCommonJS(serve_static_arc_exports));
|
|
77668
|
+
return mod.createNodeStaticHandler(webRoot);
|
|
77669
|
+
}
|
|
77670
|
+
function createNodeDidConnectRuntime2(opts) {
|
|
77671
|
+
const mod = (init_did_connect_runtime_node(), __toCommonJS(did_connect_runtime_node_exports));
|
|
77672
|
+
return mod.createNodeDidConnectRuntime(opts);
|
|
77673
|
+
}
|
|
77674
|
+
function createEmbeddedIdentityServices2() {
|
|
77675
|
+
const mod = (init_tenant_identity(), __toCommonJS(tenant_identity_exports));
|
|
77676
|
+
return mod.createEmbeddedIdentityServices();
|
|
77677
|
+
}
|
|
77285
77678
|
function createEmbeddedPaymentService2(slots) {
|
|
77286
77679
|
const core = (init_service2(), __toCommonJS(service_exports));
|
|
77287
77680
|
return core.createEmbeddedPaymentService(slots);
|
|
@@ -77296,10 +77689,13 @@ function createEmbeddedPaymentService2(slots) {
|
|
|
77296
77689
|
createD1LocksDriver,
|
|
77297
77690
|
createDefaultIdentityDriver,
|
|
77298
77691
|
createDefaultSecretsDriver,
|
|
77692
|
+
createEmbeddedIdentityServices,
|
|
77299
77693
|
createEmbeddedPaymentService,
|
|
77300
77694
|
createKeyringSecretsDriver,
|
|
77301
77695
|
createMemoryLocksDriver,
|
|
77302
77696
|
createNodeDbDriver,
|
|
77697
|
+
createNodeDidConnectRuntime,
|
|
77698
|
+
createNodeStaticHandler,
|
|
77303
77699
|
getCronDriver,
|
|
77304
77700
|
getIdentityDriver,
|
|
77305
77701
|
getPaymentCoreSqlMigrations,
|