@seedprotocol/publish 0.6.9 → 0.6.10
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/CHANGELOG.md +11 -0
- package/README.md +1 -1
- package/dist/{chainConfig-CA1Hrrjg.js → chainConfig-DWzoOtkS.js} +394 -328
- package/dist/chainConfig-DWzoOtkS.js.map +1 -0
- package/dist/config.d.ts +5 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/ensureAutomationSessionKey-h3zOmDr5.js +84 -0
- package/dist/ensureAutomationSessionKey-h3zOmDr5.js.map +1 -0
- package/dist/{ensureModularPublishBootstrap-DGBKVGg5.js → ensureModularPublishBootstrap-BImiIFJe.js} +9 -10
- package/dist/{ensureModularPublishBootstrap-5HJDqJJM.js.map → ensureModularPublishBootstrap-BImiIFJe.js.map} +1 -1
- package/dist/{ensureSmartWalletThenPublish-Bm58tc-b.js → ensureSmartWalletThenPublish-DuOYPJFd.js} +9 -10
- package/dist/{ensureSmartWalletThenPublish-Bm58tc-b.js.map → ensureSmartWalletThenPublish-DuOYPJFd.js.map} +1 -1
- package/dist/errors.d.ts +9 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/helpers/abi/executor.d.ts +12 -0
- package/dist/helpers/abi/executor.d.ts.map +1 -1
- package/dist/helpers/abi/factory.d.ts +11 -0
- package/dist/helpers/abi/factory.d.ts.map +1 -1
- package/dist/helpers/abi/seedExecutorRouter.d.ts +9 -1
- package/dist/helpers/abi/seedExecutorRouter.d.ts.map +1 -1
- package/dist/helpers/adapters/thirdwebAccount.d.ts.map +1 -1
- package/dist/helpers/chainClient.d.ts +18 -2
- package/dist/helpers/chainClient.d.ts.map +1 -1
- package/dist/helpers/contracts/index.d.ts +9 -0
- package/dist/helpers/contracts/index.d.ts.map +1 -1
- package/dist/helpers/describeRevert.d.ts +3 -2
- package/dist/helpers/describeRevert.d.ts.map +1 -1
- package/dist/helpers/enrollPublishAutomation.d.ts +2 -2
- package/dist/helpers/enrollPublishAutomation.d.ts.map +1 -1
- package/dist/helpers/ensureAutomationSessionKey.d.ts.map +1 -1
- package/dist/helpers/ensureExecutorModule.d.ts +28 -5
- package/dist/helpers/ensureExecutorModule.d.ts.map +1 -1
- package/dist/helpers/executorModuleReadiness.d.ts +15 -1
- package/dist/helpers/executorModuleReadiness.d.ts.map +1 -1
- package/dist/helpers/gasLog.d.ts +8 -0
- package/dist/helpers/gasLog.d.ts.map +1 -0
- package/dist/helpers/seedPaymaster.d.ts +27 -0
- package/dist/helpers/seedPaymaster.d.ts.map +1 -0
- package/dist/helpers/thirdweb.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +271 -272
- package/dist/index.js.map +1 -1
- package/dist/{managedAccountAdmin-B64V1rlU.js → managedAccountAdmin-B4HkLWWE.js} +9 -10
- package/dist/{managedAccountAdmin-B64V1rlU.js.map → managedAccountAdmin-B4HkLWWE.js.map} +1 -1
- package/dist/{publishAuthorization-CxBkijU6.js → publishAuthorization-DgDI4zor.js} +1104 -1018
- package/dist/publishAuthorization-DgDI4zor.js.map +1 -0
- package/dist/{publishThirdwebClient-CBD9sKJR.js → publishThirdwebClient-CO18ST7C.js} +2 -2
- package/dist/{publishThirdwebClient-CBD9sKJR.js.map → publishThirdwebClient-CO18ST7C.js.map} +1 -1
- package/dist/{resolveRevokeAccount-CehU81k6.js → resolveRevokeAccount-DsNod8ti.js} +11 -11
- package/dist/{resolveRevokeAccount-B5iXpuRT.js.map → resolveRevokeAccount-DsNod8ti.js.map} +1 -1
- package/dist/thirdweb.d.ts +2 -1
- package/dist/thirdweb.d.ts.map +1 -1
- package/dist/thirdweb.js +147 -148
- package/dist/thirdweb.js.map +1 -1
- package/dist/{worker-2dUZSapK.js → worker-CN7zg73B.js} +2 -2
- package/dist/{worker-2dUZSapK.js.map → worker-CN7zg73B.js.map} +1 -1
- package/package.json +6 -6
- package/dist/chainConfig-3sSqEVQh.js +0 -1433
- package/dist/chainConfig-3sSqEVQh.js.map +0 -1
- package/dist/chainConfig-3wlYarAG.js +0 -1433
- package/dist/chainConfig-3wlYarAG.js.map +0 -1
- package/dist/chainConfig-BRcsMopd.js +0 -1442
- package/dist/chainConfig-BRcsMopd.js.map +0 -1
- package/dist/chainConfig-BYm5OXpk.js +0 -1433
- package/dist/chainConfig-BYm5OXpk.js.map +0 -1
- package/dist/chainConfig-CA1Hrrjg.js.map +0 -1
- package/dist/chainConfig-CYy0XJ0M.js +0 -1283
- package/dist/chainConfig-CYy0XJ0M.js.map +0 -1
- package/dist/chainConfig-CfVGYAsY.js +0 -1311
- package/dist/chainConfig-CfVGYAsY.js.map +0 -1
- package/dist/chainConfig-DDA4YmAB.js +0 -1424
- package/dist/chainConfig-DDA4YmAB.js.map +0 -1
- package/dist/config-BA9la8B6.js +0 -941
- package/dist/config-BA9la8B6.js.map +0 -1
- package/dist/config-BqguD2Tt.js +0 -806
- package/dist/config-BqguD2Tt.js.map +0 -1
- package/dist/config-CPBd5C_b.js +0 -1201
- package/dist/config-CPBd5C_b.js.map +0 -1
- package/dist/config-DkIapO94.js +0 -955
- package/dist/config-DkIapO94.js.map +0 -1
- package/dist/config-EQZZNH9H.js +0 -955
- package/dist/config-EQZZNH9H.js.map +0 -1
- package/dist/config-qjpaJcBA.js +0 -947
- package/dist/config-qjpaJcBA.js.map +0 -1
- package/dist/deploy-BJYwLfz-.js +0 -15
- package/dist/deploy-BJYwLfz-.js.map +0 -1
- package/dist/enrollPublishAutomation-DYQMoylY.js +0 -3422
- package/dist/enrollPublishAutomation-DYQMoylY.js.map +0 -1
- package/dist/ensureAutomationSessionKey-BMHLKfjj.js +0 -85
- package/dist/ensureAutomationSessionKey-BMHLKfjj.js.map +0 -1
- package/dist/ensureAutomationSessionKey-BZ9_3FMW.js +0 -86
- package/dist/ensureAutomationSessionKey-BZ9_3FMW.js.map +0 -1
- package/dist/ensureAutomationSessionKey-Bq0PaTYE.js +0 -84
- package/dist/ensureAutomationSessionKey-Bq0PaTYE.js.map +0 -1
- package/dist/ensureAutomationSessionKey-Bw74ZSGI.js +0 -85
- package/dist/ensureAutomationSessionKey-Bw74ZSGI.js.map +0 -1
- package/dist/ensureAutomationSessionKey-C8D7BFjU.js +0 -85
- package/dist/ensureAutomationSessionKey-C8D7BFjU.js.map +0 -1
- package/dist/ensureAutomationSessionKey-CClLVX2w.js +0 -85
- package/dist/ensureAutomationSessionKey-CClLVX2w.js.map +0 -1
- package/dist/ensureAutomationSessionKey-CNNN1jBQ.js +0 -85
- package/dist/ensureAutomationSessionKey-CNNN1jBQ.js.map +0 -1
- package/dist/ensureAutomationSessionKey-CeUbjcCl.js +0 -85
- package/dist/ensureAutomationSessionKey-CeUbjcCl.js.map +0 -1
- package/dist/ensureAutomationSessionKey-D8Gki6U6.js +0 -85
- package/dist/ensureAutomationSessionKey-D8Gki6U6.js.map +0 -1
- package/dist/ensureAutomationSessionKey-DEH7nwUc.js +0 -86
- package/dist/ensureAutomationSessionKey-DEH7nwUc.js.map +0 -1
- package/dist/ensureAutomationSessionKey-DKriW4Hr.js +0 -85
- package/dist/ensureAutomationSessionKey-DKriW4Hr.js.map +0 -1
- package/dist/ensureAutomationSessionKey-Dhvbii2M.js +0 -86
- package/dist/ensureAutomationSessionKey-Dhvbii2M.js.map +0 -1
- package/dist/ensureAutomationSessionKey-Dyfk8qVp.js +0 -85
- package/dist/ensureAutomationSessionKey-Dyfk8qVp.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-5HJDqJJM.js +0 -24
- package/dist/ensureModularPublishBootstrap-BW8jKN_A.js +0 -24
- package/dist/ensureModularPublishBootstrap-BW8jKN_A.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-BhYNmLzT.js +0 -24
- package/dist/ensureModularPublishBootstrap-BhYNmLzT.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-Bsw1xSCt.js +0 -24
- package/dist/ensureModularPublishBootstrap-Bsw1xSCt.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-Btih5xbB.js +0 -129
- package/dist/ensureModularPublishBootstrap-Btih5xbB.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-C8wdnH1P.js +0 -128
- package/dist/ensureModularPublishBootstrap-C8wdnH1P.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-CI4U08Gc.js +0 -129
- package/dist/ensureModularPublishBootstrap-CI4U08Gc.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-CcU-hXll.js +0 -128
- package/dist/ensureModularPublishBootstrap-CcU-hXll.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-CdrykHAi.js +0 -24
- package/dist/ensureModularPublishBootstrap-CdrykHAi.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-DGBKVGg5.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-DaREOqSc.js +0 -129
- package/dist/ensureModularPublishBootstrap-DaREOqSc.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-DxIG-LUP.js +0 -24
- package/dist/ensureModularPublishBootstrap-DxIG-LUP.js.map +0 -1
- package/dist/ensureModularPublishBootstrap-Jm1AAqBo.js +0 -127
- package/dist/ensureModularPublishBootstrap-Jm1AAqBo.js.map +0 -1
- package/dist/ensureSessionKey-D2Lq-56x.js +0 -363
- package/dist/ensureSessionKey-D2Lq-56x.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-BFPugsKJ.js +0 -48
- package/dist/ensureSmartWalletThenPublish-BFPugsKJ.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-BSYzckyS.js +0 -49
- package/dist/ensureSmartWalletThenPublish-BSYzckyS.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-Bf8FN1un.js +0 -49
- package/dist/ensureSmartWalletThenPublish-Bf8FN1un.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-Bl415Ss6.js +0 -48
- package/dist/ensureSmartWalletThenPublish-Bl415Ss6.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-Bmm5Fpat.js +0 -49
- package/dist/ensureSmartWalletThenPublish-Bmm5Fpat.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-CE7acryB.js +0 -49
- package/dist/ensureSmartWalletThenPublish-CE7acryB.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-D5GSZRyZ.js +0 -48
- package/dist/ensureSmartWalletThenPublish-D5GSZRyZ.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-DAomriGc.js +0 -48
- package/dist/ensureSmartWalletThenPublish-DAomriGc.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-DaZf3q5S.js +0 -48
- package/dist/ensureSmartWalletThenPublish-DaZf3q5S.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-Dta2AOyJ.js +0 -48
- package/dist/ensureSmartWalletThenPublish-Dta2AOyJ.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-ekb0xJRn.js +0 -48
- package/dist/ensureSmartWalletThenPublish-ekb0xJRn.js.map +0 -1
- package/dist/ensureSmartWalletThenPublish-v5fhvKxZ.js +0 -48
- package/dist/ensureSmartWalletThenPublish-v5fhvKxZ.js.map +0 -1
- package/dist/errors-Du3LNbJN.js +0 -70
- package/dist/errors-Du3LNbJN.js.map +0 -1
- package/dist/errors-PZAaDlkq.js +0 -79
- package/dist/errors-PZAaDlkq.js.map +0 -1
- package/dist/helpers/adapters/managedAccountTxSender.d.ts +0 -21
- package/dist/helpers/adapters/managedAccountTxSender.d.ts.map +0 -1
- package/dist/helpers/modularAccount/abi.d.ts +0 -173
- package/dist/helpers/modularAccount/abi.d.ts.map +0 -1
- package/dist/helpers/modularAccount/deploy.d.ts +0 -13
- package/dist/helpers/modularAccount/deploy.d.ts.map +0 -1
- package/dist/helpers/modularAccount/eip712.d.ts +0 -30
- package/dist/helpers/modularAccount/eip712.d.ts.map +0 -1
- package/dist/helpers/modularAccount/encode.d.ts +0 -16
- package/dist/helpers/modularAccount/encode.d.ts.map +0 -1
- package/dist/helpers/modularAccount/ensureModule.d.ts +0 -10
- package/dist/helpers/modularAccount/ensureModule.d.ts.map +0 -1
- package/dist/helpers/modularAccount/ensureSessionKey.d.ts +0 -25
- package/dist/helpers/modularAccount/ensureSessionKey.d.ts.map +0 -1
- package/dist/helpers/modularAccount/index.d.ts +0 -9
- package/dist/helpers/modularAccount/index.d.ts.map +0 -1
- package/dist/helpers/modularAccount/permissions.d.ts +0 -32
- package/dist/helpers/modularAccount/permissions.d.ts.map +0 -1
- package/dist/helpers/modularAccount/reads.d.ts +0 -28
- package/dist/helpers/modularAccount/reads.d.ts.map +0 -1
- package/dist/helpers/thirdwebEnrollPublishAutomation.d.ts +0 -31
- package/dist/helpers/thirdwebEnrollPublishAutomation.d.ts.map +0 -1
- package/dist/helpers/thirdwebModularBootstrap.d.ts +0 -8
- package/dist/helpers/thirdwebModularBootstrap.d.ts.map +0 -1
- package/dist/helpers/transformPayloadToIntegerIds.d.ts +0 -34
- package/dist/helpers/transformPayloadToIntegerIds.d.ts.map +0 -1
- package/dist/managedAccountAdmin-BVLGWpEb.js +0 -29
- package/dist/managedAccountAdmin-BVLGWpEb.js.map +0 -1
- package/dist/managedAccountAdmin-Bje6X8Ds.js +0 -29
- package/dist/managedAccountAdmin-Bje6X8Ds.js.map +0 -1
- package/dist/managedAccountAdmin-C84-IlQ9.js +0 -29
- package/dist/managedAccountAdmin-C84-IlQ9.js.map +0 -1
- package/dist/managedAccountAdmin-DJMw6UH6.js +0 -29
- package/dist/managedAccountAdmin-DJMw6UH6.js.map +0 -1
- package/dist/managedAccountAdmin-DhCRBoPX.js +0 -29
- package/dist/managedAccountAdmin-DhCRBoPX.js.map +0 -1
- package/dist/managedAccountAdmin-NXD66lP5.js +0 -29
- package/dist/managedAccountAdmin-NXD66lP5.js.map +0 -1
- package/dist/publishAuthorization-B0G1em4a.js +0 -3695
- package/dist/publishAuthorization-B0G1em4a.js.map +0 -1
- package/dist/publishAuthorization-B1BVVfp0.js +0 -3604
- package/dist/publishAuthorization-B1BVVfp0.js.map +0 -1
- package/dist/publishAuthorization-BEqRnP2h.js +0 -3925
- package/dist/publishAuthorization-BEqRnP2h.js.map +0 -1
- package/dist/publishAuthorization-Bltn3y_K.js +0 -3599
- package/dist/publishAuthorization-Bltn3y_K.js.map +0 -1
- package/dist/publishAuthorization-By2Tt9kW.js +0 -3912
- package/dist/publishAuthorization-By2Tt9kW.js.map +0 -1
- package/dist/publishAuthorization-CSN2FsQk.js +0 -3479
- package/dist/publishAuthorization-CSN2FsQk.js.map +0 -1
- package/dist/publishAuthorization-CxBkijU6.js.map +0 -1
- package/dist/publishAuthorization-CxWY7lAQ.js +0 -3706
- package/dist/publishAuthorization-CxWY7lAQ.js.map +0 -1
- package/dist/publishAuthorization-DEriY_jm.js +0 -3687
- package/dist/publishAuthorization-DEriY_jm.js.map +0 -1
- package/dist/publishAuthorization-DfAQs1sN.js +0 -3707
- package/dist/publishAuthorization-DfAQs1sN.js.map +0 -1
- package/dist/publishAuthorization-DgdmgLTa.js +0 -3520
- package/dist/publishAuthorization-DgdmgLTa.js.map +0 -1
- package/dist/publishAuthorization-DjVrnMC0.js +0 -3925
- package/dist/publishAuthorization-DjVrnMC0.js.map +0 -1
- package/dist/publishAuthorization-DqhhCAhd.js +0 -3652
- package/dist/publishAuthorization-DqhhCAhd.js.map +0 -1
- package/dist/publishThirdwebClient-BdgkcqM7.js +0 -18
- package/dist/publishThirdwebClient-BdgkcqM7.js.map +0 -1
- package/dist/publishThirdwebClient-BkmDN480.js +0 -18
- package/dist/publishThirdwebClient-BkmDN480.js.map +0 -1
- package/dist/publishThirdwebClient-BnDhP3N-.js +0 -18
- package/dist/publishThirdwebClient-BnDhP3N-.js.map +0 -1
- package/dist/publishThirdwebClient-CQ29pzG2.js +0 -18
- package/dist/publishThirdwebClient-CQ29pzG2.js.map +0 -1
- package/dist/publishThirdwebClient-CZIVmr9Z.js +0 -18
- package/dist/publishThirdwebClient-CZIVmr9Z.js.map +0 -1
- package/dist/publishThirdwebClient-Ce7iBIsj.js +0 -18
- package/dist/publishThirdwebClient-Ce7iBIsj.js.map +0 -1
- package/dist/publishThirdwebClient-DroRrOFQ.js +0 -18
- package/dist/publishThirdwebClient-DroRrOFQ.js.map +0 -1
- package/dist/publishThirdwebClient-DzXFjQ7L.js +0 -18
- package/dist/publishThirdwebClient-DzXFjQ7L.js.map +0 -1
- package/dist/publishThirdwebClient-Dzb2vcEs.js +0 -18
- package/dist/publishThirdwebClient-Dzb2vcEs.js.map +0 -1
- package/dist/publishThirdwebClient-i8P7fivi.js +0 -18
- package/dist/publishThirdwebClient-i8P7fivi.js.map +0 -1
- package/dist/publishWalletRegistry-Cugh691z.js +0 -37
- package/dist/publishWalletRegistry-Cugh691z.js.map +0 -1
- package/dist/resolveRevokeAccount-B5iXpuRT.js +0 -38
- package/dist/resolveRevokeAccount-B7ImSb4Y.js +0 -38
- package/dist/resolveRevokeAccount-B7ImSb4Y.js.map +0 -1
- package/dist/resolveRevokeAccount-BEhKQBTm.js +0 -38
- package/dist/resolveRevokeAccount-BEhKQBTm.js.map +0 -1
- package/dist/resolveRevokeAccount-BM1j2l5Q.js +0 -38
- package/dist/resolveRevokeAccount-BM1j2l5Q.js.map +0 -1
- package/dist/resolveRevokeAccount-BtVG0xxc.js +0 -38
- package/dist/resolveRevokeAccount-BtVG0xxc.js.map +0 -1
- package/dist/resolveRevokeAccount-CJZZdBcQ.js +0 -39
- package/dist/resolveRevokeAccount-CJZZdBcQ.js.map +0 -1
- package/dist/resolveRevokeAccount-CaIMuCee.js +0 -39
- package/dist/resolveRevokeAccount-CaIMuCee.js.map +0 -1
- package/dist/resolveRevokeAccount-CehU81k6.js.map +0 -1
- package/dist/resolveRevokeAccount-Cg4TQgnd.js +0 -38
- package/dist/resolveRevokeAccount-Cg4TQgnd.js.map +0 -1
- package/dist/resolveRevokeAccount-DHnxtEIj.js +0 -39
- package/dist/resolveRevokeAccount-DHnxtEIj.js.map +0 -1
- package/dist/resolveRevokeAccount-DJKfLlyK.js +0 -38
- package/dist/resolveRevokeAccount-DJKfLlyK.js.map +0 -1
- package/dist/resolveRevokeAccount-S-2WXkNh.js +0 -38
- package/dist/resolveRevokeAccount-S-2WXkNh.js.map +0 -1
- package/dist/resolveRevokeAccount-mzR11KJ4.js +0 -38
- package/dist/resolveRevokeAccount-mzR11KJ4.js.map +0 -1
- package/dist/resolveRevokeAccount-yWARIv9i.js +0 -38
- package/dist/resolveRevokeAccount-yWARIv9i.js.map +0 -1
- package/dist/seedSigner-CFzMD7Rb.js +0 -66
- package/dist/seedSigner-CFzMD7Rb.js.map +0 -1
- package/dist/thirdweb-BoksPRz3.js +0 -194
- package/dist/thirdweb-BoksPRz3.js.map +0 -1
- package/dist/thirdwebAccount-C2iOcp4_.js +0 -59
- package/dist/thirdwebAccount-C2iOcp4_.js.map +0 -1
- package/dist/worker-B1PcFPLi.js +0 -69
- package/dist/worker-B1PcFPLi.js.map +0 -1
- package/dist/worker-B8gN5WTx.js +0 -69
- package/dist/worker-B8gN5WTx.js.map +0 -1
- package/dist/worker-BCG1r0AS.js +0 -69
- package/dist/worker-BCG1r0AS.js.map +0 -1
- package/dist/worker-BgErCNTb.js +0 -69
- package/dist/worker-BgErCNTb.js.map +0 -1
- package/dist/worker-C07rPV2G.js +0 -69
- package/dist/worker-C07rPV2G.js.map +0 -1
- package/dist/worker-C9Za_dlQ.js +0 -69
- package/dist/worker-C9Za_dlQ.js.map +0 -1
- package/dist/worker-CEgulQnm.js +0 -69
- package/dist/worker-CEgulQnm.js.map +0 -1
- package/dist/worker-C_TL94He.js +0 -69
- package/dist/worker-C_TL94He.js.map +0 -1
- package/dist/worker-CbtzcKG6.js +0 -69
- package/dist/worker-CbtzcKG6.js.map +0 -1
- package/dist/worker-DBC_g-3I.js +0 -69
- package/dist/worker-DBC_g-3I.js.map +0 -1
- package/dist/worker-DHUm-TeQ.js +0 -69
- package/dist/worker-DHUm-TeQ.js.map +0 -1
- package/dist/worker-DypHzXgH.js +0 -69
- package/dist/worker-DypHzXgH.js.map +0 -1
- package/dist/worker-ZL4Wg19t.js +0 -69
- package/dist/worker-ZL4Wg19t.js.map +0 -1
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import { assign as I, createActor as Pt, enqueueActions as Ft, fromCallback as It, fromPromise as L, setup as Lt } from "xstate";
|
|
2
|
+
import { At as t, B as n, Ct as r, D as i, Dt as a, Et as o, F as s, G as c, H as l, I as u, J as d, K as f, L as p, O as m, Ot as h, P as g, Q as _, R as v, St as y, V as b, X as x, Y as ee, Z as te, _ as S, _t as ne, a as re, at as ie, b as ae, bt as oe, c as se, ct as ce, dt as C, et as le, f as ue, ft as de, h as fe, ht as pe, it as me, j as he, jt as ge, k as _e, lt as ve, mt as w, o as T, ot as ye, q as be, r as xe, rt as Se, st as Ce, t as E, u as we, ut as Te, v as D, wt as Ee, xt as De, y as O, yt as Oe, z as ke } from "./chainConfig-DWzoOtkS.js";
|
|
3
|
+
import { t as k } from "./publishThirdwebClient-CO18ST7C.js";
|
|
4
|
+
import { BaseArweaveClient as Ae, BaseDb as A, BaseFileManager as j, INTERNAL_DATA_TYPES as je, Item as M, ModelPropertyDataTypes as Me, applyPropertyAttestationUidsFromPublish as Ne, arweaveL1FinalizeJobs as Pe, assertLocalDbChain as Fe, getCorrectId as Ie, getEasSchemaForItemProperty as Le, getItemPropertiesFromEas as Re, getRelatedItemsForPublish as ze, getSegmentedItemProperties as Be, getUploadPipelineTransactionStatus as Ve, htmlEmbeddedImageCoPublish as He, isItemOwned as Ue, isPublishedSeedRef as We, itemHasPublishUploadCandidates as Ge, listRelationEasPropertyName as Ke, normalizeDataType as qe, normalizeRelationPropertyValue as Je, prepareHtmlEmbeddedImagesForPublish as Ye, publishProcesses as N, resolvePublishPayloadValues as Xe, resolveSeedIdsFromRefString as Ze, rewriteHtmlEmbeddedImagesOnDisk as Qe, setSchemaUidForModel as $e, setSchemaUidForSchemaDefinition as et, updateVersionUid as tt, validateItemForPublish as nt } from "@seedprotocol/sdk";
|
|
5
|
+
import { BaseError as rt, decodeAbiParameters as it, decodeErrorResult as at, isAddressEqual as ot, parseEther as st, parseEventLogs as P, toFunctionSelector as ct, zeroAddress as lt } from "viem";
|
|
6
|
+
import { deploySmartAccount as ut, getContract as dt } from "thirdweb";
|
|
7
|
+
import { ethers as F, keccak256 as ft, toUtf8Bytes as pt } from "ethers";
|
|
8
|
+
import { PUBLISH_AUTHORIZATION_DEFAULT_EXPIRATION_SECS as mt, PUBLISH_AUTHORIZATION_SCHEMA_DEF as ht, PUBLISH_AUTHORIZATION_SCHEMA_DEF as gt, PUBLISH_AUTHORIZATION_SCHEMA_NAME as _t, PUBLISH_AUTHORIZATION_SCHEMA_NAME as vt, PUBLISH_AUTHORIZATION_SCOPES as yt, PUBLISH_AUTHORIZATION_SCOPES as bt, assessPublishAuthorization as xt, decodePublishAuthorizationData as St, getPublishAuthorizationFromEas as Ct, isValidEasAttestationUid as wt, normalizeBytes32Hex as Tt } from "@seedprotocol/eas";
|
|
9
|
+
import { createContext as Et, useContext as Dt, useEffect as Ot, useRef as kt, useState as At } from "react";
|
|
10
|
+
import jt from "arweave";
|
|
11
|
+
import { NO_EXPIRATION as Mt, SchemaEncoder as Nt, SchemaRegistry as Pt, ZERO_ADDRESS as Ft, ZERO_BYTES32 as It } from "@ethereum-attestation-service/eas-sdk";
|
|
12
|
+
import { assign as I, createActor as Lt, enqueueActions as Rt, fromCallback as zt, fromPromise as L, setup as Bt } from "xstate";
|
|
14
13
|
import R from "debug";
|
|
15
|
-
import { and as
|
|
16
|
-
import { createWallet as
|
|
17
|
-
import { useActiveAccount as
|
|
18
|
-
import {
|
|
14
|
+
import { and as Vt, desc as Ht, eq as z } from "drizzle-orm";
|
|
15
|
+
import { createWallet as Ut, inAppWallet as Wt } from "thirdweb/wallets";
|
|
16
|
+
import { useActiveAccount as Gt } from "thirdweb/react";
|
|
17
|
+
import { estimateUserOpGas as Kt, getPaymasterAndData as qt } from "thirdweb/wallets/smart";
|
|
19
18
|
//#region src/react/PublishConfigContext.tsx
|
|
20
|
-
var
|
|
21
|
-
function
|
|
22
|
-
let e =
|
|
19
|
+
var Jt = Et(null);
|
|
20
|
+
function Yt() {
|
|
21
|
+
let e = Dt(Jt);
|
|
23
22
|
if (!e) throw Error("usePublishConfig: PublishConfig is missing. Pass config to PublishProvider or call initPublish() before render.");
|
|
24
23
|
return e;
|
|
25
24
|
}
|
|
26
25
|
//#endregion
|
|
27
26
|
//#region src/helpers/describeRevert.ts
|
|
28
|
-
var
|
|
27
|
+
var Xt = [
|
|
29
28
|
{
|
|
30
29
|
type: "error",
|
|
31
30
|
name: "PublishIndexOutOfBounds",
|
|
@@ -181,26 +180,26 @@ var qt = [
|
|
|
181
180
|
type: "uint256"
|
|
182
181
|
}]
|
|
183
182
|
},
|
|
184
|
-
...
|
|
185
|
-
...
|
|
183
|
+
...y,
|
|
184
|
+
...Ee
|
|
186
185
|
];
|
|
187
|
-
function
|
|
188
|
-
if (e instanceof
|
|
186
|
+
function Zt(e) {
|
|
187
|
+
if (e instanceof rt) return e.walk((e) => {
|
|
189
188
|
let t = e.data;
|
|
190
189
|
return typeof t == "string" && t.startsWith("0x") && t.length > 2;
|
|
191
190
|
})?.data;
|
|
192
191
|
}
|
|
193
|
-
function
|
|
194
|
-
if (
|
|
195
|
-
let t = e instanceof
|
|
192
|
+
function Qt(e) {
|
|
193
|
+
if (Zt(e)) return !0;
|
|
194
|
+
let t = e instanceof rt ? `${e.shortMessage} ${e.details}` : String(e);
|
|
196
195
|
return /revert/i.test(t);
|
|
197
196
|
}
|
|
198
|
-
var
|
|
199
|
-
function
|
|
197
|
+
var $t = "reverted with no data. The target likely has no matching function or the account cannot run executor calls";
|
|
198
|
+
function en(e, t = $t) {
|
|
200
199
|
if (!e || e === "0x") return t;
|
|
201
200
|
try {
|
|
202
|
-
let t =
|
|
203
|
-
abi:
|
|
201
|
+
let t = at({
|
|
202
|
+
abi: Xt,
|
|
204
203
|
data: e
|
|
205
204
|
}), n = t.args?.length ? `(${t.args.map(String).join(", ")})` : "";
|
|
206
205
|
return `reverted with ${t.errorName}${n}`;
|
|
@@ -208,34 +207,34 @@ function Zt(e, t = Xt) {
|
|
|
208
207
|
return `reverted with data ${e}`;
|
|
209
208
|
}
|
|
210
209
|
}
|
|
211
|
-
function
|
|
212
|
-
return t && t !== "0x" ? `The publish UserOp in transaction ${e} ${
|
|
210
|
+
function tn(e, t) {
|
|
211
|
+
return t && t !== "0x" ? `The publish UserOp in transaction ${e} ${en(t)}.` : `The publish UserOp in transaction ${e} failed with no revert reason. That usually means it ran out of gas (the bundler's gas estimate was too low), not that the publish data is wrong. To confirm, run \`npx hardhat seed:explain-userop --network <network> --tx ${e}\` in seed-protocol.`;
|
|
213
212
|
}
|
|
214
|
-
function
|
|
213
|
+
function nn(e) {
|
|
215
214
|
let { txHash: t, revertData: n, sender: r, cause: i } = e, a = !!n && n !== "0x";
|
|
216
|
-
return new
|
|
215
|
+
return new w(tn(t, n), a ? "USEROP_REVERTED" : "USEROP_FAILED_NO_REASON", r, i);
|
|
217
216
|
}
|
|
218
|
-
function
|
|
217
|
+
function rn(e) {
|
|
219
218
|
let t = [];
|
|
220
219
|
for (let n = e; n && t.length < 6; n = n.cause) t.push(n);
|
|
221
220
|
return t;
|
|
222
221
|
}
|
|
223
|
-
var
|
|
224
|
-
function
|
|
225
|
-
return
|
|
222
|
+
var an;
|
|
223
|
+
function on(e) {
|
|
224
|
+
return an ??= new Map(Xt.filter((e) => e.type === "error").map((e) => [ct(`${e.name}(${e.inputs.map((e) => e.type).join(",")})`), e.name])), an.get(e.toLowerCase());
|
|
226
225
|
}
|
|
227
|
-
function
|
|
228
|
-
for (let n of
|
|
226
|
+
function sn(e, t) {
|
|
227
|
+
for (let n of rn(e)) {
|
|
229
228
|
let r = String(n.message ?? "").match(/UserOp failed at txHash: (0x[0-9a-f]{64})/i);
|
|
230
|
-
if (r) return
|
|
229
|
+
if (r) return nn({
|
|
231
230
|
txHash: r[1],
|
|
232
231
|
sender: t,
|
|
233
232
|
cause: e
|
|
234
233
|
});
|
|
235
234
|
let i = n.signature;
|
|
236
235
|
if (n.name === "AbiErrorSignatureNotFoundError" && typeof i == "string") {
|
|
237
|
-
let n =
|
|
238
|
-
if (n) return new
|
|
236
|
+
let n = on(i);
|
|
237
|
+
if (n) return new w(`The publish transaction reverted with ${n} (its arguments were not decoded).`, "USEROP_REVERTED", t, e);
|
|
239
238
|
}
|
|
240
239
|
}
|
|
241
240
|
return e;
|
|
@@ -243,22 +242,22 @@ function rn(e, t) {
|
|
|
243
242
|
//#endregion
|
|
244
243
|
//#region src/helpers/blockchain.ts
|
|
245
244
|
var B = () => {
|
|
246
|
-
let e =
|
|
245
|
+
let e = Ae.getArweaveJsApiConfig(), t = jt;
|
|
247
246
|
return Object.keys(t).includes("default") && t.default ? t.default.init(e) : t.init(e);
|
|
248
247
|
};
|
|
249
248
|
//#endregion
|
|
250
249
|
//#region src/helpers/schemaRegistry.ts
|
|
251
250
|
async function V(e) {
|
|
252
|
-
return
|
|
251
|
+
return Se(e);
|
|
253
252
|
}
|
|
254
|
-
function
|
|
255
|
-
return
|
|
253
|
+
function cn(e) {
|
|
254
|
+
return d(e);
|
|
256
255
|
}
|
|
257
256
|
//#endregion
|
|
258
257
|
//#region src/helpers/nameSchemaAttestation.ts
|
|
259
|
-
var
|
|
260
|
-
function
|
|
261
|
-
let
|
|
258
|
+
var ln = "0x0000000000000000000000000000000000000000";
|
|
259
|
+
function un(e) {
|
|
260
|
+
let t = new Nt("bytes32 schemaId,string name").encodeData([{
|
|
262
261
|
name: "schemaId",
|
|
263
262
|
value: e.schemaUid,
|
|
264
263
|
type: "bytes32"
|
|
@@ -267,34 +266,34 @@ function sn(e) {
|
|
|
267
266
|
value: e.schemaName,
|
|
268
267
|
type: "string"
|
|
269
268
|
}]);
|
|
270
|
-
return
|
|
271
|
-
schema:
|
|
269
|
+
return l({
|
|
270
|
+
schema: o,
|
|
272
271
|
data: {
|
|
273
|
-
recipient:
|
|
274
|
-
expirationTime: BigInt(
|
|
272
|
+
recipient: ln,
|
|
273
|
+
expirationTime: BigInt(Mt),
|
|
275
274
|
revocable: !0,
|
|
276
|
-
refUID:
|
|
277
|
-
data:
|
|
275
|
+
refUID: It,
|
|
276
|
+
data: t,
|
|
278
277
|
value: 0n
|
|
279
278
|
}
|
|
280
279
|
});
|
|
281
280
|
}
|
|
282
281
|
//#endregion
|
|
283
282
|
//#region src/services/publish/helpers/ensureEasSchemas.ts
|
|
284
|
-
var H = "0x0000000000000000000000000000000000000000", U = !0,
|
|
285
|
-
function
|
|
283
|
+
var H = "0x0000000000000000000000000000000000000000", U = !0, dn = "bytes32 schemaId,string name", fn = "bytes32 version", pn = /* @__PURE__ */ new Set();
|
|
284
|
+
function mn(e) {
|
|
286
285
|
return e.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
|
|
287
286
|
}
|
|
288
|
-
async function
|
|
289
|
-
let { itemRelationProperties: t, itemImageProperties: n, itemListProperties: r } = await
|
|
287
|
+
async function hn(e) {
|
|
288
|
+
let { itemRelationProperties: t, itemImageProperties: n, itemListProperties: r } = await Be(e), i = /* @__PURE__ */ new Set();
|
|
290
289
|
e.modelName && i.add(e.modelName);
|
|
291
290
|
for (let e of t) {
|
|
292
291
|
let t = e.propertyDef?.ref;
|
|
293
292
|
t && i.add(t);
|
|
294
293
|
}
|
|
295
294
|
for (let e of n) {
|
|
296
|
-
let t =
|
|
297
|
-
t ===
|
|
295
|
+
let t = qe(e.propertyDef?.dataType);
|
|
296
|
+
t === Me.File ? i.add("File") : t === Me.Html ? i.add("Html") : i.add("Image");
|
|
298
297
|
}
|
|
299
298
|
for (let e of r) {
|
|
300
299
|
let t = e.propertyDef?.ref;
|
|
@@ -302,65 +301,65 @@ async function fn(e) {
|
|
|
302
301
|
}
|
|
303
302
|
return i;
|
|
304
303
|
}
|
|
305
|
-
async function
|
|
304
|
+
async function gn(e, t) {
|
|
306
305
|
let n = await e.sendTransaction(t);
|
|
307
306
|
await C(n.transactionHash);
|
|
308
307
|
}
|
|
309
|
-
function
|
|
310
|
-
let t =
|
|
311
|
-
return
|
|
308
|
+
function _n(e) {
|
|
309
|
+
let t = qe(e);
|
|
310
|
+
return je[t]?.eas ?? "string";
|
|
312
311
|
}
|
|
313
|
-
function
|
|
312
|
+
function vn(e, t) {
|
|
314
313
|
if (e) throw Error(`schema "${t}" is not registered; automation keys can't register schemas. Call ensureEasSchemasForItem with the owner wallet first.`);
|
|
315
314
|
}
|
|
316
|
-
async function
|
|
317
|
-
let e =
|
|
318
|
-
if (
|
|
319
|
-
let t =
|
|
315
|
+
async function yn() {
|
|
316
|
+
let e = xe().id;
|
|
317
|
+
if (pn.has(e)) return;
|
|
318
|
+
let t = Pt.getSchemaUID(fn, H, U), n = [[dn, o], [fn, t]], r = [];
|
|
320
319
|
for (let [e, t] of n) await V(t) || r.push(`"${e}" (${t})`);
|
|
321
320
|
if (r.length > 0) throw Error(`Seed base schema${r.length > 1 ? "s" : ""} ${r.join(" and ")} not registered on chain ${e}. The protocol registers base schemas for each supported chain (seed-protocol: bun run seed:ensure-schemas).`);
|
|
322
|
-
|
|
321
|
+
pn.add(e);
|
|
323
322
|
}
|
|
324
|
-
async function
|
|
323
|
+
async function bn(e, t) {
|
|
325
324
|
if (typeof t?.blockSchemaRegistration == "boolean") return t.blockSchemaRegistration;
|
|
326
325
|
let n = t?.managedAddress?.trim();
|
|
327
|
-
if (!n || !
|
|
328
|
-
let { isAutomationSessionActive: r } = await import("./ensureAutomationSessionKey-
|
|
326
|
+
if (!n || !i(e)) return !1;
|
|
327
|
+
let { isAutomationSessionActive: r } = await import("./ensureAutomationSessionKey-h3zOmDr5.js").then((e) => e.n);
|
|
329
328
|
return r(n, e.signer.address);
|
|
330
329
|
}
|
|
331
|
-
async function
|
|
332
|
-
await
|
|
330
|
+
async function xn(e, t, n) {
|
|
331
|
+
await Sn(e, t, n);
|
|
333
332
|
}
|
|
334
|
-
async function
|
|
335
|
-
let
|
|
333
|
+
async function Sn(e, t, n) {
|
|
334
|
+
let r = await bn(t, n), a = i(t) ? t.txSender : _e(t) ? t : (() => {
|
|
336
335
|
throw Error("@seedprotocol/publish: ensureEasSchemasForItem requires a PublishWallet or SeedTxSender");
|
|
337
336
|
})();
|
|
338
|
-
await
|
|
339
|
-
let { itemBasicProperties: o, itemRelationProperties: s, itemImageProperties: c, itemListProperties: l } = await
|
|
337
|
+
await yn();
|
|
338
|
+
let { itemBasicProperties: o, itemRelationProperties: s, itemImageProperties: c, itemListProperties: l } = await Be(e), u = [
|
|
340
339
|
...o,
|
|
341
340
|
...s,
|
|
342
341
|
...c,
|
|
343
342
|
...l
|
|
344
|
-
], d = /* @__PURE__ */ new Set(), f = await
|
|
343
|
+
], d = /* @__PURE__ */ new Set(), f = await hn(e), p = /* @__PURE__ */ new Set();
|
|
345
344
|
for (let e of f) {
|
|
346
|
-
let t = `bytes32 ${
|
|
345
|
+
let t = `bytes32 ${mn(e)}`, n = Pt.getSchemaUID(t, H, U);
|
|
347
346
|
if (await V(n)) {
|
|
348
|
-
|
|
347
|
+
$e({
|
|
349
348
|
modelName: e,
|
|
350
349
|
schemaUid: n
|
|
351
350
|
});
|
|
352
351
|
continue;
|
|
353
352
|
}
|
|
354
353
|
if (p.has(n)) {
|
|
355
|
-
|
|
354
|
+
$e({
|
|
356
355
|
modelName: e,
|
|
357
356
|
schemaUid: n
|
|
358
357
|
});
|
|
359
358
|
continue;
|
|
360
359
|
}
|
|
361
|
-
|
|
360
|
+
vn(r, t);
|
|
362
361
|
try {
|
|
363
|
-
await
|
|
362
|
+
await gn(a, cn({
|
|
364
363
|
schema: t,
|
|
365
364
|
resolverAddress: H,
|
|
366
365
|
revocable: U
|
|
@@ -369,46 +368,46 @@ async function yn(e, t, r) {
|
|
|
369
368
|
throw Error(`Failed to register EAS schema for model ${e}: ${t instanceof Error ? t.message : String(t)}`);
|
|
370
369
|
}
|
|
371
370
|
try {
|
|
372
|
-
await
|
|
371
|
+
await gn(a, un({
|
|
373
372
|
schemaUid: n,
|
|
374
|
-
schemaName:
|
|
373
|
+
schemaName: mn(e)
|
|
375
374
|
}));
|
|
376
375
|
} catch (t) {
|
|
377
376
|
throw Error(`Failed to name EAS schema for model ${e}: ${t instanceof Error ? t.message : String(t)}`);
|
|
378
377
|
}
|
|
379
|
-
p.add(n),
|
|
378
|
+
p.add(n), $e({
|
|
380
379
|
modelName: e,
|
|
381
380
|
schemaUid: n
|
|
382
381
|
});
|
|
383
382
|
}
|
|
384
|
-
let
|
|
385
|
-
if (await V(
|
|
386
|
-
text:
|
|
387
|
-
schemaUid:
|
|
383
|
+
let m = "string storage_transaction_id", h = Pt.getSchemaUID(m, H, U);
|
|
384
|
+
if (await V(h)) et({
|
|
385
|
+
text: m,
|
|
386
|
+
schemaUid: h
|
|
388
387
|
});
|
|
389
|
-
else if (!d.has(
|
|
390
|
-
|
|
388
|
+
else if (!d.has(h) && (f.has("Image") || f.has("File") || f.has("Html"))) {
|
|
389
|
+
vn(r, m);
|
|
391
390
|
try {
|
|
392
|
-
await
|
|
393
|
-
schema:
|
|
391
|
+
await gn(a, cn({
|
|
392
|
+
schema: m,
|
|
394
393
|
resolverAddress: H,
|
|
395
394
|
revocable: U
|
|
396
|
-
})), await
|
|
397
|
-
schemaUid:
|
|
395
|
+
})), await gn(a, un({
|
|
396
|
+
schemaUid: h,
|
|
398
397
|
schemaName: "storage_transaction_id"
|
|
399
398
|
}));
|
|
400
399
|
} catch (e) {
|
|
401
400
|
throw Error(`Failed to register EAS schema for storageTransactionId: ${e instanceof Error ? e.message : String(e)}`);
|
|
402
401
|
}
|
|
403
|
-
d.add(
|
|
404
|
-
text:
|
|
405
|
-
schemaUid:
|
|
402
|
+
d.add(h), et({
|
|
403
|
+
text: m,
|
|
404
|
+
schemaUid: h
|
|
406
405
|
});
|
|
407
406
|
}
|
|
408
407
|
for (let e of u) {
|
|
409
408
|
if (!e.propertyDef) continue;
|
|
410
|
-
let t =
|
|
411
|
-
if (
|
|
409
|
+
let t = _n(e.propertyDef.dataType), n = e, i = Ke(e.propertyName, e.propertyDef), o = i ?? (n.storagePropertyName && n.storagePropertyName.length > 0 ? n.storagePropertyName : e.propertyName), s = mn(o), c = `${t} ${s}`;
|
|
410
|
+
if (i && !s.endsWith("_ids")) throw Error(`Refusing to register "${c}" for list-relation property ${e.propertyName}: list relations attest as <singular>_<ref>_ids.`);
|
|
412
411
|
let l = [
|
|
413
412
|
"string",
|
|
414
413
|
"address",
|
|
@@ -421,39 +420,39 @@ async function yn(e, t, r) {
|
|
|
421
420
|
"uint64",
|
|
422
421
|
"uint128",
|
|
423
422
|
"uint256"
|
|
424
|
-
].includes(t) ? t : void 0, u = await
|
|
425
|
-
schemaUid:
|
|
423
|
+
].includes(t) ? t : void 0, u = await Le({
|
|
424
|
+
schemaUid: i ? void 0 : e.schemaUid,
|
|
426
425
|
propertyName: o,
|
|
427
426
|
easDataType: l
|
|
428
427
|
});
|
|
429
428
|
if (u) {
|
|
430
429
|
let e = await V(u.id);
|
|
431
430
|
if (e && e.schema === c) {
|
|
432
|
-
|
|
431
|
+
et({
|
|
433
432
|
text: c,
|
|
434
433
|
schemaUid: u.id
|
|
435
434
|
});
|
|
436
435
|
continue;
|
|
437
436
|
}
|
|
438
437
|
}
|
|
439
|
-
let f =
|
|
438
|
+
let f = Pt.getSchemaUID(c, H, U);
|
|
440
439
|
if (await V(f)) {
|
|
441
|
-
|
|
440
|
+
et({
|
|
442
441
|
text: c,
|
|
443
442
|
schemaUid: f
|
|
444
443
|
});
|
|
445
444
|
continue;
|
|
446
445
|
}
|
|
447
446
|
if (d.has(f)) {
|
|
448
|
-
|
|
447
|
+
et({
|
|
449
448
|
text: c,
|
|
450
449
|
schemaUid: f
|
|
451
450
|
});
|
|
452
451
|
continue;
|
|
453
452
|
}
|
|
454
|
-
|
|
453
|
+
vn(r, c);
|
|
455
454
|
try {
|
|
456
|
-
await
|
|
455
|
+
await gn(a, cn({
|
|
457
456
|
schema: c,
|
|
458
457
|
resolverAddress: H,
|
|
459
458
|
revocable: U
|
|
@@ -462,27 +461,27 @@ async function yn(e, t, r) {
|
|
|
462
461
|
throw Error(`Failed to register EAS schema for property ${e.propertyName}: ${t instanceof Error ? t.message : String(t)}`);
|
|
463
462
|
}
|
|
464
463
|
try {
|
|
465
|
-
await
|
|
464
|
+
await gn(a, un({
|
|
466
465
|
schemaUid: f,
|
|
467
466
|
schemaName: s
|
|
468
467
|
}));
|
|
469
468
|
} catch (t) {
|
|
470
469
|
throw Error(`Failed to name EAS schema for property ${e.propertyName}: ${t instanceof Error ? t.message : String(t)}`);
|
|
471
470
|
}
|
|
472
|
-
d.add(f),
|
|
471
|
+
d.add(f), et({
|
|
473
472
|
text: c,
|
|
474
473
|
schemaUid: f
|
|
475
474
|
});
|
|
476
475
|
}
|
|
477
|
-
let
|
|
478
|
-
for (let e of
|
|
479
|
-
managedAddress:
|
|
480
|
-
blockSchemaRegistration:
|
|
476
|
+
let g = await ze(e);
|
|
477
|
+
for (let e of g) await Sn(e, t, {
|
|
478
|
+
managedAddress: n?.managedAddress,
|
|
479
|
+
blockSchemaRegistration: r
|
|
481
480
|
});
|
|
482
481
|
}
|
|
483
482
|
//#endregion
|
|
484
483
|
//#region src/services/publish/actors/utils.ts
|
|
485
|
-
var W = "0x" + "0".repeat(64),
|
|
484
|
+
var W = "0x" + "0".repeat(64), Cn = async (e) => {
|
|
486
485
|
let t;
|
|
487
486
|
try {
|
|
488
487
|
t = await M.find({ seedLocalId: e });
|
|
@@ -497,7 +496,7 @@ var W = "0x" + "0".repeat(64), bn = async (e) => {
|
|
|
497
496
|
}, 200);
|
|
498
497
|
});
|
|
499
498
|
};
|
|
500
|
-
function
|
|
499
|
+
function wn(e) {
|
|
501
500
|
if (!e || typeof e != "object") return;
|
|
502
501
|
let t = e;
|
|
503
502
|
if (Array.isArray(t.data_root)) return {
|
|
@@ -512,7 +511,7 @@ function xn(e) {
|
|
|
512
511
|
}))
|
|
513
512
|
};
|
|
514
513
|
}
|
|
515
|
-
function
|
|
514
|
+
function Tn(e) {
|
|
516
515
|
return {
|
|
517
516
|
data_root: Array.from(e.data_root),
|
|
518
517
|
chunks: e.chunks.map((e) => ({
|
|
@@ -527,14 +526,14 @@ function Sn(e) {
|
|
|
527
526
|
}
|
|
528
527
|
//#endregion
|
|
529
528
|
//#region src/services/publish/actors/createArweaveTransactions.ts
|
|
530
|
-
var
|
|
529
|
+
var En = L(async ({ input: { context: e } }) => {
|
|
531
530
|
let { item: t } = e;
|
|
532
|
-
t.getPublishUploads || (t = await
|
|
531
|
+
t.getPublishUploads || (t = await Cn(t.seedLocalId));
|
|
533
532
|
let n = {};
|
|
534
533
|
e.arweaveUploadTags?.length && (n.arweaveUploadTags = e.arweaveUploadTags);
|
|
535
534
|
let r = e.htmlEmbeddedDeferredHtmlSeedLocalIds;
|
|
536
535
|
r?.length && (n.deferHtmlStorageSeedLocalIds = r);
|
|
537
|
-
let i = await t.getPublishUploads(Object.keys(n).length ? n : void 0), a =
|
|
536
|
+
let i = await t.getPublishUploads(Object.keys(n).length ? n : void 0), a = T(), o = e.signArweaveTransactions ?? a.signArweaveTransactions, s = e.arweaveJwk ?? a.arweaveJwk, c = i.map((e) => ({
|
|
538
537
|
versionLocalId: e.versionLocalId,
|
|
539
538
|
itemPropertyName: e.itemPropertyName,
|
|
540
539
|
transactionJson: e.transactionToSign.toJSON()
|
|
@@ -550,7 +549,7 @@ var Cn = L(async ({ input: { context: e } }) => {
|
|
|
550
549
|
l.push({
|
|
551
550
|
transaction: {
|
|
552
551
|
...i,
|
|
553
|
-
chunks: r.chunks ?
|
|
552
|
+
chunks: r.chunks ? Tn(r.chunks) : void 0
|
|
554
553
|
},
|
|
555
554
|
versionId: n.versionLocalId,
|
|
556
555
|
modelName: n.itemPropertyName
|
|
@@ -560,7 +559,7 @@ var Cn = L(async ({ input: { context: e } }) => {
|
|
|
560
559
|
let u = B();
|
|
561
560
|
return {
|
|
562
561
|
arweaveTransactions: l.map((e) => {
|
|
563
|
-
let { chunks: t, ...n } = e.transaction, r = { ...n }, i =
|
|
562
|
+
let { chunks: t, ...n } = e.transaction, r = { ...n }, i = wn(t);
|
|
564
563
|
return i && (r.chunks = i), {
|
|
565
564
|
transaction: u.transactions.fromRaw(r),
|
|
566
565
|
versionId: e.versionId,
|
|
@@ -569,14 +568,14 @@ var Cn = L(async ({ input: { context: e } }) => {
|
|
|
569
568
|
}),
|
|
570
569
|
publishUploads: i
|
|
571
570
|
};
|
|
572
|
-
}),
|
|
571
|
+
}), Dn = L(async ({ input: { context: e } }) => {
|
|
573
572
|
let { item: t } = e;
|
|
574
|
-
t.getPublishUploads || (t = await
|
|
573
|
+
t.getPublishUploads || (t = await Cn(t.seedLocalId));
|
|
575
574
|
let n = {};
|
|
576
575
|
e.arweaveUploadTags?.length && (n.arweaveUploadTags = e.arweaveUploadTags);
|
|
577
576
|
let r = e.htmlEmbeddedDeferredHtmlSeedLocalIds;
|
|
578
577
|
r?.length && (n.onlyHtmlStorageSeedLocalIds = r, n.skipRelationRecursion = !0);
|
|
579
|
-
let i = await t.getPublishUploads(Object.keys(n).length ? n : void 0), a =
|
|
578
|
+
let i = await t.getPublishUploads(Object.keys(n).length ? n : void 0), a = T(), o = e.signArweaveTransactions ?? a.signArweaveTransactions, s = e.arweaveJwk ?? a.arweaveJwk, c = i.map((e) => ({
|
|
580
579
|
versionLocalId: e.versionLocalId,
|
|
581
580
|
itemPropertyName: e.itemPropertyName,
|
|
582
581
|
transactionJson: e.transactionToSign.toJSON()
|
|
@@ -592,7 +591,7 @@ var Cn = L(async ({ input: { context: e } }) => {
|
|
|
592
591
|
l.push({
|
|
593
592
|
transaction: {
|
|
594
593
|
...i,
|
|
595
|
-
chunks: r.chunks ?
|
|
594
|
+
chunks: r.chunks ? Tn(r.chunks) : void 0
|
|
596
595
|
},
|
|
597
596
|
versionId: n.versionLocalId,
|
|
598
597
|
modelName: n.itemPropertyName
|
|
@@ -602,7 +601,7 @@ var Cn = L(async ({ input: { context: e } }) => {
|
|
|
602
601
|
let u = B();
|
|
603
602
|
return {
|
|
604
603
|
arweaveTransactions: l.map((e) => {
|
|
605
|
-
let { chunks: t, ...n } = e.transaction, r = { ...n }, i =
|
|
604
|
+
let { chunks: t, ...n } = e.transaction, r = { ...n }, i = wn(t);
|
|
606
605
|
return i && (r.chunks = i), {
|
|
607
606
|
transaction: u.transactions.fromRaw(r),
|
|
608
607
|
versionId: e.versionId,
|
|
@@ -611,13 +610,13 @@ var Cn = L(async ({ input: { context: e } }) => {
|
|
|
611
610
|
}),
|
|
612
611
|
publishUploads: i
|
|
613
612
|
};
|
|
614
|
-
}),
|
|
613
|
+
}), On = L(async ({ input: { context: e } }) => {
|
|
615
614
|
let t = e.htmlEmbeddedDataUriPolicy ?? "materialize";
|
|
616
|
-
return { deferredHtmlSeedLocalIds: (await
|
|
615
|
+
return { deferredHtmlSeedLocalIds: (await Ye(e.item, t)).deferredHtmlSeedLocalIds };
|
|
617
616
|
});
|
|
618
617
|
//#endregion
|
|
619
618
|
//#region src/services/publish/actors/rewritingHtmlEmbedded.ts
|
|
620
|
-
function
|
|
619
|
+
function kn(e, t) {
|
|
621
620
|
let n = [], r = Math.min(e?.length ?? 0, t?.length ?? 0);
|
|
622
621
|
for (let i = 0; i < r; i++) {
|
|
623
622
|
let r = e[i], a = t[i], o = r.transaction?.id;
|
|
@@ -629,10 +628,10 @@ function En(e, t) {
|
|
|
629
628
|
}
|
|
630
629
|
return n;
|
|
631
630
|
}
|
|
632
|
-
var
|
|
633
|
-
let t =
|
|
634
|
-
await
|
|
635
|
-
}),
|
|
631
|
+
var An = L(async ({ input: { context: e } }) => {
|
|
632
|
+
let t = kn(e.htmlEmbeddedPhase1ArweaveTransactions, e.htmlEmbeddedPhase1PublishUploads);
|
|
633
|
+
await Qe(e.item.seedLocalId, t);
|
|
634
|
+
}), jn = (e, t, n) => {
|
|
636
635
|
let r = [];
|
|
637
636
|
return e && r.push({
|
|
638
637
|
name: "Content-SHA-256",
|
|
@@ -641,10 +640,10 @@ var Dn = L(async ({ input: { context: e } }) => {
|
|
|
641
640
|
name: "Content-Type",
|
|
642
641
|
value: t
|
|
643
642
|
}), n?.length && r.push(...n), r;
|
|
644
|
-
},
|
|
643
|
+
}, Mn = async (e) => {
|
|
645
644
|
let t = (e instanceof Uint8Array, new Uint8Array(e)), n = await crypto.subtle.digest("SHA-256", t);
|
|
646
645
|
return Array.from(new Uint8Array(n)).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
647
|
-
},
|
|
646
|
+
}, Nn = {
|
|
648
647
|
png: "image/png",
|
|
649
648
|
jpg: "image/jpeg",
|
|
650
649
|
jpeg: "image/jpeg",
|
|
@@ -655,10 +654,10 @@ var Dn = L(async ({ input: { context: e } }) => {
|
|
|
655
654
|
htm: "text/html",
|
|
656
655
|
json: "application/json",
|
|
657
656
|
txt: "text/plain"
|
|
658
|
-
},
|
|
657
|
+
}, Pn = (e) => {
|
|
659
658
|
let t = e.split(".").pop()?.toLowerCase();
|
|
660
|
-
return t ?
|
|
661
|
-
},
|
|
659
|
+
return t ? Nn[t] : void 0;
|
|
660
|
+
}, Fn = async (e) => typeof Blob < "u" && e instanceof Blob ? new Uint8Array(await e.arrayBuffer()) : new Uint8Array(e), In = (e) => {
|
|
662
661
|
switch (e) {
|
|
663
662
|
case "Image": return j.getFilesPath("images");
|
|
664
663
|
case "File": return j.getFilesPath("files");
|
|
@@ -666,9 +665,9 @@ var Dn = L(async ({ input: { context: e } }) => {
|
|
|
666
665
|
case "Json": return j.getFilesPath("json");
|
|
667
666
|
default: return j.getFilesPath("images");
|
|
668
667
|
}
|
|
669
|
-
},
|
|
670
|
-
function
|
|
671
|
-
let t =
|
|
668
|
+
}, Ln = /^data:(image\/[a-zA-Z0-9.+-]+);base64,([\s\S]*)$/i;
|
|
669
|
+
function Rn(e) {
|
|
670
|
+
let t = Ln.exec((e ?? "").trim());
|
|
672
671
|
if (!t) return null;
|
|
673
672
|
try {
|
|
674
673
|
let e = t[1].toLowerCase().trim(), n = t[2].replace(/\s/g, "");
|
|
@@ -680,7 +679,7 @@ function Fn(e) {
|
|
|
680
679
|
return null;
|
|
681
680
|
}
|
|
682
681
|
}
|
|
683
|
-
var
|
|
682
|
+
var zn = async (e, t, n, r) => {
|
|
684
683
|
let i = r?.arweaveUploadTags, a = e.itemProperty, o = [];
|
|
685
684
|
for (let t of e.childProperties) {
|
|
686
685
|
let e = t.localStoragePath;
|
|
@@ -693,9 +692,9 @@ var In = async (e, t, n, r) => {
|
|
|
693
692
|
if ((!o || o.length === 0) && n?.localStoragePath) {
|
|
694
693
|
let e = n.localStoragePath;
|
|
695
694
|
if (e && !e.endsWith("undefined") && await j.pathExists(e)) try {
|
|
696
|
-
s = await
|
|
695
|
+
s = await Fn(await j.readFileAsBuffer(e));
|
|
697
696
|
} catch {
|
|
698
|
-
s = await
|
|
697
|
+
s = await Fn((await j.getFs()).readFileSync(e));
|
|
699
698
|
}
|
|
700
699
|
}
|
|
701
700
|
if (o.length > 0) {
|
|
@@ -712,40 +711,40 @@ var In = async (e, t, n, r) => {
|
|
|
712
711
|
s = typeof document < "u" ? new TextEncoder().encode(t) : new Uint8Array(Buffer.from(t));
|
|
713
712
|
}
|
|
714
713
|
if (!s) return t;
|
|
715
|
-
let c = new Uint8Array(s), l = await
|
|
716
|
-
o.length === 0 && n?.localStoragePath ? u =
|
|
714
|
+
let c = new Uint8Array(s), l = await Mn(c), u;
|
|
715
|
+
o.length === 0 && n?.localStoragePath ? u = Pn(n.localStoragePath) : o.length > 0 && (u = "application/octet-stream");
|
|
717
716
|
let d = n ? n.localId : a.localId, f = n ? n.propertyName : a.propertyName;
|
|
718
717
|
return t.push({
|
|
719
718
|
data: c,
|
|
720
719
|
contentHash: l,
|
|
721
720
|
contentType: u,
|
|
722
|
-
tags:
|
|
721
|
+
tags: jn(l, u, i),
|
|
723
722
|
itemPropertyName: f,
|
|
724
723
|
itemPropertyLocalId: d,
|
|
725
724
|
seedLocalId: a.seedLocalId,
|
|
726
725
|
versionLocalId: a.versionLocalId
|
|
727
726
|
}), t;
|
|
728
|
-
},
|
|
727
|
+
}, Bn = async (e, t) => {
|
|
729
728
|
let n = [], r = t?.arweaveUploadTags;
|
|
730
729
|
for (let i of e) {
|
|
731
730
|
let e = i.getService().getSnapshot(), a = "context" in e ? e.context : null;
|
|
732
731
|
if (!a) continue;
|
|
733
732
|
let o = a.propertyValue, s = a.refResolvedValue;
|
|
734
733
|
if (!s) continue;
|
|
735
|
-
let { localId: c } =
|
|
734
|
+
let { localId: c } = Ie(o ?? "");
|
|
736
735
|
if (!c) continue;
|
|
737
736
|
let l = i.propertyDef?.refValueType ?? i.propertyDef?.dataType ?? "Image";
|
|
738
|
-
if (l ===
|
|
737
|
+
if (l === Me.Html) {
|
|
739
738
|
if (t?.deferHtmlStorageSeedLocalIds?.includes(c) || t?.onlyHtmlStorageSeedLocalIds?.length && !t.onlyHtmlStorageSeedLocalIds.includes(c)) continue;
|
|
740
739
|
} else if (t?.onlyHtmlStorageSeedLocalIds?.length) continue;
|
|
741
|
-
let u = `${
|
|
740
|
+
let u = `${In(l)}/${s}`;
|
|
742
741
|
if (!await j.pathExists(u)) continue;
|
|
743
|
-
let d = await
|
|
742
|
+
let d = await Fn(await j.readFileAsBuffer(u)), f = await Mn(d), p = Pn(s);
|
|
744
743
|
n.push({
|
|
745
744
|
data: d,
|
|
746
745
|
contentHash: f,
|
|
747
746
|
contentType: p,
|
|
748
|
-
tags:
|
|
747
|
+
tags: jn(f, p, r),
|
|
749
748
|
itemPropertyName: i.propertyName,
|
|
750
749
|
itemPropertyLocalId: i.localId,
|
|
751
750
|
seedLocalId: c,
|
|
@@ -754,10 +753,10 @@ var In = async (e, t, n, r) => {
|
|
|
754
753
|
}
|
|
755
754
|
return n;
|
|
756
755
|
};
|
|
757
|
-
async function
|
|
756
|
+
async function Vn(e, t, n) {
|
|
758
757
|
let r = A.getAppDb();
|
|
759
758
|
if (!r || n?.onlyHtmlStorageSeedLocalIds?.length) return t;
|
|
760
|
-
let i = await r.select().from(
|
|
759
|
+
let i = await r.select().from(He).where(z(He.parentSeedLocalId, e.seedLocalId)), a = new Set(t.map((e) => e.seedLocalId));
|
|
761
760
|
for (let e of i) {
|
|
762
761
|
if (a.has(e.imageSeedLocalId)) continue;
|
|
763
762
|
let r = await M.find({
|
|
@@ -765,14 +764,14 @@ async function Rn(e, t, n) {
|
|
|
765
764
|
modelName: "Image"
|
|
766
765
|
});
|
|
767
766
|
if (!r) continue;
|
|
768
|
-
let i = r.internalProperties.storageTransactionId ?? r.allProperties.storageTransactionId, o = i?.getService().getSnapshot(), s = o && "context" in o ? o.context : void 0, c =
|
|
767
|
+
let i = r.internalProperties.storageTransactionId ?? r.allProperties.storageTransactionId, o = i?.getService().getSnapshot(), s = o && "context" in o ? o.context : void 0, c = Rn(typeof s?.propertyValue == "string" ? s.propertyValue ?? "" : ""), l = [];
|
|
769
768
|
if (c && i && i.localId && i.versionLocalId) {
|
|
770
|
-
let e = await
|
|
769
|
+
let e = await Mn(c.bytes);
|
|
771
770
|
l = [{
|
|
772
771
|
data: c.bytes,
|
|
773
772
|
contentHash: e,
|
|
774
773
|
contentType: c.mimeType,
|
|
775
|
-
tags:
|
|
774
|
+
tags: jn(e, c.mimeType, n?.arweaveUploadTags),
|
|
776
775
|
itemPropertyName: i.propertyName,
|
|
777
776
|
itemPropertyLocalId: i.localId,
|
|
778
777
|
seedLocalId: r.seedLocalId,
|
|
@@ -783,35 +782,35 @@ async function Rn(e, t, n) {
|
|
|
783
782
|
}
|
|
784
783
|
return t;
|
|
785
784
|
}
|
|
786
|
-
var
|
|
787
|
-
let { itemUploadProperties: i, itemRelationProperties: a, itemImageProperties: o } = await
|
|
785
|
+
var Hn = async (e, t = [], n, r) => {
|
|
786
|
+
let { itemUploadProperties: i, itemRelationProperties: a, itemImageProperties: o } = await Be(e);
|
|
788
787
|
if (!n && r?.onlyHtmlStorageSeedLocalIds?.length) {
|
|
789
|
-
let e = await
|
|
788
|
+
let e = await Bn(o, r);
|
|
790
789
|
return t.push(...e), t;
|
|
791
790
|
}
|
|
792
|
-
for (let e of i) t = await
|
|
793
|
-
let s = await
|
|
794
|
-
if (t.push(...s), !n && !r?.onlyHtmlStorageSeedLocalIds?.length && (t = await
|
|
791
|
+
for (let e of i) t = await zn(e, t, n, r);
|
|
792
|
+
let s = await Bn(o, r);
|
|
793
|
+
if (t.push(...s), !n && !r?.onlyHtmlStorageSeedLocalIds?.length && (t = await Vn(e, t, r)), r?.skipRelationRecursion) return t;
|
|
795
794
|
for (let e of a) {
|
|
796
795
|
let n = e.getService().getSnapshot(), i = "context" in n ? n.context : null;
|
|
797
796
|
if (!i) continue;
|
|
798
797
|
let a = i.propertyValue;
|
|
799
798
|
if (!a || e.uid) continue;
|
|
800
|
-
let { seedLocalId: o, seedUid: s } =
|
|
799
|
+
let { seedLocalId: o, seedUid: s } = Ze(Je(a) ?? "");
|
|
801
800
|
if (!o && !s) throw Error(`Invalid relation value for ${e.propertyName}: expected local seed id or 0x uid`);
|
|
802
801
|
let c = await M.find({
|
|
803
802
|
seedLocalId: o,
|
|
804
803
|
seedUid: s
|
|
805
804
|
});
|
|
806
805
|
if (!c) {
|
|
807
|
-
if (
|
|
806
|
+
if (We(a)) continue;
|
|
808
807
|
throw Error(`No relatedItem found for ${e.propertyName}`);
|
|
809
808
|
}
|
|
810
|
-
t = await
|
|
809
|
+
t = await Hn(c, t, e, r);
|
|
811
810
|
}
|
|
812
811
|
return t;
|
|
813
|
-
},
|
|
814
|
-
function
|
|
812
|
+
}, Un = 3, Wn = new TextEncoder().encode("seed-recovery"), Gn = 32, Kn = 18446744073709551615n;
|
|
813
|
+
function qn(e, t, n) {
|
|
815
814
|
let r = F.solidityPackedKeccak256([
|
|
816
815
|
"uint256",
|
|
817
816
|
"address",
|
|
@@ -819,20 +818,20 @@ function Wn(e, t, n) {
|
|
|
819
818
|
], [
|
|
820
819
|
BigInt(t),
|
|
821
820
|
e,
|
|
822
|
-
n &
|
|
821
|
+
n & Kn
|
|
823
822
|
]);
|
|
824
823
|
return F.getBytes(r);
|
|
825
824
|
}
|
|
826
|
-
function
|
|
825
|
+
function Jn(e) {
|
|
827
826
|
if (e.length === 0) return new Uint8Array([0]);
|
|
828
|
-
if (e.length !==
|
|
827
|
+
if (e.length !== Gn) throw Error(`ANS-104 target/anchor must be empty or ${Gn} bytes, got ${e.length}`);
|
|
829
828
|
let t = /* @__PURE__ */ new Uint8Array(33);
|
|
830
829
|
return t[0] = 1, t.set(e, 1), t;
|
|
831
830
|
}
|
|
832
|
-
function
|
|
831
|
+
function Yn(e) {
|
|
833
832
|
return typeof e == "object" && !!e && "privateKey" in e && typeof e.privateKey == "string";
|
|
834
833
|
}
|
|
835
|
-
function
|
|
834
|
+
function Xn(e, t, n) {
|
|
836
835
|
let r = e >= 0 ? e << 1 : ~e << 1 | 1, i = n;
|
|
837
836
|
do {
|
|
838
837
|
let e = r & 127;
|
|
@@ -840,10 +839,10 @@ function qn(e, t, n) {
|
|
|
840
839
|
} while (r);
|
|
841
840
|
return i - n;
|
|
842
841
|
}
|
|
843
|
-
var
|
|
842
|
+
var Zn = (e) => {
|
|
844
843
|
if (!e?.length) return /* @__PURE__ */ new Uint8Array();
|
|
845
844
|
let t = new TextEncoder(), n = /* @__PURE__ */ new Uint8Array(16), r = [], i = (e) => {
|
|
846
|
-
let t =
|
|
845
|
+
let t = Xn(e, n, 0);
|
|
847
846
|
r.push(n.slice(0, t));
|
|
848
847
|
};
|
|
849
848
|
i(e.length);
|
|
@@ -855,35 +854,35 @@ var Jn = (e) => {
|
|
|
855
854
|
let a = r.reduce((e, t) => e + t.length, 0), o = new Uint8Array(a), s = 0;
|
|
856
855
|
for (let e of r) o.set(e, s), s += e.length;
|
|
857
856
|
return o;
|
|
858
|
-
},
|
|
857
|
+
}, Qn = (e) => {
|
|
859
858
|
let t = /* @__PURE__ */ new Uint8Array(8), n = new DataView(t.buffer);
|
|
860
859
|
return n.setUint32(0, e & 4294967295, !0), n.setUint32(4, Math.floor(e / 4294967296), !0), t;
|
|
861
860
|
};
|
|
862
|
-
async function
|
|
861
|
+
async function $n(e) {
|
|
863
862
|
return new Uint8Array(await crypto.subtle.digest("SHA-384", e));
|
|
864
863
|
}
|
|
865
|
-
function
|
|
864
|
+
function er(e, t) {
|
|
866
865
|
let n = new Uint8Array(e.length + t.length);
|
|
867
866
|
return n.set(e, 0), n.set(t, e.length), n;
|
|
868
867
|
}
|
|
869
|
-
async function
|
|
868
|
+
async function tr(e) {
|
|
870
869
|
let t = new TextEncoder();
|
|
871
870
|
if (Array.isArray(e)) {
|
|
872
|
-
let n = await
|
|
871
|
+
let n = await $n(er(t.encode("list"), t.encode(e.length.toString())));
|
|
873
872
|
for (let t of e) {
|
|
874
|
-
let e = await
|
|
875
|
-
n = await
|
|
873
|
+
let e = await tr(t);
|
|
874
|
+
n = await $n(er(n, e));
|
|
876
875
|
}
|
|
877
876
|
return n;
|
|
878
877
|
}
|
|
879
|
-
return
|
|
878
|
+
return $n(er(await $n(er(t.encode("blob"), t.encode(e.byteLength.toString()))), await $n(e)));
|
|
880
879
|
}
|
|
881
|
-
async function
|
|
880
|
+
async function nr(e, t, n, r, i) {
|
|
882
881
|
let a = new TextEncoder();
|
|
883
|
-
return
|
|
882
|
+
return tr([
|
|
884
883
|
a.encode("dataitem"),
|
|
885
884
|
a.encode("1"),
|
|
886
|
-
a.encode(
|
|
885
|
+
a.encode(Un.toString()),
|
|
887
886
|
e,
|
|
888
887
|
t,
|
|
889
888
|
n,
|
|
@@ -891,11 +890,11 @@ async function $n(e, t, n, r, i) {
|
|
|
891
890
|
i
|
|
892
891
|
]);
|
|
893
892
|
}
|
|
894
|
-
function
|
|
895
|
-
let a =
|
|
893
|
+
function rr(e, t, n, r, i) {
|
|
894
|
+
let a = Zn(t), o = Qn(t.length), s = Qn(a.length), c = [
|
|
896
895
|
e,
|
|
897
|
-
|
|
898
|
-
|
|
896
|
+
Jn(r),
|
|
897
|
+
Jn(i),
|
|
899
898
|
o,
|
|
900
899
|
s,
|
|
901
900
|
a,
|
|
@@ -904,25 +903,25 @@ function er(e, t, n, r, i) {
|
|
|
904
903
|
for (let e of c) u.set(e, d), d += e.length;
|
|
905
904
|
return u;
|
|
906
905
|
}
|
|
907
|
-
async function
|
|
906
|
+
async function ir(e, t) {
|
|
908
907
|
let n = /* @__PURE__ */ new Uint8Array(2);
|
|
909
|
-
new DataView(n.buffer).setUint16(0,
|
|
908
|
+
new DataView(n.buffer).setUint16(0, Un, !0);
|
|
910
909
|
let r = 67 + t.length, i = new Uint8Array(r);
|
|
911
910
|
i.set(n, 0), i.set(e, 2), i.set(t, 67);
|
|
912
911
|
let a = await crypto.subtle.digest("SHA-256", new Uint8Array(e));
|
|
913
912
|
return {
|
|
914
|
-
id:
|
|
913
|
+
id: ur(new Uint8Array(a)),
|
|
915
914
|
raw: i
|
|
916
915
|
};
|
|
917
916
|
}
|
|
918
|
-
var
|
|
919
|
-
let i = F.SigningKey.computePublicKey(t.privateKey, !1), a = F.getBytes(i), o =
|
|
920
|
-
return
|
|
921
|
-
},
|
|
922
|
-
let i = F.hexlify(
|
|
923
|
-
return
|
|
917
|
+
var ar = async (e, t, n, r = /* @__PURE__ */ new Uint8Array()) => {
|
|
918
|
+
let i = F.SigningKey.computePublicKey(t.privateKey, !1), a = F.getBytes(i), o = Zn(n), s = /* @__PURE__ */ new Uint8Array(), c = await nr(a, s, r, o, e);
|
|
919
|
+
return ir(F.getBytes(await t.signMessage(c)), rr(a, n, e, s, r));
|
|
920
|
+
}, or = async (e, t, n, r = /* @__PURE__ */ new Uint8Array()) => {
|
|
921
|
+
let i = F.hexlify(Wn), a = await t.signMessage({ message: { raw: i } }), o = F.hashMessage(Wn), s = F.SigningKey.recoverPublicKey(o, a), c = F.getBytes(s), l = Zn(n), u = /* @__PURE__ */ new Uint8Array(), d = await nr(c, u, r, l, e), f = F.hexlify(d), p = await t.signMessage({ message: { raw: f } });
|
|
922
|
+
return ir(F.getBytes(p), rr(c, n, e, u, r));
|
|
924
923
|
};
|
|
925
|
-
function
|
|
924
|
+
function sr(e) {
|
|
926
925
|
if (e.length < 133) return null;
|
|
927
926
|
let t = e[132];
|
|
928
927
|
if (t !== 0 && t !== 1) return null;
|
|
@@ -935,8 +934,8 @@ function ir(e) {
|
|
|
935
934
|
let a = i === 1;
|
|
936
935
|
return a && e.length < r + 33 ? null : r + (a ? 33 : 1);
|
|
937
936
|
}
|
|
938
|
-
function
|
|
939
|
-
let t =
|
|
937
|
+
function cr(e) {
|
|
938
|
+
let t = sr(e);
|
|
940
939
|
if (t == null) return null;
|
|
941
940
|
let n = e[132] === 1, r = n ? e.slice(133, 165) : /* @__PURE__ */ new Uint8Array(), i = 132 + (n ? 33 : 1);
|
|
942
941
|
return {
|
|
@@ -945,58 +944,58 @@ function ar(e) {
|
|
|
945
944
|
tagsStart: t
|
|
946
945
|
};
|
|
947
946
|
}
|
|
948
|
-
async function
|
|
949
|
-
let t =
|
|
947
|
+
async function lr(e) {
|
|
948
|
+
let t = cr(e);
|
|
950
949
|
if (t == null) return !1;
|
|
951
950
|
let { rawTarget: n, rawAnchor: r, tagsStart: i } = t, a = i + 16;
|
|
952
951
|
if (e.length < a) return !1;
|
|
953
952
|
let o = new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
954
|
-
if (o.getUint16(0, !0) !==
|
|
953
|
+
if (o.getUint16(0, !0) !== Un) return !1;
|
|
955
954
|
let s = e.slice(2, 67), c = e.slice(67, 132), l = Number(o.getUint32(i + 8, !0) + o.getUint32(i + 12, !0) * 4294967296), u = i + 16 + l;
|
|
956
955
|
if (e.length < u) return !1;
|
|
957
956
|
let d = e.slice(i + 16, u), f = e.slice(u);
|
|
958
957
|
try {
|
|
959
|
-
let e = await
|
|
958
|
+
let e = await nr(c, n, r, d, f), t = F.hashMessage(e), i = F.hexlify(s), a = F.SigningKey.recoverPublicKey(t, i), o = F.getBytes(a);
|
|
960
959
|
return o.length === c.length && o.every((e, t) => e === c[t]);
|
|
961
960
|
} catch {
|
|
962
961
|
return !1;
|
|
963
962
|
}
|
|
964
963
|
}
|
|
965
|
-
var
|
|
964
|
+
var ur = (e) => {
|
|
966
965
|
let t = "";
|
|
967
966
|
for (let n of e) t += String.fromCharCode(n);
|
|
968
967
|
return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
969
|
-
},
|
|
970
|
-
async function
|
|
971
|
-
let r,
|
|
968
|
+
}, dr = R("seedProtocol:createArweaveDataItems");
|
|
969
|
+
async function fr(e, t, n) {
|
|
970
|
+
let r, a;
|
|
972
971
|
if (t) r = (await t(e)).map((e) => ({
|
|
973
972
|
transaction: { id: e.transaction.id },
|
|
974
973
|
versionId: e.versionId,
|
|
975
974
|
modelName: e.modelName
|
|
976
975
|
}));
|
|
977
976
|
else if (n) {
|
|
978
|
-
let t = [],
|
|
977
|
+
let t = [], o = Date.now();
|
|
979
978
|
for (let r = 0; r < e.length; r++) {
|
|
980
|
-
let
|
|
981
|
-
crypto.getRandomValues(
|
|
982
|
-
let
|
|
983
|
-
if (
|
|
984
|
-
let e =
|
|
985
|
-
|
|
979
|
+
let a = e[r], s = a.tags, c = /* @__PURE__ */ new Uint8Array(8);
|
|
980
|
+
crypto.getRandomValues(c);
|
|
981
|
+
let l = (new DataView(c.buffer).getBigUint64(0, !1) ^ BigInt(r)) & 18446744073709551615n, u;
|
|
982
|
+
if (Yn(n)) {
|
|
983
|
+
let e = qn(n.address, o, l);
|
|
984
|
+
u = await ar(a.data, n, s, e);
|
|
986
985
|
} else {
|
|
987
|
-
let e =
|
|
988
|
-
|
|
986
|
+
let e = i(n) ? n.signer : n, t = qn(e.address, o, l);
|
|
987
|
+
u = await or(a.data, e, s, t);
|
|
989
988
|
}
|
|
990
|
-
if (!await
|
|
991
|
-
t.push(
|
|
989
|
+
if (!await lr(u.raw)) throw dr("DataItem verification failed: id=%s modelName=%s", u.id, a.itemPropertyName), Error(`DataItem signature verification failed for ${a.itemPropertyName}. The signing key may not match the owner, or the payload may have been modified.`);
|
|
990
|
+
t.push(u);
|
|
992
991
|
}
|
|
993
|
-
|
|
992
|
+
a = t, r = t.map((t, n) => ({
|
|
994
993
|
transaction: { id: t.id },
|
|
995
994
|
versionId: e[n]?.versionLocalId,
|
|
996
995
|
modelName: e[n]?.itemPropertyName
|
|
997
996
|
}));
|
|
998
997
|
} else throw Error("@seedprotocol/publish: useArweaveBundler requires signDataItems or dataItemSigner (pass at createPublish or in PublishProvider config)");
|
|
999
|
-
let
|
|
998
|
+
let o = e.map((e) => ({
|
|
1000
999
|
itemPropertyName: e.itemPropertyName,
|
|
1001
1000
|
itemPropertyLocalId: e.itemPropertyLocalId,
|
|
1002
1001
|
seedLocalId: e.seedLocalId,
|
|
@@ -1005,51 +1004,51 @@ async function lr(e, t, n) {
|
|
|
1005
1004
|
}));
|
|
1006
1005
|
return {
|
|
1007
1006
|
arweaveTransactions: r,
|
|
1008
|
-
publishUploads:
|
|
1009
|
-
signedDataItems:
|
|
1007
|
+
publishUploads: o,
|
|
1008
|
+
signedDataItems: a
|
|
1010
1009
|
};
|
|
1011
1010
|
}
|
|
1012
|
-
var
|
|
1011
|
+
var pr = L(async ({ input: { context: e } }) => {
|
|
1013
1012
|
let { item: t } = e;
|
|
1014
|
-
t.getPublishUploads || (t = await
|
|
1013
|
+
t.getPublishUploads || (t = await Cn(t.seedLocalId));
|
|
1015
1014
|
let n = {};
|
|
1016
1015
|
e.arweaveUploadTags?.length && (n.arweaveUploadTags = e.arweaveUploadTags);
|
|
1017
1016
|
let r = e.htmlEmbeddedDeferredHtmlSeedLocalIds;
|
|
1018
1017
|
r?.length && (n.deferHtmlStorageSeedLocalIds = r);
|
|
1019
|
-
let i = await
|
|
1020
|
-
return
|
|
1018
|
+
let i = await Hn(t, [], void 0, Object.keys(n).length ? n : void 0), a = T();
|
|
1019
|
+
return fr(i, e.signDataItems ?? a.signDataItems, e.dataItemSigner ?? a.dataItemSigner);
|
|
1021
1020
|
});
|
|
1022
1021
|
//#endregion
|
|
1023
1022
|
//#region src/services/publish/actors/createArweaveDataItemsPhase2.ts
|
|
1024
|
-
async function
|
|
1023
|
+
async function mr(e) {
|
|
1025
1024
|
let { item: t } = e;
|
|
1026
|
-
t.getPublishUploads || (t = await
|
|
1025
|
+
t.getPublishUploads || (t = await Cn(t.seedLocalId));
|
|
1027
1026
|
let n = {};
|
|
1028
1027
|
e.arweaveUploadTags?.length && (n.arweaveUploadTags = e.arweaveUploadTags);
|
|
1029
1028
|
let r = e.htmlEmbeddedDeferredHtmlSeedLocalIds;
|
|
1030
1029
|
r?.length && (n.onlyHtmlStorageSeedLocalIds = r, n.skipRelationRecursion = !0);
|
|
1031
|
-
let i = await
|
|
1030
|
+
let i = await Hn(t, [], void 0, Object.keys(n).length ? n : void 0), a = T(), o = e.signDataItems ?? a.signDataItems, s = e.dataItemSigner ?? a.dataItemSigner;
|
|
1032
1031
|
return i.length === 0 ? {
|
|
1033
1032
|
arweaveTransactions: [],
|
|
1034
1033
|
publishUploads: [],
|
|
1035
1034
|
signedDataItems: void 0
|
|
1036
|
-
} :
|
|
1035
|
+
} : fr(i, o, s);
|
|
1037
1036
|
}
|
|
1038
|
-
var
|
|
1039
|
-
function
|
|
1037
|
+
var hr = L(async ({ input: { context: e } }) => mr(e)), gr = 8192;
|
|
1038
|
+
function _r(e) {
|
|
1040
1039
|
let t = new Uint8Array(e), n = "";
|
|
1041
|
-
for (let e = 0; e < t.length; e +=
|
|
1042
|
-
let r = t.subarray(e, Math.min(e +
|
|
1040
|
+
for (let e = 0; e < t.length; e += gr) {
|
|
1041
|
+
let r = t.subarray(e, Math.min(e + gr, t.length));
|
|
1043
1042
|
n += String.fromCharCode.apply(null, r);
|
|
1044
1043
|
}
|
|
1045
1044
|
return btoa(n);
|
|
1046
1045
|
}
|
|
1047
|
-
async function
|
|
1046
|
+
async function vr(e) {
|
|
1048
1047
|
let t = [];
|
|
1049
1048
|
for (let [n, r] of e.entries()) {
|
|
1050
1049
|
let e = r;
|
|
1051
1050
|
if (typeof e == "object" && e && "arrayBuffer" in e) {
|
|
1052
|
-
let r =
|
|
1051
|
+
let r = _r(await e.arrayBuffer()), i = e;
|
|
1053
1052
|
t.push({
|
|
1054
1053
|
name: n,
|
|
1055
1054
|
value: r,
|
|
@@ -1063,19 +1062,19 @@ async function hr(e) {
|
|
|
1063
1062
|
}
|
|
1064
1063
|
return t;
|
|
1065
1064
|
}
|
|
1066
|
-
function
|
|
1065
|
+
function yr(e, t, n) {
|
|
1067
1066
|
let r = ["Upload server returned ", String(e)], i = t && typeof t == "object" && "message" in t ? String(t.message) : t && typeof t == "object" && "error" in t ? String(t.error) : null;
|
|
1068
1067
|
return i ? r.push(`: ${i}`) : n && r.push(` (${n})`), r.join("");
|
|
1069
1068
|
}
|
|
1070
|
-
function
|
|
1069
|
+
function br(e) {
|
|
1071
1070
|
if (!e) return "Upload server unavailable. Please try again or check your connection.";
|
|
1072
1071
|
let t = e.toLowerCase();
|
|
1073
1072
|
return /other side closed|econnreset|socket hang up|connection closed/i.test(t) ? "Upload server closed the connection. It may be busy or the request may be too large—try again." : /etimedout|timeout/i.test(t) ? "Upload request timed out. Please try again." : /enotfound|getaddrinfo|dns/i.test(t) ? "Upload server could not be reached. Check the upload URL and your network." : "Upload failed. Please try again or check the upload server.";
|
|
1074
1073
|
}
|
|
1075
|
-
async function
|
|
1074
|
+
async function xr(e, t, n) {
|
|
1076
1075
|
let r = typeof window < "u" ? window.Main : void 0;
|
|
1077
1076
|
if (r?.uploadArweaveStart) {
|
|
1078
|
-
let n = await
|
|
1077
|
+
let n = await vr(t);
|
|
1079
1078
|
return r.uploadArweaveStart(e, n);
|
|
1080
1079
|
}
|
|
1081
1080
|
let i = await fetch(e, {
|
|
@@ -1089,7 +1088,7 @@ async function vr(e, t, n) {
|
|
|
1089
1088
|
}
|
|
1090
1089
|
//#endregion
|
|
1091
1090
|
//#region src/services/publish/actors/sendReimbursementRequest.ts
|
|
1092
|
-
var
|
|
1091
|
+
var Sr = L(async ({ input: { context: e, event: t } }) => {
|
|
1093
1092
|
let { arweaveTransactions: n = [], transactionKeys: r, reimbursementTransactionId: i } = e;
|
|
1094
1093
|
if (i) return { transactionId: i };
|
|
1095
1094
|
let a = n.map(({ transaction: e }) => e), o = new FormData();
|
|
@@ -1101,15 +1100,15 @@ var yr = L(async ({ input: { context: e, event: t } }) => {
|
|
|
1101
1100
|
let s = new Blob([JSON.stringify(r)], { type: "application/json" });
|
|
1102
1101
|
o.append(`${e.id}-json`, s, `${e.id}-json`);
|
|
1103
1102
|
}
|
|
1104
|
-
let { uploadApiBaseUrl: s } =
|
|
1103
|
+
let { uploadApiBaseUrl: s } = T(), { status: c, body: l, message: u } = await xr(`${s}/api/upload/arweave/start`, o, s);
|
|
1105
1104
|
if (c >= 300 || c < 200) {
|
|
1106
1105
|
let e = c === 0 ? u : null;
|
|
1107
1106
|
e && console.error("[upload]", e);
|
|
1108
|
-
let t = c === 0 ?
|
|
1107
|
+
let t = c === 0 ? br(e) : yr(c, l, r);
|
|
1109
1108
|
throw Error(t);
|
|
1110
1109
|
}
|
|
1111
1110
|
return l;
|
|
1112
|
-
}),
|
|
1111
|
+
}), Cr = L(async ({ input: { context: e, event: t } }) => {
|
|
1113
1112
|
let { requestResponse: n, reimbursementTransactionId: r } = e;
|
|
1114
1113
|
if (!n) throw Error("No request response");
|
|
1115
1114
|
if (!r) throw Error("No reimbursement transaction id");
|
|
@@ -1126,12 +1125,12 @@ var yr = L(async ({ input: { context: e, event: t } }) => {
|
|
|
1126
1125
|
}, 5e3);
|
|
1127
1126
|
});
|
|
1128
1127
|
}), G = R("seedProtocol:services:publish:actors");
|
|
1129
|
-
function
|
|
1128
|
+
function wr(e) {
|
|
1130
1129
|
if (e instanceof Uint8Array) return e;
|
|
1131
1130
|
if (e instanceof ArrayBuffer) return new Uint8Array(e);
|
|
1132
1131
|
throw Error("Transaction data must be Uint8Array or ArrayBuffer for upload resume");
|
|
1133
1132
|
}
|
|
1134
|
-
var
|
|
1133
|
+
var Tr = zt(({ sendBack: e, input: t }) => {
|
|
1135
1134
|
let n = t.context, r = (n.arweaveTransactions ?? []).map(({ transaction: e }) => e), i = B(), a = n.uploaderState && typeof n.currentTransactionIndex == "number", o = a ? n.currentTransactionIndex : 0;
|
|
1136
1135
|
(async () => {
|
|
1137
1136
|
let t = r.length;
|
|
@@ -1142,7 +1141,7 @@ var Sr = It(({ sendBack: e, input: t }) => {
|
|
|
1142
1141
|
if (!await i.transactions.verify(l)) throw Error("Transaction verification failed");
|
|
1143
1142
|
let u, d = n.uploaderState;
|
|
1144
1143
|
if (a && s === o && d) {
|
|
1145
|
-
let e = l.data, t = e instanceof Uint8Array ? e :
|
|
1144
|
+
let e = l.data, t = e instanceof Uint8Array ? e : wr(e);
|
|
1146
1145
|
u = await i.transactions.getUploader(d, t);
|
|
1147
1146
|
} else u = await i.transactions.getUploader(l, l.data);
|
|
1148
1147
|
for (; !u.isComplete;) {
|
|
@@ -1171,20 +1170,20 @@ var Sr = It(({ sendBack: e, input: t }) => {
|
|
|
1171
1170
|
error: t
|
|
1172
1171
|
});
|
|
1173
1172
|
});
|
|
1174
|
-
}),
|
|
1175
|
-
if (
|
|
1173
|
+
}), Er = 12e4, Dr = Function("s", "return import(s)"), Or = null, kr = async () => {
|
|
1174
|
+
if (Or) return Or;
|
|
1176
1175
|
if (typeof window < "u") return null;
|
|
1177
1176
|
try {
|
|
1178
|
-
let e = await
|
|
1179
|
-
return
|
|
1177
|
+
let e = await Dr(`node:${["fs", "promises"].join("/")}`);
|
|
1178
|
+
return Or = {
|
|
1180
1179
|
readFile: e.readFile,
|
|
1181
1180
|
stat: e.stat
|
|
1182
|
-
},
|
|
1181
|
+
}, Or;
|
|
1183
1182
|
} catch {
|
|
1184
1183
|
return null;
|
|
1185
1184
|
}
|
|
1186
|
-
},
|
|
1187
|
-
let { signedDataItems: n } = t, { uploadApiBaseUrl: r, useArweaveBundler: i } =
|
|
1185
|
+
}, Ar = zt(({ sendBack: e, input: { context: t } }) => {
|
|
1186
|
+
let { signedDataItems: n } = t, { uploadApiBaseUrl: r, useArweaveBundler: i } = T();
|
|
1188
1187
|
if (!i || !r) {
|
|
1189
1188
|
e({
|
|
1190
1189
|
type: "uploadError",
|
|
@@ -1209,7 +1208,7 @@ var Sr = It(({ sendBack: e, input: t }) => {
|
|
|
1209
1208
|
return r[t] = a, a.length;
|
|
1210
1209
|
}
|
|
1211
1210
|
if (n.filename != null) {
|
|
1212
|
-
let e = await
|
|
1211
|
+
let e = await kr();
|
|
1213
1212
|
if (!e) throw Error("DataItem.filename requires Node.js fs access. In browser runtime, provide DataItem.raw or DataItem.getRaw().");
|
|
1214
1213
|
return (await e.stat(n.filename)).size;
|
|
1215
1214
|
}
|
|
@@ -1233,7 +1232,7 @@ var Sr = It(({ sendBack: e, input: t }) => {
|
|
|
1233
1232
|
continue;
|
|
1234
1233
|
}
|
|
1235
1234
|
if (a.filename != null) {
|
|
1236
|
-
let e = await
|
|
1235
|
+
let e = await kr();
|
|
1237
1236
|
if (!e) throw Error("DataItem.filename requires Node.js fs access. In browser runtime, provide DataItem.raw or DataItem.getRaw().");
|
|
1238
1237
|
let t = await e.readFile(a.filename);
|
|
1239
1238
|
c.writeUInt32BE(t.length, l), l += 4, t.copy(c, l), l += t.length;
|
|
@@ -1241,7 +1240,7 @@ var Sr = It(({ sendBack: e, input: t }) => {
|
|
|
1241
1240
|
}
|
|
1242
1241
|
throw Error("Cannot get raw bytes from DataItem");
|
|
1243
1242
|
}
|
|
1244
|
-
let u = new AbortController(), d = setTimeout(() => u.abort(),
|
|
1243
|
+
let u = new AbortController(), d = setTimeout(() => u.abort(), Er), f;
|
|
1245
1244
|
try {
|
|
1246
1245
|
f = await fetch(a, {
|
|
1247
1246
|
method: "POST",
|
|
@@ -1250,7 +1249,7 @@ var Sr = It(({ sendBack: e, input: t }) => {
|
|
|
1250
1249
|
signal: u.signal
|
|
1251
1250
|
});
|
|
1252
1251
|
} catch (e) {
|
|
1253
|
-
throw clearTimeout(d), e instanceof Error && e.name === "AbortError" ? Error(`Arweave batch upload timed out after ${
|
|
1252
|
+
throw clearTimeout(d), e instanceof Error && e.name === "AbortError" ? Error(`Arweave batch upload timed out after ${Er / 1e3}s (upload API did not respond). Check uploadApiBaseUrl and network.`) : e;
|
|
1254
1253
|
}
|
|
1255
1254
|
if (clearTimeout(d), !f.ok) throw Error(`Batch upload failed: ${f.status}`);
|
|
1256
1255
|
let p = await f.json().catch(() => ({})), m = typeof p.failed == "number" ? p.failed : 0;
|
|
@@ -1265,50 +1264,108 @@ var Sr = It(({ sendBack: e, input: t }) => {
|
|
|
1265
1264
|
type: "uploadError",
|
|
1266
1265
|
error: t
|
|
1267
1266
|
}));
|
|
1268
|
-
}),
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1267
|
+
}), jr = 12000n;
|
|
1268
|
+
function Mr(e) {
|
|
1269
|
+
return "paymasterAndData" in e && e.paymasterAndData ? e.paymasterAndData : "0x";
|
|
1270
|
+
}
|
|
1271
|
+
function Nr(e, t, n) {
|
|
1272
|
+
return async (r) => {
|
|
1273
|
+
if (D("paymaster hook called (userOp from thirdweb; callGasLimit is tx.gas or 0)", {
|
|
1274
|
+
sender: r.sender,
|
|
1275
|
+
chainId: t.id,
|
|
1276
|
+
bundlerUrl: n ?? "(thirdweb default)",
|
|
1277
|
+
entryPoint: "initCode" in r ? "v0.6" : "v0.7",
|
|
1278
|
+
...S(r)
|
|
1279
|
+
}), !("initCode" in r)) throw Error("@seedprotocol/publish: the managed account sent an EntryPoint v0.7 UserOp; its sponsored gas handling only supports EntryPoint v0.6.");
|
|
1280
|
+
let i = typeof e == "function" ? e() : e, a = await qt({
|
|
1281
|
+
userOp: r,
|
|
1282
|
+
client: i,
|
|
1283
|
+
chain: t
|
|
1284
|
+
});
|
|
1285
|
+
D("1/3 paymaster sponsored (limits here are ignored)", S(a));
|
|
1286
|
+
let o = {
|
|
1287
|
+
...r,
|
|
1288
|
+
paymasterAndData: Mr(a)
|
|
1289
|
+
}, s = await Kt({
|
|
1290
|
+
userOp: o,
|
|
1291
|
+
options: {
|
|
1292
|
+
client: i,
|
|
1293
|
+
chain: t,
|
|
1294
|
+
bundlerUrl: n
|
|
1295
|
+
}
|
|
1296
|
+
});
|
|
1297
|
+
D("2/3 bundler estimate (callGasLimit includes thirdweb's +50k)", S(s));
|
|
1298
|
+
let c = s.callGasLimit * jr / 10000n;
|
|
1299
|
+
o.callGasLimit = r.callGasLimit > c ? r.callGasLimit : c, o.verificationGasLimit = s.verificationGasLimit, o.preVerificationGas = s.preVerificationGas, D("raised limits sent to the paymaster for signing", {
|
|
1300
|
+
...S(o),
|
|
1301
|
+
headroomBps: jr,
|
|
1302
|
+
raisedEstimate: c,
|
|
1303
|
+
txGas: r.callGasLimit
|
|
1304
|
+
});
|
|
1305
|
+
let l = await qt({
|
|
1306
|
+
userOp: o,
|
|
1307
|
+
client: i,
|
|
1308
|
+
chain: t
|
|
1309
|
+
});
|
|
1310
|
+
if (D("3/3 paymaster signed", S(l)), l.callGasLimit && l.verificationGasLimit && l.preVerificationGas) return D("returning to thirdweb: the PAYMASTER's own limits (its signature covers them)", {
|
|
1311
|
+
...S(l),
|
|
1312
|
+
requestedCallGasLimit: o.callGasLimit
|
|
1313
|
+
}), l;
|
|
1314
|
+
let u = {
|
|
1315
|
+
paymasterAndData: Mr(l),
|
|
1316
|
+
callGasLimit: o.callGasLimit,
|
|
1317
|
+
verificationGasLimit: o.verificationGasLimit,
|
|
1318
|
+
preVerificationGas: o.preVerificationGas
|
|
1319
|
+
};
|
|
1320
|
+
return D("returning to thirdweb: our raised limits (thirdweb should send exactly these)", S(u)), u;
|
|
1321
|
+
};
|
|
1322
|
+
}
|
|
1323
|
+
//#endregion
|
|
1324
|
+
//#region src/helpers/thirdweb.ts
|
|
1325
|
+
var Pr = /* @__PURE__ */ e({
|
|
1326
|
+
ExternalWalletsForDeploy: () => Jr,
|
|
1327
|
+
appMetadata: () => Zr,
|
|
1328
|
+
deployManagedAccountViaFactory: () => Xr,
|
|
1329
|
+
deploySmartWalletContract: () => Yr,
|
|
1330
|
+
getConnectedAccount: () => $r,
|
|
1331
|
+
getConnectedManagedAccountAddress: () => Qr,
|
|
1332
|
+
getConnectedModularAccount: () => ei,
|
|
1333
|
+
getManagedAccountWallet: () => ii,
|
|
1334
|
+
getModularAccountWallet: () => oi,
|
|
1335
|
+
getSharedPublishInAppWalletStorage: () => Rr,
|
|
1336
|
+
getSmartWalletAddressForAdmin: () => Wr,
|
|
1337
|
+
getWalletsForConnectButton: () => si,
|
|
1338
|
+
isSmartWalletDeployed: () => Gr,
|
|
1339
|
+
pollSmartWalletDeployed: () => Kr,
|
|
1340
|
+
resolveSmartWalletForPublish: () => qr,
|
|
1341
|
+
syncPublishInAppAuthToken: () => zr,
|
|
1342
|
+
useActiveSmartWalletContract: () => Ur,
|
|
1343
|
+
useLocalWalletAccount: () => Hr,
|
|
1344
|
+
wallets: () => Vr
|
|
1345
|
+
}), Fr = R("permaPress:helpers:thirdweb"), Ir = "seedProtocol:inAppPublish:", Lr = null;
|
|
1346
|
+
function Rr() {
|
|
1347
|
+
return Lr ||= {
|
|
1348
|
+
getItem: async (e) => typeof window > "u" ? null : localStorage.getItem(Ir + e),
|
|
1292
1349
|
setItem: async (e, t) => {
|
|
1293
|
-
typeof window > "u" || localStorage.setItem(
|
|
1350
|
+
typeof window > "u" || localStorage.setItem(Ir + e, t);
|
|
1294
1351
|
},
|
|
1295
1352
|
removeItem: async (e) => {
|
|
1296
|
-
typeof window > "u" || localStorage.removeItem(
|
|
1353
|
+
typeof window > "u" || localStorage.removeItem(Ir + e);
|
|
1297
1354
|
}
|
|
1298
|
-
},
|
|
1355
|
+
}, Lr;
|
|
1299
1356
|
}
|
|
1300
|
-
function
|
|
1357
|
+
function zr() {
|
|
1301
1358
|
if (typeof window > "u") return {
|
|
1302
1359
|
syncedBareToPrefixed: !1,
|
|
1303
1360
|
syncedPrefixedToBare: !1
|
|
1304
1361
|
};
|
|
1305
|
-
let { thirdwebClientId: e } =
|
|
1362
|
+
let { thirdwebClientId: e } = T();
|
|
1306
1363
|
if (!e) return {
|
|
1307
1364
|
syncedBareToPrefixed: !1,
|
|
1308
1365
|
syncedPrefixedToBare: !1
|
|
1309
1366
|
};
|
|
1310
1367
|
try {
|
|
1311
|
-
let t = `walletToken-${e}`, n = `${
|
|
1368
|
+
let t = `walletToken-${e}`, n = `${Ir}${t}`, r = localStorage.getItem(t), i = localStorage.getItem(n), a = !1, o = !1;
|
|
1312
1369
|
return r && !i && (localStorage.setItem(n, r), a = !0), i && !r && (localStorage.setItem(t, i), o = !0), i && r && r !== i && (localStorage.setItem(t, i), o = !0), {
|
|
1313
1370
|
syncedBareToPrefixed: a,
|
|
1314
1371
|
syncedPrefixedToBare: o
|
|
@@ -1320,102 +1377,102 @@ function Nr() {
|
|
|
1320
1377
|
};
|
|
1321
1378
|
}
|
|
1322
1379
|
}
|
|
1323
|
-
async function
|
|
1324
|
-
|
|
1325
|
-
let t =
|
|
1380
|
+
async function Br(e = O()) {
|
|
1381
|
+
zr();
|
|
1382
|
+
let t = ii();
|
|
1326
1383
|
return await t.autoConnect({
|
|
1327
1384
|
client: k(),
|
|
1328
1385
|
chain: e
|
|
1329
1386
|
}), t;
|
|
1330
1387
|
}
|
|
1331
|
-
var
|
|
1332
|
-
let [e, t] =
|
|
1333
|
-
return
|
|
1334
|
-
},
|
|
1335
|
-
let e =
|
|
1336
|
-
return
|
|
1337
|
-
e && e.address && n(
|
|
1388
|
+
var Vr = [Ut("io.metamask")], Hr = () => {
|
|
1389
|
+
let [e, t] = At(null);
|
|
1390
|
+
return Ut("io.metamask"), kt(!1), Ot(() => {}, []), e;
|
|
1391
|
+
}, Ur = () => {
|
|
1392
|
+
let e = Gt(), [t, n] = At(null);
|
|
1393
|
+
return Ot(() => {
|
|
1394
|
+
e && e.address && n(dt({
|
|
1338
1395
|
client: k(),
|
|
1339
|
-
chain:
|
|
1396
|
+
chain: O(),
|
|
1340
1397
|
address: e.address
|
|
1341
1398
|
}));
|
|
1342
1399
|
}, [e]), t;
|
|
1343
1400
|
};
|
|
1344
|
-
async function
|
|
1345
|
-
return
|
|
1401
|
+
async function Wr(e, t = "0x") {
|
|
1402
|
+
return _(e, t);
|
|
1346
1403
|
}
|
|
1347
|
-
async function
|
|
1348
|
-
return
|
|
1404
|
+
async function Gr(e) {
|
|
1405
|
+
return ce(e);
|
|
1349
1406
|
}
|
|
1350
|
-
async function
|
|
1351
|
-
return
|
|
1407
|
+
async function Kr(e, t, n) {
|
|
1408
|
+
return ve(e, t, n);
|
|
1352
1409
|
}
|
|
1353
|
-
async function
|
|
1410
|
+
async function qr(e) {
|
|
1354
1411
|
if (!e) return { needsDeploy: !0 };
|
|
1355
|
-
if (await
|
|
1412
|
+
if (await Gr(e.address)) return {
|
|
1356
1413
|
address: e.address,
|
|
1357
1414
|
account: e
|
|
1358
1415
|
};
|
|
1359
|
-
let t = await
|
|
1360
|
-
return await
|
|
1416
|
+
let t = await Wr(e.address);
|
|
1417
|
+
return await Gr(t) ? {
|
|
1361
1418
|
address: t,
|
|
1362
1419
|
account: e
|
|
1363
1420
|
} : { needsDeploy: !0 };
|
|
1364
1421
|
}
|
|
1365
|
-
var
|
|
1366
|
-
let t =
|
|
1422
|
+
var Jr = [Ut("io.metamask"), Ut("me.rainbow")], Yr = async (e) => {
|
|
1423
|
+
let t = dt({
|
|
1367
1424
|
client: k(),
|
|
1368
|
-
chain:
|
|
1425
|
+
chain: O(),
|
|
1369
1426
|
address: e.address
|
|
1370
|
-
}), n = await
|
|
1427
|
+
}), n = await ut({
|
|
1371
1428
|
smartAccount: e,
|
|
1372
|
-
chain:
|
|
1429
|
+
chain: O(),
|
|
1373
1430
|
client: k(),
|
|
1374
1431
|
accountContract: t
|
|
1375
1432
|
});
|
|
1376
|
-
return
|
|
1433
|
+
return Fr("deploySmartAccount result:", n), n;
|
|
1377
1434
|
};
|
|
1378
|
-
async function
|
|
1379
|
-
let { asThirdwebPublishWallet: t } = await import("./chainConfig-
|
|
1435
|
+
async function Xr(e) {
|
|
1436
|
+
let { asThirdwebPublishWallet: t } = await import("./chainConfig-DWzoOtkS.js").then((e) => e.g), n = t(e.signingAccount), r = b(e.adminAddress, e.data ?? "0x");
|
|
1380
1437
|
await n.txSender.sendTransaction(r);
|
|
1381
1438
|
}
|
|
1382
|
-
var
|
|
1439
|
+
var Zr = {
|
|
1383
1440
|
name: "Seed Protocol",
|
|
1384
1441
|
description: "Seed Protocol",
|
|
1385
1442
|
url: "https://seedprotocol.io"
|
|
1386
1443
|
};
|
|
1387
|
-
async function
|
|
1388
|
-
let t = (await
|
|
1444
|
+
async function Qr(e = O()) {
|
|
1445
|
+
let t = (await Br(e)).getAccount();
|
|
1389
1446
|
if (!t) throw Error("Failed to get managed account");
|
|
1390
1447
|
return t.address;
|
|
1391
1448
|
}
|
|
1392
|
-
async function
|
|
1449
|
+
async function $r() {
|
|
1393
1450
|
try {
|
|
1394
|
-
let e =
|
|
1451
|
+
let e = oi();
|
|
1395
1452
|
return await e.autoConnect({
|
|
1396
1453
|
client: k(),
|
|
1397
|
-
chain:
|
|
1454
|
+
chain: O()
|
|
1398
1455
|
}), e.getAccount() ?? null;
|
|
1399
1456
|
} catch {
|
|
1400
1457
|
return null;
|
|
1401
1458
|
}
|
|
1402
1459
|
}
|
|
1403
|
-
async function
|
|
1404
|
-
return
|
|
1460
|
+
async function ei() {
|
|
1461
|
+
return $r();
|
|
1405
1462
|
}
|
|
1406
|
-
function
|
|
1407
|
-
let t =
|
|
1463
|
+
function ti(e) {
|
|
1464
|
+
let t = O(e).id, n = e.managedAccountFactoryAddress ?? h[t];
|
|
1408
1465
|
if (!n) throw Error(`@seedprotocol/publish: no ManagedAccount factory is known for chain ${t}. Pass managedAccountFactoryAddress in publish config, or use the EOA / direct EAS path.`);
|
|
1409
1466
|
return n;
|
|
1410
1467
|
}
|
|
1411
|
-
var
|
|
1468
|
+
var ni = [
|
|
1412
1469
|
"farcaster",
|
|
1413
1470
|
"email",
|
|
1414
1471
|
"passkey",
|
|
1415
1472
|
"phone"
|
|
1416
|
-
],
|
|
1417
|
-
let t = e ??
|
|
1418
|
-
if (!i &&
|
|
1473
|
+
], ri = null, ii = (e) => {
|
|
1474
|
+
let t = e ?? re(), n = O(t ?? void 0), r = t ? ti(t) : se(), { bundlerUrl: i, sponsorGas: a } = we(t);
|
|
1475
|
+
if (!i && ae(n)) throw Error(`@seedprotocol/publish: chain ${n.id} is local, so Thirdweb's hosted bundler cannot reach it. Set PublishConfig.thirdweb.bundlerUrl to the chain's bundler (seedTwinConfig does this for the twin).`);
|
|
1419
1476
|
let o = [
|
|
1420
1477
|
n.id,
|
|
1421
1478
|
n.rpc,
|
|
@@ -1423,100 +1480,183 @@ var Xr = [
|
|
|
1423
1480
|
i ?? "",
|
|
1424
1481
|
a
|
|
1425
1482
|
].join("|").toLowerCase();
|
|
1426
|
-
return
|
|
1483
|
+
return ri?.key !== o && (D("managed wallet built", {
|
|
1484
|
+
chainId: n.id,
|
|
1485
|
+
sponsorGas: a,
|
|
1486
|
+
bundlerUrl: i ?? "(thirdweb default)",
|
|
1487
|
+
paymasterHook: a ? "installed" : "none (thirdweb estimates callGasLimit itself)"
|
|
1488
|
+
}), ri = {
|
|
1427
1489
|
key: o,
|
|
1428
|
-
wallet:
|
|
1429
|
-
storage:
|
|
1430
|
-
auth: { options: [...
|
|
1490
|
+
wallet: Wt({
|
|
1491
|
+
storage: Rr(),
|
|
1492
|
+
auth: { options: [...ni] },
|
|
1431
1493
|
executionMode: {
|
|
1432
1494
|
mode: "EIP4337",
|
|
1433
1495
|
smartAccount: {
|
|
1434
1496
|
chain: n,
|
|
1435
1497
|
factoryAddress: r,
|
|
1436
1498
|
sponsorGas: a,
|
|
1437
|
-
...i ? { overrides: {
|
|
1499
|
+
...i || a ? { overrides: {
|
|
1500
|
+
...i ? { bundlerUrl: i } : {},
|
|
1501
|
+
...a ? { paymaster: Nr(k, n, i) } : {}
|
|
1502
|
+
} } : {}
|
|
1438
1503
|
}
|
|
1439
1504
|
}
|
|
1440
1505
|
})
|
|
1441
|
-
}),
|
|
1442
|
-
},
|
|
1443
|
-
let t = e ??
|
|
1506
|
+
}), ri.wallet;
|
|
1507
|
+
}, ai = null, oi = (e) => {
|
|
1508
|
+
let t = e ?? re(), { modularWalletMode: n, sponsorGas: r } = we(t);
|
|
1444
1509
|
if (n === "EIP7702") {
|
|
1445
|
-
let e =
|
|
1446
|
-
if (
|
|
1510
|
+
let e = O(t ?? void 0);
|
|
1511
|
+
if (ae(e)) throw Error(`@seedprotocol/publish: chain ${e.id} is local, and Thirdweb's EIP-7702 mode needs its hosted bundler, which cannot reach it. Set PublishConfig.thirdweb.modularWalletMode to 'EOA' and fund the in-app EOA (seedTwinConfig does this for the twin).`);
|
|
1447
1512
|
}
|
|
1448
1513
|
let i = `${n}|${r}`;
|
|
1449
|
-
return
|
|
1514
|
+
return ai?.key !== i && (ai = {
|
|
1450
1515
|
key: i,
|
|
1451
|
-
wallet:
|
|
1452
|
-
storage:
|
|
1453
|
-
auth: { options: [...
|
|
1516
|
+
wallet: Wt({
|
|
1517
|
+
storage: Rr(),
|
|
1518
|
+
auth: { options: [...ni] },
|
|
1454
1519
|
executionMode: n === "EOA" ? { mode: "EOA" } : {
|
|
1455
1520
|
mode: "EIP7702",
|
|
1456
1521
|
sponsorGas: r
|
|
1457
1522
|
}
|
|
1458
1523
|
})
|
|
1459
|
-
}),
|
|
1460
|
-
},
|
|
1461
|
-
let t = e ??
|
|
1462
|
-
return t?.useModularExecutor ? [
|
|
1463
|
-
},
|
|
1464
|
-
|
|
1465
|
-
let
|
|
1466
|
-
if (!
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1524
|
+
}), ai.wallet;
|
|
1525
|
+
}, si = (e) => {
|
|
1526
|
+
let t = e ?? re() ?? void 0;
|
|
1527
|
+
return t?.useModularExecutor ? [oi(t)] : [ii(t)];
|
|
1528
|
+
}, ci = "This ManagedAccount predates the Seed executor router extension, so the Seed executor cannot act for it and publish automation is not available for this account.", li = "The Seed executor is not installed for this ManagedAccount, so automation session keys cannot publish through it. The account admin installs it (installSeedExecutor), which enrollPublishAutomation does.", ui = "The Seed executor module is configured with a different EAS contract for this ManagedAccount than publish config. Automation session keys cannot change it.", di = "Could not read the Seed executor module state for this ManagedAccount.";
|
|
1529
|
+
function fi() {
|
|
1530
|
+
let e = T().modularAccountModuleContract?.trim();
|
|
1531
|
+
if (!e || !/^0x[0-9a-fA-F]{40}$/.test(e)) throw Error("@seedprotocol/publish: publish automation requires PublishConfig.modularAccountModuleContract (executor module).");
|
|
1532
|
+
return e;
|
|
1533
|
+
}
|
|
1534
|
+
async function pi(e) {
|
|
1535
|
+
return await ie(e) === null;
|
|
1536
|
+
}
|
|
1537
|
+
async function mi(e, t = {}) {
|
|
1538
|
+
let n = fi(), r = e, i, a;
|
|
1539
|
+
if (t.installedEas) i = !0, a = t.installedEas;
|
|
1540
|
+
else try {
|
|
1541
|
+
i = await Te(() => te(n, r), Boolean, { attempts: t.readAttempts ?? 1 }), a = i ? await x(n, r) : lt;
|
|
1542
|
+
} catch (t) {
|
|
1543
|
+
throw new w(di, "AUTOMATION_UNSUPPORTED_ACCOUNT", e, t);
|
|
1471
1544
|
}
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1545
|
+
if (!i) {
|
|
1546
|
+
let t = await pi(r) ? ci : li;
|
|
1547
|
+
throw new w(t, "AUTOMATION_UNSUPPORTED_ACCOUNT", e);
|
|
1548
|
+
}
|
|
1549
|
+
let o = T().easContractAddress?.toLowerCase();
|
|
1550
|
+
if (o && a.toLowerCase() !== o) throw new w(ui, "AUTOMATION_UNSUPPORTED_ACCOUNT", e);
|
|
1551
|
+
}
|
|
1552
|
+
function hi(e) {
|
|
1553
|
+
let t = e instanceof rt ? `${e.shortMessage} ${e.details} ${e.message}` : String(e);
|
|
1554
|
+
return /insufficient funds|insufficient balance/i.test(t);
|
|
1555
|
+
}
|
|
1556
|
+
async function gi(e) {
|
|
1557
|
+
let { managedAddress: t, tx: n, action: r, code: i = "AUTOMATION_PREFLIGHT_FAILED", requireSimulation: a = !0 } = e, o = (e) => Ce().call({
|
|
1558
|
+
account: t,
|
|
1559
|
+
to: n.to,
|
|
1560
|
+
data: n.data,
|
|
1561
|
+
value: n.value,
|
|
1562
|
+
...e ? { stateOverride: [{
|
|
1563
|
+
address: t,
|
|
1564
|
+
balance: st("1000")
|
|
1565
|
+
}] } : {}
|
|
1476
1566
|
});
|
|
1477
1567
|
try {
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
} catch (t) {
|
|
1490
|
-
if (Ce(t)) return;
|
|
1491
|
-
throw new O(ni(), "EXECUTOR_MODULE_NOT_INSTALLED", e, t);
|
|
1568
|
+
try {
|
|
1569
|
+
await o(!1);
|
|
1570
|
+
} catch (e) {
|
|
1571
|
+
if (!hi(e)) throw e;
|
|
1572
|
+
await o(!0);
|
|
1573
|
+
}
|
|
1574
|
+
} catch (e) {
|
|
1575
|
+
let n = Qt(e);
|
|
1576
|
+
if (!n && !a) return;
|
|
1577
|
+
let o = n ? en(Zt(e)) : "could not be simulated";
|
|
1578
|
+
throw new w(`Simulated ${r} from ${t} ${o}; nothing was sent.`, i, t, e);
|
|
1492
1579
|
}
|
|
1493
1580
|
}
|
|
1494
|
-
|
|
1495
|
-
|
|
1581
|
+
//#endregion
|
|
1582
|
+
//#region src/helpers/ensureExecutorModule.ts
|
|
1583
|
+
var _i = () => `The executor module could not be installed on your publishing account on ${E()}. Reconnect and try again, or contact support if this persists.`;
|
|
1584
|
+
async function vi(e, t, n) {
|
|
1585
|
+
let { modularAccountModuleContract: r } = n;
|
|
1586
|
+
if (!r || !await ce(e)) return { status: "skipped" };
|
|
1587
|
+
let i = await ie(e);
|
|
1588
|
+
return i ? yi(e, i.executor, r) : { status: "skipped" };
|
|
1589
|
+
}
|
|
1590
|
+
async function yi(e, t, n) {
|
|
1591
|
+
if (t.toLowerCase() !== n.trim().toLowerCase()) throw new w(`Your publishing account's Seed executor is ${t}, but publish config sets modularAccountModuleContract to ${n}. Point modularAccountModuleContract at the account's executor.`, "EXECUTOR_MODULE_NOT_INSTALLED", e);
|
|
1592
|
+
let r = e, i, a, o;
|
|
1496
1593
|
try {
|
|
1497
|
-
if (await
|
|
1498
|
-
let { getManagedAccountAdmin: n } = await import("./managedAccountAdmin-
|
|
1499
|
-
|
|
1594
|
+
if (await me(r, t)) return { status: "already-installed" };
|
|
1595
|
+
let { getManagedAccountAdmin: n } = await import("./managedAccountAdmin-B4HkLWWE.js").then((e) => e.n), s = fe(await n(e));
|
|
1596
|
+
i = s.txSender.address;
|
|
1597
|
+
let c = await s.txSender.sendTransaction(f(r));
|
|
1598
|
+
o = c.transactionHash;
|
|
1599
|
+
try {
|
|
1600
|
+
a = await C(c.transactionHash);
|
|
1601
|
+
} catch (e) {
|
|
1602
|
+
if (!(e instanceof pe)) throw e;
|
|
1603
|
+
}
|
|
1500
1604
|
} catch (t) {
|
|
1501
|
-
throw t instanceof
|
|
1605
|
+
throw t instanceof w ? t : new w(_i(), "EXECUTOR_MODULE_NOT_INSTALLED", e, t);
|
|
1606
|
+
}
|
|
1607
|
+
let s = a && bi(a, r, t);
|
|
1608
|
+
if (s) return {
|
|
1609
|
+
status: "installed",
|
|
1610
|
+
eas: s,
|
|
1611
|
+
transactionHash: o
|
|
1612
|
+
};
|
|
1613
|
+
let c = await xi(r, i);
|
|
1614
|
+
if (c === "already-installed") return { status: "already-installed" };
|
|
1615
|
+
throw new w(`installSeedExecutor in transaction ${o} did not install the Seed executor on ${e}${c ? `: ${c}` : ""}.`, "EXECUTOR_MODULE_NOT_INSTALLED", e);
|
|
1616
|
+
}
|
|
1617
|
+
function bi(e, t, n) {
|
|
1618
|
+
if (P({
|
|
1619
|
+
abi: oe,
|
|
1620
|
+
eventName: "SeedExecutorInstalled",
|
|
1621
|
+
logs: e.logs,
|
|
1622
|
+
strict: !1
|
|
1623
|
+
}).some((e) => ot(e.address, t) && e.args.executor && ot(e.args.executor, n))) return P({
|
|
1624
|
+
abi: y,
|
|
1625
|
+
eventName: "ModuleInitialized",
|
|
1626
|
+
logs: e.logs,
|
|
1627
|
+
strict: !1
|
|
1628
|
+
}).find((e) => ot(e.address, n) && e.args.account && ot(e.args.account, t))?.args.eas;
|
|
1629
|
+
}
|
|
1630
|
+
async function xi(e, t) {
|
|
1631
|
+
try {
|
|
1632
|
+
await gi({
|
|
1633
|
+
managedAddress: t,
|
|
1634
|
+
tx: f(e),
|
|
1635
|
+
action: "installSeedExecutor",
|
|
1636
|
+
requireSimulation: !1
|
|
1637
|
+
});
|
|
1638
|
+
return;
|
|
1639
|
+
} catch (e) {
|
|
1640
|
+
let t = en(Zt(e instanceof w ? e.underlyingCause : e));
|
|
1641
|
+
return t === "reverted with SeedExecutorAlreadyInstalled" ? "already-installed" : t;
|
|
1502
1642
|
}
|
|
1503
1643
|
}
|
|
1504
1644
|
//#endregion
|
|
1505
1645
|
//#region src/helpers/ensureManagedAccountReady.ts
|
|
1506
|
-
var
|
|
1507
|
-
async function
|
|
1508
|
-
let { useModularExecutor: e } =
|
|
1646
|
+
var Si = () => `Could not connect the managed publishing account on ${E()}. Reconnect with the same sign-in method and try again.`, Ci = () => `Your publishing smart account is not deployed on ${E()} yet. Complete wallet setup, enable autoDeployManagedAccount in config if appropriate, then try again.`, wi = () => `The managed account could not be confirmed on ${E()} after deployment. Wait a moment and retry, or check your network connection.`, Ti = () => `Automatic deployment of the managed publishing account failed on ${E()}. Retry or deploy the account through your wallet provider.`;
|
|
1647
|
+
async function Ei() {
|
|
1648
|
+
let { useModularExecutor: e } = T();
|
|
1509
1649
|
if (!e) return { kind: "skip" };
|
|
1510
1650
|
let t;
|
|
1511
1651
|
try {
|
|
1512
|
-
t = await
|
|
1652
|
+
t = await Qr(O());
|
|
1513
1653
|
} catch (e) {
|
|
1514
1654
|
return {
|
|
1515
1655
|
kind: "unavailable",
|
|
1516
1656
|
cause: e
|
|
1517
1657
|
};
|
|
1518
1658
|
}
|
|
1519
|
-
return await
|
|
1659
|
+
return await Gr(t) ? {
|
|
1520
1660
|
kind: "ready",
|
|
1521
1661
|
managedAddress: t
|
|
1522
1662
|
} : {
|
|
@@ -1524,87 +1664,87 @@ async function li() {
|
|
|
1524
1664
|
managedAddress: t
|
|
1525
1665
|
};
|
|
1526
1666
|
}
|
|
1527
|
-
async function
|
|
1528
|
-
|
|
1529
|
-
let e =
|
|
1667
|
+
async function Di() {
|
|
1668
|
+
zr();
|
|
1669
|
+
let e = ii();
|
|
1530
1670
|
await e.autoConnect({
|
|
1531
1671
|
client: k(),
|
|
1532
|
-
chain:
|
|
1672
|
+
chain: O()
|
|
1533
1673
|
});
|
|
1534
1674
|
let t = e.getAccount();
|
|
1535
|
-
if (!t) throw new
|
|
1675
|
+
if (!t) throw new w(Si(), "MANAGED_ACCOUNT_UNAVAILABLE");
|
|
1536
1676
|
return t;
|
|
1537
1677
|
}
|
|
1538
|
-
var
|
|
1539
|
-
async function
|
|
1678
|
+
var Oi = 9e4;
|
|
1679
|
+
async function ki(e) {
|
|
1540
1680
|
let t;
|
|
1541
1681
|
try {
|
|
1542
|
-
await Promise.race([
|
|
1543
|
-
t = setTimeout(() => n(/* @__PURE__ */ Error(`Managed account deploy timed out after ${
|
|
1682
|
+
await Promise.race([Yr(e), new Promise((e, n) => {
|
|
1683
|
+
t = setTimeout(() => n(/* @__PURE__ */ Error(`Managed account deploy timed out after ${Oi / 1e3}s`)), Oi);
|
|
1544
1684
|
})]);
|
|
1545
1685
|
} finally {
|
|
1546
1686
|
t != null && clearTimeout(t);
|
|
1547
1687
|
}
|
|
1548
1688
|
}
|
|
1549
|
-
async function
|
|
1550
|
-
let t =
|
|
1689
|
+
async function Ai(e) {
|
|
1690
|
+
let t = T(), n = await Di(), { fromThirdwebAccount: r } = await import("./chainConfig-DWzoOtkS.js").then((e) => e.g), i = {
|
|
1551
1691
|
managedAddress: e,
|
|
1552
1692
|
managedSigningAccount: r(n)
|
|
1553
1693
|
};
|
|
1554
1694
|
try {
|
|
1555
1695
|
if (t.deployManagedAccount) await t.deployManagedAccount(i);
|
|
1556
1696
|
else {
|
|
1557
|
-
let e = await
|
|
1697
|
+
let e = await ei();
|
|
1558
1698
|
if (e) {
|
|
1559
|
-
let t =
|
|
1699
|
+
let t = oi();
|
|
1560
1700
|
await t.autoConnect({
|
|
1561
1701
|
client: k(),
|
|
1562
|
-
chain:
|
|
1563
|
-
}), await
|
|
1702
|
+
chain: O()
|
|
1703
|
+
}), await Xr({
|
|
1564
1704
|
adminAddress: t.getAdminAccount?.()?.address ?? e.address,
|
|
1565
1705
|
signingAccount: e
|
|
1566
1706
|
});
|
|
1567
|
-
} else await
|
|
1707
|
+
} else await ki(n);
|
|
1568
1708
|
}
|
|
1569
1709
|
} catch (t) {
|
|
1570
|
-
if (await
|
|
1571
|
-
throw new
|
|
1710
|
+
if (await Kr(e, /UserOp|user operation/i.test(Oe(t)) ? 15 : 5)) return;
|
|
1711
|
+
throw new w(Ti(), "MANAGED_ACCOUNT_NOT_DEPLOYED", e, t);
|
|
1572
1712
|
}
|
|
1573
|
-
if (!await
|
|
1713
|
+
if (!await Kr(e)) throw new w(wi(), "MANAGED_ACCOUNT_NOT_DEPLOYED", e);
|
|
1574
1714
|
}
|
|
1575
|
-
async function
|
|
1576
|
-
let e =
|
|
1715
|
+
async function ji() {
|
|
1716
|
+
let e = T();
|
|
1577
1717
|
if (!e.useModularExecutor) throw Error("runModularExecutorPublishPrep: useModularExecutor is false");
|
|
1578
|
-
let t = await
|
|
1718
|
+
let t = await Ei();
|
|
1579
1719
|
if (t.kind === "unavailable") return {
|
|
1580
1720
|
ok: !1,
|
|
1581
|
-
error: new
|
|
1721
|
+
error: new w(Si(), "MANAGED_ACCOUNT_UNAVAILABLE", void 0, t.cause)
|
|
1582
1722
|
};
|
|
1583
1723
|
if (t.kind === "not_deployed") {
|
|
1584
1724
|
if (e.autoDeployManagedAccount) {
|
|
1585
1725
|
try {
|
|
1586
|
-
await
|
|
1726
|
+
await Ai(t.managedAddress);
|
|
1587
1727
|
} catch (e) {
|
|
1588
1728
|
return {
|
|
1589
1729
|
ok: !1,
|
|
1590
|
-
error:
|
|
1730
|
+
error: ne(e) ? e : new w(Ti(), "MANAGED_ACCOUNT_NOT_DEPLOYED", t.managedAddress, e)
|
|
1591
1731
|
};
|
|
1592
1732
|
}
|
|
1593
|
-
if (t = await
|
|
1733
|
+
if (t = await Ei(), t.kind !== "ready") return {
|
|
1594
1734
|
ok: !1,
|
|
1595
|
-
error: new
|
|
1735
|
+
error: new w(wi(), "MANAGED_ACCOUNT_NOT_DEPLOYED", t.kind === "not_deployed" ? t.managedAddress : void 0)
|
|
1596
1736
|
};
|
|
1597
1737
|
} else return {
|
|
1598
1738
|
ok: !1,
|
|
1599
|
-
error: new
|
|
1739
|
+
error: new w(Ci(), "MANAGED_ACCOUNT_NOT_DEPLOYED", t.managedAddress)
|
|
1600
1740
|
};
|
|
1601
1741
|
}
|
|
1602
1742
|
if (t.kind === "ready") {
|
|
1603
1743
|
if (e.modularAccountModuleContract) try {
|
|
1604
|
-
let n = await
|
|
1605
|
-
await
|
|
1744
|
+
let n = await Di();
|
|
1745
|
+
await vi(t.managedAddress, n, e);
|
|
1606
1746
|
} catch (e) {
|
|
1607
|
-
console.warn(`[@seedprotocol/publish] Executor module setup failed on ${
|
|
1747
|
+
console.warn(`[@seedprotocol/publish] Executor module setup failed on ${E()}; publishing continues, but publish automation needs it.`, e);
|
|
1608
1748
|
}
|
|
1609
1749
|
return {
|
|
1610
1750
|
ok: !0,
|
|
@@ -1614,90 +1754,36 @@ async function mi() {
|
|
|
1614
1754
|
throw Error("runModularExecutorPublishPrep: unexpected readiness state");
|
|
1615
1755
|
}
|
|
1616
1756
|
//#endregion
|
|
1617
|
-
//#region src/helpers/executorModuleReadiness.ts
|
|
1618
|
-
var hi = "This ManagedAccount predates the Seed executor router extension, so the Seed executor cannot act for it and publish automation is not available for this account.", gi = "The Seed executor is not installed for this ManagedAccount, so automation session keys cannot publish through it. The account admin installs it (installSeedExecutor), which enrollPublishAutomation does.", _i = "The Seed executor module is configured with a different EAS contract for this ManagedAccount than publish config. Automation session keys cannot change it.", vi = "Could not read the Seed executor module state for this ManagedAccount.";
|
|
1619
|
-
function yi() {
|
|
1620
|
-
let e = E().modularAccountModuleContract?.trim();
|
|
1621
|
-
if (!e || !/^0x[0-9a-fA-F]{40}$/.test(e)) throw Error("@seedprotocol/publish: publish automation requires PublishConfig.modularAccountModuleContract (executor module).");
|
|
1622
|
-
return e;
|
|
1623
|
-
}
|
|
1624
|
-
async function bi(e) {
|
|
1625
|
-
return await pe(e) === null;
|
|
1626
|
-
}
|
|
1627
|
-
async function xi(e) {
|
|
1628
|
-
let t = yi(), n = e, r, i;
|
|
1629
|
-
try {
|
|
1630
|
-
r = await _(t, n), i = r ? await v(t, n) : at;
|
|
1631
|
-
} catch (t) {
|
|
1632
|
-
throw new O(vi, "AUTOMATION_UNSUPPORTED_ACCOUNT", e, t);
|
|
1633
|
-
}
|
|
1634
|
-
if (!r) {
|
|
1635
|
-
let t = await bi(n) ? hi : gi;
|
|
1636
|
-
throw new O(t, "AUTOMATION_UNSUPPORTED_ACCOUNT", e);
|
|
1637
|
-
}
|
|
1638
|
-
let a = E().easContractAddress?.toLowerCase();
|
|
1639
|
-
if (a && i.toLowerCase() !== a) throw new O(_i, "AUTOMATION_UNSUPPORTED_ACCOUNT", e);
|
|
1640
|
-
}
|
|
1641
|
-
function Si(e) {
|
|
1642
|
-
let t = e instanceof Qe ? `${e.shortMessage} ${e.details} ${e.message}` : String(e);
|
|
1643
|
-
return /insufficient funds|insufficient balance/i.test(t);
|
|
1644
|
-
}
|
|
1645
|
-
async function Ci(e) {
|
|
1646
|
-
let { managedAddress: t, tx: n, action: r, code: i = "AUTOMATION_PREFLIGHT_FAILED", requireSimulation: a = !0 } = e, o = (e) => S().call({
|
|
1647
|
-
account: t,
|
|
1648
|
-
to: n.to,
|
|
1649
|
-
data: n.data,
|
|
1650
|
-
value: n.value,
|
|
1651
|
-
...e ? { stateOverride: [{
|
|
1652
|
-
address: t,
|
|
1653
|
-
balance: nt("1000")
|
|
1654
|
-
}] } : {}
|
|
1655
|
-
});
|
|
1656
|
-
try {
|
|
1657
|
-
try {
|
|
1658
|
-
await o(!1);
|
|
1659
|
-
} catch (e) {
|
|
1660
|
-
if (!Si(e)) throw e;
|
|
1661
|
-
await o(!0);
|
|
1662
|
-
}
|
|
1663
|
-
} catch (e) {
|
|
1664
|
-
let n = Yt(e);
|
|
1665
|
-
if (!n && !a) return;
|
|
1666
|
-
let o = n ? Zt(Jt(e)) : "could not be simulated";
|
|
1667
|
-
throw new O(`Simulated ${r} from ${t} ${o}; nothing was sent.`, i, t, e);
|
|
1668
|
-
}
|
|
1669
|
-
}
|
|
1670
|
-
//#endregion
|
|
1671
1757
|
//#region src/helpers/resolvePublishWallet.ts
|
|
1672
|
-
function
|
|
1673
|
-
if (
|
|
1674
|
-
if (
|
|
1675
|
-
let t =
|
|
1758
|
+
function Mi(e) {
|
|
1759
|
+
if (i(e.wallet)) return e.wallet;
|
|
1760
|
+
if (i(e.account)) return e.account;
|
|
1761
|
+
let t = he();
|
|
1676
1762
|
if (t) return t;
|
|
1677
1763
|
throw Error("@seedprotocol/publish: no PublishWallet available. Pass fromEthersWallet / fromEip1193Provider / fromThirdwebAccount, or call setPublishWallet / useSeedWallet.");
|
|
1678
1764
|
}
|
|
1679
1765
|
//#endregion
|
|
1680
1766
|
//#region src/services/publish/actors/persistSeedUid.ts
|
|
1681
|
-
var
|
|
1682
|
-
function
|
|
1683
|
-
let n = e.seedLocalId, r = n ? t.find((e) => e?.localId === n) : void 0, i = r?.seedUid && r.seedUid !==
|
|
1684
|
-
i && i !==
|
|
1767
|
+
var Ni = R("seedProtocol:services:publish:actors:persistSeedUid"), Pi = "0x" + "0".repeat(64), Fi = 15e3;
|
|
1768
|
+
function Ii(e, t) {
|
|
1769
|
+
let n = e.seedLocalId, r = n ? t.find((e) => e?.localId === n) : void 0, i = r?.seedUid && r.seedUid !== Pi ? r.seedUid : t[0]?.seedUid;
|
|
1770
|
+
i && i !== Pi && (e.seedUid = i);
|
|
1685
1771
|
}
|
|
1686
|
-
async function
|
|
1772
|
+
async function Li(e, t, n) {
|
|
1687
1773
|
let r = e.persistSeedUid;
|
|
1688
1774
|
if (typeof r != "function") return;
|
|
1689
|
-
let i = new Promise((e, t) => setTimeout(() => t(/* @__PURE__ */ Error("persistSeedUid timed out")),
|
|
1775
|
+
let i = new Promise((e, t) => setTimeout(() => t(/* @__PURE__ */ Error("persistSeedUid timed out")), Fi));
|
|
1690
1776
|
try {
|
|
1691
1777
|
await Promise.race([r.call(e, t, n), i]);
|
|
1692
1778
|
} catch (e) {
|
|
1693
|
-
|
|
1779
|
+
Ni("persistSeedUid failed (attestations already on-chain):", e);
|
|
1694
1780
|
}
|
|
1695
1781
|
}
|
|
1696
1782
|
//#endregion
|
|
1697
1783
|
//#region src/services/publish/helpers/verifyArweaveTransactionsExist.ts
|
|
1698
|
-
async function
|
|
1784
|
+
async function Ri(e) {
|
|
1699
1785
|
if (e.length === 0) return;
|
|
1700
|
-
let { arweaveUploadVerificationBaseUrl: t } =
|
|
1786
|
+
let { arweaveUploadVerificationBaseUrl: t } = T(), n = await Promise.all(e.map((e) => Ve(t, e)));
|
|
1701
1787
|
for (let t = 0; t < e.length; t++) {
|
|
1702
1788
|
let r = e[t], i = n[t];
|
|
1703
1789
|
if (i) {
|
|
@@ -1714,36 +1800,36 @@ async function Ai(e) {
|
|
|
1714
1800
|
function K(e) {
|
|
1715
1801
|
return e == null || e === "" ? W : ("0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(64, "0").slice(-64)).toLowerCase();
|
|
1716
1802
|
}
|
|
1717
|
-
function
|
|
1803
|
+
function zi(e, t, n) {
|
|
1718
1804
|
if (!t || !e.logs?.length) return;
|
|
1719
|
-
let
|
|
1720
|
-
if (
|
|
1721
|
-
let
|
|
1805
|
+
let i = K(t);
|
|
1806
|
+
if (i === W) return;
|
|
1807
|
+
let a = n ? De : r;
|
|
1722
1808
|
try {
|
|
1723
|
-
let t =
|
|
1724
|
-
abi:
|
|
1809
|
+
let t = P({
|
|
1810
|
+
abi: a,
|
|
1725
1811
|
eventName: "CreatedAttestation",
|
|
1726
1812
|
logs: e.logs,
|
|
1727
1813
|
strict: !1
|
|
1728
1814
|
});
|
|
1729
1815
|
for (let e of t) {
|
|
1730
1816
|
let t = e.args?.result;
|
|
1731
|
-
if (t?.attestationUid && K(t.schemaUid) ===
|
|
1817
|
+
if (t?.attestationUid && K(t.schemaUid) === i) {
|
|
1732
1818
|
let e = t.attestationUid;
|
|
1733
1819
|
return e && K(e) !== W ? e : void 0;
|
|
1734
1820
|
}
|
|
1735
1821
|
}
|
|
1736
1822
|
} catch {}
|
|
1737
1823
|
}
|
|
1738
|
-
function
|
|
1739
|
-
let
|
|
1740
|
-
if (!
|
|
1824
|
+
function Bi(e, t, n, i) {
|
|
1825
|
+
let a = t.toLowerCase(), o = e.logs?.filter((e) => e.address && e.address.toLowerCase() === a);
|
|
1826
|
+
if (!o?.length) return {};
|
|
1741
1827
|
try {
|
|
1742
|
-
if (
|
|
1743
|
-
let e =
|
|
1744
|
-
abi:
|
|
1828
|
+
if (i) {
|
|
1829
|
+
let e = P({
|
|
1830
|
+
abi: De,
|
|
1745
1831
|
eventName: "SeedPublished",
|
|
1746
|
-
logs:
|
|
1832
|
+
logs: o,
|
|
1747
1833
|
strict: !1
|
|
1748
1834
|
})[0];
|
|
1749
1835
|
if (!e) return {};
|
|
@@ -1753,55 +1839,55 @@ function Mi(e, t, n, r) {
|
|
|
1753
1839
|
versionUid: t?.versionUid && K(t.versionUid) !== W ? t.versionUid : void 0
|
|
1754
1840
|
};
|
|
1755
1841
|
}
|
|
1756
|
-
let e =
|
|
1757
|
-
abi:
|
|
1842
|
+
let e = P({
|
|
1843
|
+
abi: r,
|
|
1758
1844
|
eventName: "SeedPublished",
|
|
1759
|
-
logs:
|
|
1845
|
+
logs: o,
|
|
1760
1846
|
strict: !1
|
|
1761
1847
|
})[0];
|
|
1762
1848
|
if (!e) return {};
|
|
1763
1849
|
let t = e.args?.returnedDataFromEAS;
|
|
1764
1850
|
if (!t || t === "0x") return {};
|
|
1765
|
-
let
|
|
1766
|
-
if (!
|
|
1767
|
-
let
|
|
1851
|
+
let a = it([{ type: "bytes32[]" }], t)[0];
|
|
1852
|
+
if (!a?.length) return {};
|
|
1853
|
+
let s = n, c = a[s], l = a[s + 1];
|
|
1768
1854
|
return {
|
|
1769
|
-
seedUid:
|
|
1770
|
-
versionUid:
|
|
1855
|
+
seedUid: c && c !== W ? c : a.length === 1 && a[0] && a[0] !== W ? a[0] : void 0,
|
|
1856
|
+
versionUid: l && l !== W ? l : void 0
|
|
1771
1857
|
};
|
|
1772
1858
|
} catch {
|
|
1773
1859
|
return {};
|
|
1774
1860
|
}
|
|
1775
1861
|
}
|
|
1776
|
-
function
|
|
1777
|
-
return
|
|
1862
|
+
function Vi(e, t, n, r) {
|
|
1863
|
+
return Bi(e, t, n, r).seedUid;
|
|
1778
1864
|
}
|
|
1779
|
-
function
|
|
1865
|
+
function Hi(e, t, n) {
|
|
1780
1866
|
if (!t || !e.logs?.length) return;
|
|
1781
|
-
let
|
|
1782
|
-
if (
|
|
1783
|
-
let
|
|
1867
|
+
let i = K(t);
|
|
1868
|
+
if (i === W) return;
|
|
1869
|
+
let a = n ? De : r;
|
|
1784
1870
|
try {
|
|
1785
|
-
let t =
|
|
1786
|
-
abi:
|
|
1871
|
+
let t = P({
|
|
1872
|
+
abi: a,
|
|
1787
1873
|
eventName: "CreatedAttestation",
|
|
1788
1874
|
logs: e.logs,
|
|
1789
1875
|
strict: !1
|
|
1790
1876
|
});
|
|
1791
1877
|
for (let e of t) {
|
|
1792
1878
|
let t = e.args?.result;
|
|
1793
|
-
if (t?.attestationUid && K(t.schemaUid) ===
|
|
1879
|
+
if (t?.attestationUid && K(t.schemaUid) === i) {
|
|
1794
1880
|
let e = t.attestationUid;
|
|
1795
1881
|
return e && K(e) !== W ? e : void 0;
|
|
1796
1882
|
}
|
|
1797
1883
|
}
|
|
1798
1884
|
} catch {}
|
|
1799
1885
|
}
|
|
1800
|
-
function
|
|
1886
|
+
function Ui(e, t) {
|
|
1801
1887
|
if (!e.logs?.length) return [];
|
|
1802
|
-
let n = t ?
|
|
1888
|
+
let n = t ? De : r;
|
|
1803
1889
|
try {
|
|
1804
|
-
let t =
|
|
1890
|
+
let t = P({
|
|
1805
1891
|
abi: n,
|
|
1806
1892
|
eventName: "CreatedAttestation",
|
|
1807
1893
|
logs: e.logs,
|
|
@@ -1823,26 +1909,26 @@ function Fi(e, t) {
|
|
|
1823
1909
|
return [];
|
|
1824
1910
|
}
|
|
1825
1911
|
}
|
|
1826
|
-
function
|
|
1827
|
-
let n = t.toLowerCase(),
|
|
1828
|
-
if (!
|
|
1912
|
+
function Wi(e, t) {
|
|
1913
|
+
let n = t.toLowerCase(), i = e.logs?.filter((e) => e.address && e.address.toLowerCase() === n);
|
|
1914
|
+
if (!i?.length) return [];
|
|
1829
1915
|
try {
|
|
1830
|
-
let e =
|
|
1831
|
-
abi:
|
|
1916
|
+
let e = P({
|
|
1917
|
+
abi: r,
|
|
1832
1918
|
eventName: "SeedPublished",
|
|
1833
|
-
logs:
|
|
1919
|
+
logs: i,
|
|
1834
1920
|
strict: !1
|
|
1835
1921
|
})[0];
|
|
1836
1922
|
if (!e) return [];
|
|
1837
1923
|
let t = e.args?.returnedDataFromEAS;
|
|
1838
|
-
return !t || t === "0x" ? [] :
|
|
1924
|
+
return !t || t === "0x" ? [] : it([{ type: "bytes32[]" }], t)[0] ?? [];
|
|
1839
1925
|
} catch {
|
|
1840
1926
|
return [];
|
|
1841
1927
|
}
|
|
1842
1928
|
}
|
|
1843
|
-
function
|
|
1929
|
+
function Gi(e, t, n) {
|
|
1844
1930
|
if (!n.length) return [];
|
|
1845
|
-
let r =
|
|
1931
|
+
let r = Wi(e, t), i = n.length;
|
|
1846
1932
|
if (r.length < i) return [];
|
|
1847
1933
|
let a = [];
|
|
1848
1934
|
for (let e = 0; e < i; e++) {
|
|
@@ -1854,32 +1940,32 @@ function Li(e, t, n) {
|
|
|
1854
1940
|
}
|
|
1855
1941
|
return a;
|
|
1856
1942
|
}
|
|
1857
|
-
function
|
|
1858
|
-
let t =
|
|
1943
|
+
function Ki(e) {
|
|
1944
|
+
let t = Ui(e.receipt, e.useModularExecutor);
|
|
1859
1945
|
if (t.length) return t;
|
|
1860
|
-
let n =
|
|
1946
|
+
let n = p(e.receipt, e.easContractAddress);
|
|
1861
1947
|
return n.length ? n.map((e) => ({
|
|
1862
1948
|
schemaUid: e.schemaUid,
|
|
1863
1949
|
attestationUid: e.uid
|
|
1864
|
-
})) : e.useModularExecutor ? [] :
|
|
1950
|
+
})) : e.useModularExecutor ? [] : Gi(e.receipt, e.contractAddressForEvents, e.listOfAttestations ?? []);
|
|
1865
1951
|
}
|
|
1866
1952
|
//#endregion
|
|
1867
1953
|
//#region src/services/publish/helpers/receiptAttestationMs.ts
|
|
1868
1954
|
async function q(e) {
|
|
1869
1955
|
let t = e?.blockNumber;
|
|
1870
|
-
return t == null ? Date.now() : await
|
|
1956
|
+
return t == null ? Date.now() : await ye(t) ?? Date.now();
|
|
1871
1957
|
}
|
|
1872
1958
|
//#endregion
|
|
1873
1959
|
//#region src/services/publish/actors/publishRequestNormalize.ts
|
|
1874
|
-
var
|
|
1875
|
-
if (e == null) return "0x" + "0".repeat(
|
|
1876
|
-
if (typeof e == "string") return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(
|
|
1960
|
+
var qi = 64, J = (e) => {
|
|
1961
|
+
if (e == null) return "0x" + "0".repeat(qi);
|
|
1962
|
+
if (typeof e == "string") return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(qi, "0").slice(-64);
|
|
1877
1963
|
if (e instanceof Uint8Array || typeof ArrayBuffer < "u" && e instanceof ArrayBuffer) {
|
|
1878
1964
|
let t = e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
1879
|
-
return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("").padStart(
|
|
1965
|
+
return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("").padStart(qi, "0").slice(-64);
|
|
1880
1966
|
}
|
|
1881
|
-
return "0x" + "0".repeat(
|
|
1882
|
-
},
|
|
1967
|
+
return "0x" + "0".repeat(qi);
|
|
1968
|
+
}, Ji = (e) => {
|
|
1883
1969
|
if (e == null || typeof e == "string" && (e === "" || e === "0x")) return "0x";
|
|
1884
1970
|
if (typeof e == "string") {
|
|
1885
1971
|
let t = (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0");
|
|
@@ -1891,25 +1977,25 @@ var zi = 64, J = (e) => {
|
|
|
1891
1977
|
}
|
|
1892
1978
|
return "0x";
|
|
1893
1979
|
};
|
|
1894
|
-
function
|
|
1980
|
+
function Yi(e) {
|
|
1895
1981
|
let t = new Set(e.map((e) => e?.localId).filter((e) => !!e));
|
|
1896
1982
|
return e.some((e) => (e?.listOfAttestations ?? []).some((e) => {
|
|
1897
1983
|
let n = e;
|
|
1898
1984
|
return n._unresolvedValue && t.has(n._unresolvedValue) ? !0 : Array.isArray(n._rawListIdsForResolve) ? n._rawListIdsForResolve.some((e) => e && t.has(String(e).trim())) : !1;
|
|
1899
1985
|
}));
|
|
1900
1986
|
}
|
|
1901
|
-
function
|
|
1987
|
+
function Xi(e, t) {
|
|
1902
1988
|
return (e ?? []).filter((e) => e.publishLocalId && t.has(e.publishLocalId));
|
|
1903
1989
|
}
|
|
1904
|
-
var
|
|
1905
|
-
recipient:
|
|
1990
|
+
var Zi = {
|
|
1991
|
+
recipient: Ft,
|
|
1906
1992
|
expirationTime: BigInt(0),
|
|
1907
1993
|
revocable: !0,
|
|
1908
1994
|
refUID: W,
|
|
1909
1995
|
data: W,
|
|
1910
1996
|
value: BigInt(0)
|
|
1911
1997
|
};
|
|
1912
|
-
function
|
|
1998
|
+
function Qi(e) {
|
|
1913
1999
|
let t = (e?.listOfAttestations ?? []).map((e) => {
|
|
1914
2000
|
let t = Array.isArray(e?.data) ? e.data : [];
|
|
1915
2001
|
return {
|
|
@@ -1917,7 +2003,7 @@ function Wi(e) {
|
|
|
1917
2003
|
data: t.map((e) => ({
|
|
1918
2004
|
...e,
|
|
1919
2005
|
refUID: J(e?.refUID),
|
|
1920
|
-
data:
|
|
2006
|
+
data: Ji(e?.data),
|
|
1921
2007
|
expirationTime: e?.expirationTime == null ? BigInt(0) : BigInt(e.expirationTime),
|
|
1922
2008
|
value: e?.value == null ? BigInt(0) : BigInt(e.value)
|
|
1923
2009
|
})),
|
|
@@ -1938,7 +2024,7 @@ function Wi(e) {
|
|
|
1938
2024
|
propertiesToUpdate: n
|
|
1939
2025
|
};
|
|
1940
2026
|
}
|
|
1941
|
-
function
|
|
2027
|
+
function $i(e, t) {
|
|
1942
2028
|
for (let n of e) for (let e of n?.propertiesToUpdate ?? []) {
|
|
1943
2029
|
let n = e?.publishLocalId, r = J(e?.propertySchemaUid);
|
|
1944
2030
|
if (!n || !r) continue;
|
|
@@ -1946,16 +2032,16 @@ function Gi(e, t) {
|
|
|
1946
2032
|
if (!i?.listOfAttestations) continue;
|
|
1947
2033
|
let a = i.listOfAttestations.find((e) => J(e?.schema)?.toLowerCase() === r?.toLowerCase());
|
|
1948
2034
|
a && (!Array.isArray(a.data) || a.data.length === 0) && (a.data = [{
|
|
1949
|
-
...
|
|
2035
|
+
...Zi,
|
|
1950
2036
|
refUID: W
|
|
1951
2037
|
}]);
|
|
1952
2038
|
}
|
|
1953
2039
|
}
|
|
1954
2040
|
//#endregion
|
|
1955
2041
|
//#region src/services/arweaveL1Finalize/enqueue.ts
|
|
1956
|
-
var
|
|
1957
|
-
async function
|
|
1958
|
-
let { useArweaveBundler: t } =
|
|
2042
|
+
var ea = "pending_l1";
|
|
2043
|
+
async function ta(e) {
|
|
2044
|
+
let { useArweaveBundler: t } = T();
|
|
1959
2045
|
if (!t) return;
|
|
1960
2046
|
let n = e.arweaveTransactions ?? [], r = e.publishUploads ?? [];
|
|
1961
2047
|
if (n.length === 0 || n.length !== r.length) return;
|
|
@@ -1967,12 +2053,12 @@ async function qi(e) {
|
|
|
1967
2053
|
if (!o) continue;
|
|
1968
2054
|
let s = t.transaction?.id;
|
|
1969
2055
|
if (s && typeof s == "string") try {
|
|
1970
|
-
await i.insert(
|
|
2056
|
+
await i.insert(Pe).values({
|
|
1971
2057
|
seedLocalId: o.seedLocalId,
|
|
1972
2058
|
dataItemId: s,
|
|
1973
2059
|
versionLocalId: o.versionLocalId ?? null,
|
|
1974
2060
|
itemPropertyName: o.itemPropertyName ?? null,
|
|
1975
|
-
phase:
|
|
2061
|
+
phase: ea,
|
|
1976
2062
|
createdAt: a,
|
|
1977
2063
|
updatedAt: a
|
|
1978
2064
|
}).onConflictDoNothing();
|
|
@@ -1981,54 +2067,54 @@ async function qi(e) {
|
|
|
1981
2067
|
}
|
|
1982
2068
|
//#endregion
|
|
1983
2069
|
//#region src/helpers/ensureManagedAccountEasConfigured.ts
|
|
1984
|
-
var
|
|
1985
|
-
function
|
|
2070
|
+
var na = () => `Could not verify or set the EAS contract address on your publishing account on ${E()}.`, ra = "ManagedAccount EAS pointer does not match publish config. Configure EAS with the user’s ManagedAccount wallet before automation publish (session keys cannot call setEas).", ia = (e) => `Your publishing account's Seed extension uses EAS ${e}, but publish config sets easContractAddress to a different contract. The extension's EAS is fixed at deployment; fix easContractAddress.`;
|
|
2071
|
+
function aa(e) {
|
|
1986
2072
|
return e.toLowerCase();
|
|
1987
2073
|
}
|
|
1988
|
-
function
|
|
1989
|
-
let { easContractAddress: t } =
|
|
1990
|
-
if (!n || n ===
|
|
2074
|
+
function oa(e) {
|
|
2075
|
+
let { easContractAddress: t } = T(), n = aa(t);
|
|
2076
|
+
if (!n || n === aa(lt)) throw new w("Publish config is missing a valid easContractAddress.", "MANAGED_ACCOUNT_SET_EAS_FAILED", e);
|
|
1991
2077
|
return n;
|
|
1992
2078
|
}
|
|
1993
|
-
async function
|
|
2079
|
+
async function sa(e) {
|
|
1994
2080
|
try {
|
|
1995
|
-
let t = await
|
|
1996
|
-
return
|
|
2081
|
+
let t = await le(e);
|
|
2082
|
+
return aa(typeof t == "string" ? t : String(t));
|
|
1997
2083
|
} catch (t) {
|
|
1998
|
-
throw new
|
|
2084
|
+
throw new w(na(), "MANAGED_ACCOUNT_SET_EAS_FAILED", e, t);
|
|
1999
2085
|
}
|
|
2000
2086
|
}
|
|
2001
|
-
async function
|
|
2002
|
-
let t =
|
|
2003
|
-
if (await
|
|
2087
|
+
async function ca(e) {
|
|
2088
|
+
let t = oa(e);
|
|
2089
|
+
if (await sa(e) !== t) throw new w(ra, "MANAGED_ACCOUNT_SET_EAS_FAILED", e);
|
|
2004
2090
|
}
|
|
2005
|
-
async function
|
|
2006
|
-
let
|
|
2007
|
-
if (
|
|
2008
|
-
if (
|
|
2091
|
+
async function la(e, t) {
|
|
2092
|
+
let n = oa(e), r = await sa(e);
|
|
2093
|
+
if (r !== n) {
|
|
2094
|
+
if (r !== aa(lt)) throw new w(ia(r), "MANAGED_ACCOUNT_SET_EAS_FAILED", e);
|
|
2009
2095
|
try {
|
|
2010
|
-
let
|
|
2096
|
+
let n = typeof t == "function" ? await t() : t, r = i(n) ? n.txSender : _e(n) ? n : (() => {
|
|
2011
2097
|
throw Error("@seedprotocol/publish: ensureManagedAccountEasConfigured requires PublishWallet or SeedTxSender");
|
|
2012
|
-
})(), { easContractAddress: a } =
|
|
2013
|
-
await C(
|
|
2098
|
+
})(), { easContractAddress: a } = T(), o = ee(e, a), s = await r.sendTransaction(o);
|
|
2099
|
+
await C(s.transactionHash);
|
|
2014
2100
|
} catch (t) {
|
|
2015
|
-
throw new
|
|
2101
|
+
throw new w(na(), "MANAGED_ACCOUNT_SET_EAS_FAILED", e, t);
|
|
2016
2102
|
}
|
|
2017
2103
|
}
|
|
2018
2104
|
}
|
|
2019
2105
|
//#endregion
|
|
2020
2106
|
//#region src/services/publish/actors/createAttestations.ts
|
|
2021
|
-
var
|
|
2022
|
-
function
|
|
2107
|
+
var ua = R("seedProtocol:services:publish:actors");
|
|
2108
|
+
function da(e) {
|
|
2023
2109
|
return !!e && /^0x[0-9a-fA-F]{40}$/.test(e.trim());
|
|
2024
2110
|
}
|
|
2025
|
-
function
|
|
2111
|
+
function fa(e) {
|
|
2026
2112
|
let { useModularExecutor: t, publisherAddress: n, modularAccountModuleContract: r, managedAddress: i, routeToExecutorModule: a } = e;
|
|
2027
2113
|
if (t) {
|
|
2028
2114
|
if (!i) throw Error("resolvePublishRouting: managedAddress is required when useModularExecutor is true");
|
|
2029
2115
|
let e = r?.trim();
|
|
2030
2116
|
if (a) {
|
|
2031
|
-
if (!
|
|
2117
|
+
if (!da(e)) throw Error("resolvePublishRouting: modularAccountModuleContract is required when routeToExecutorModule is true");
|
|
2032
2118
|
return {
|
|
2033
2119
|
txTargetAddress: e,
|
|
2034
2120
|
contractAddressForEvents: e
|
|
@@ -2044,27 +2130,27 @@ function ia(e) {
|
|
|
2044
2130
|
contractAddressForEvents: n
|
|
2045
2131
|
};
|
|
2046
2132
|
}
|
|
2047
|
-
async function
|
|
2133
|
+
async function pa(e) {
|
|
2048
2134
|
let { receipt: t, seedLocalId: n, versionSchemaUid: r, contractAddressForEvents: i, listOfAttestationsCount: a, useModularExecutor: o, publisherAddress: s } = e;
|
|
2049
2135
|
if (!n) return;
|
|
2050
|
-
let c =
|
|
2136
|
+
let c = Hi(t, r, o) ?? Bi(t, i, a, o).versionUid, l = c ? J(c) : void 0;
|
|
2051
2137
|
if (!l || l === W) return;
|
|
2052
2138
|
let u = await q(t);
|
|
2053
|
-
await
|
|
2139
|
+
await tt({
|
|
2054
2140
|
seedLocalId: n,
|
|
2055
2141
|
versionUid: l,
|
|
2056
2142
|
publisher: s,
|
|
2057
2143
|
attestationCreatedAt: u
|
|
2058
2144
|
});
|
|
2059
2145
|
}
|
|
2060
|
-
function
|
|
2146
|
+
function ma(e, t) {
|
|
2061
2147
|
return !e || !t ? !1 : J(e).toLowerCase() === J(t).toLowerCase();
|
|
2062
2148
|
}
|
|
2063
|
-
function
|
|
2064
|
-
return !n || t >= e.length ? t :
|
|
2149
|
+
function ha(e, t, n) {
|
|
2150
|
+
return !n || t >= e.length ? t : ma(e[t]?.schemaUid, n) ? t + 1 : t;
|
|
2065
2151
|
}
|
|
2066
|
-
async function
|
|
2067
|
-
let { receipt: t, normalizedRequests: n, useModularExecutor: r, contractAddressForEvents: i } = e, { easContractAddress: a } =
|
|
2152
|
+
async function ga(e) {
|
|
2153
|
+
let { receipt: t, normalizedRequests: n, useModularExecutor: r, contractAddressForEvents: i } = e, { easContractAddress: a } = T(), o = Ki({
|
|
2068
2154
|
receipt: t,
|
|
2069
2155
|
useModularExecutor: r,
|
|
2070
2156
|
easContractAddress: a,
|
|
@@ -2072,17 +2158,17 @@ async function ca(e) {
|
|
|
2072
2158
|
listOfAttestations: n.flatMap((e) => e.listOfAttestations ?? [])
|
|
2073
2159
|
});
|
|
2074
2160
|
if (!o.length) {
|
|
2075
|
-
|
|
2161
|
+
ua("persistPropertyMetadataUidsFromContractReceipt: no property attestation pairs");
|
|
2076
2162
|
return;
|
|
2077
2163
|
}
|
|
2078
2164
|
let s = await q(t), c = 0;
|
|
2079
2165
|
for (let e of n) {
|
|
2080
2166
|
let n = e.listOfAttestations ?? [];
|
|
2081
|
-
if ((!e.seedUid || J(e.seedUid) === W) && (c =
|
|
2167
|
+
if ((!e.seedUid || J(e.seedUid) === W) && (c = ha(o, c, e.seedSchemaUid)), c = ha(o, c, e.versionSchemaUid), !n.length) continue;
|
|
2082
2168
|
let a = n.length, l = o.slice(c, c + a);
|
|
2083
2169
|
if (c += a, !l.length) continue;
|
|
2084
2170
|
let u = Math.min(l.length, a), d = e.versionUid && J(e.versionUid) !== W ? J(e.versionUid) : void 0;
|
|
2085
|
-
d ||=
|
|
2171
|
+
d ||= Hi(t, e.versionSchemaUid, r) ?? Bi(t, i, a, r).versionUid, await Ne({
|
|
2086
2172
|
seedLocalId: e.localId,
|
|
2087
2173
|
attestationCreatedAtMs: s ?? null,
|
|
2088
2174
|
versionUid: d && J(d) !== W ? J(d) : null,
|
|
@@ -2094,62 +2180,62 @@ async function ca(e) {
|
|
|
2094
2180
|
});
|
|
2095
2181
|
}
|
|
2096
2182
|
}
|
|
2097
|
-
var
|
|
2098
|
-
let { address: t, account: n, wallet: r } = e, i = e.arweaveTransactions ?? [],
|
|
2183
|
+
var _a = L(async ({ input: { context: e } }) => {
|
|
2184
|
+
let { address: t, account: n, wallet: r } = e, i = e.arweaveTransactions ?? [], a = e.publishUploads ?? [], { item: o } = e, { modularAccountModuleContract: s, useModularExecutor: l } = T();
|
|
2099
2185
|
if (!t || typeof t != "string" || !t.trim()) throw Error("No wallet address for publish. Connect a wallet and try again.");
|
|
2100
2186
|
if (!r && !n) throw Error("Wallet session is missing. Reconnect your wallet and retry the publish.");
|
|
2101
|
-
if (!l && !await
|
|
2102
|
-
if (!
|
|
2103
|
-
if (typeof
|
|
2104
|
-
let u =
|
|
2187
|
+
if (!l && !await ce(t)) throw Error("EOA publishing must use the direct EAS path (multiPublish requires a deployed publisher contract). If you see this, attestation routing is misconfigured.");
|
|
2188
|
+
if (!o?.seedLocalId) throw Error("Attestation recovery failed: Item data is missing. Delete this publish record and try a full publish from the beginning.");
|
|
2189
|
+
if (typeof o.getPublishUploads != "function" && (o = await Cn(o.seedLocalId)), i.length !== a.length) throw Error("Attestation recovery failed: Arweave transaction data is missing or incomplete. Delete this publish record and try a full publish from the beginning.");
|
|
2190
|
+
let u = fa({
|
|
2105
2191
|
useModularExecutor: !1,
|
|
2106
2192
|
publisherAddress: t
|
|
2107
|
-
}), d =
|
|
2108
|
-
await
|
|
2193
|
+
}), d = Mi(e), f = !1;
|
|
2194
|
+
await xn(o, d, { managedAddress: t });
|
|
2109
2195
|
let p = i.map((e, t) => {
|
|
2110
2196
|
let n = e.transaction?.id;
|
|
2111
2197
|
if (!n || typeof n != "string") throw Error("Attestation recovery failed: Arweave transaction data did not survive restore. Delete this publish record and try a full publish from the beginning.");
|
|
2112
|
-
let r =
|
|
2198
|
+
let r = a[t];
|
|
2113
2199
|
if (!r) throw Error("Publish upload index mismatch");
|
|
2114
2200
|
return {
|
|
2115
2201
|
...r,
|
|
2116
2202
|
txId: n
|
|
2117
2203
|
};
|
|
2118
2204
|
});
|
|
2119
|
-
await
|
|
2120
|
-
let m = await
|
|
2205
|
+
await Ri(p.map((e) => e.txId));
|
|
2206
|
+
let m = await o.getPublishPayload(p, { publishMode: e.publishMode ?? "patch" }), h = Array.isArray(m) ? m : [m];
|
|
2121
2207
|
if (l) {
|
|
2122
2208
|
let e = d?.signer?.address, n = !1;
|
|
2123
2209
|
if (t && e) {
|
|
2124
|
-
let { isAutomationSessionActive: r } = await import("./ensureAutomationSessionKey-
|
|
2210
|
+
let { isAutomationSessionActive: r } = await import("./ensureAutomationSessionKey-h3zOmDr5.js").then((e) => e.n);
|
|
2125
2211
|
n = await r(t, e);
|
|
2126
2212
|
}
|
|
2127
2213
|
if (n) {
|
|
2128
|
-
let e =
|
|
2129
|
-
if (!
|
|
2130
|
-
u =
|
|
2214
|
+
let e = s?.trim();
|
|
2215
|
+
if (!da(e)) throw Error("@seedprotocol/publish: automation publish requires PublishConfig.modularAccountModuleContract (executor module). Session keys are module-only and cannot call the ManagedAccount directly.");
|
|
2216
|
+
u = fa({
|
|
2131
2217
|
useModularExecutor: l,
|
|
2132
2218
|
publisherAddress: t,
|
|
2133
2219
|
modularAccountModuleContract: e,
|
|
2134
2220
|
managedAddress: t,
|
|
2135
2221
|
routeToExecutorModule: !0
|
|
2136
|
-
}), f = !0, await
|
|
2222
|
+
}), f = !0, await mi(t);
|
|
2137
2223
|
} else {
|
|
2138
|
-
let e = await
|
|
2224
|
+
let e = await ji();
|
|
2139
2225
|
if (!e.ok) throw e.error;
|
|
2140
|
-
u =
|
|
2226
|
+
u = fa({
|
|
2141
2227
|
useModularExecutor: l,
|
|
2142
2228
|
publisherAddress: t,
|
|
2143
|
-
modularAccountModuleContract:
|
|
2229
|
+
modularAccountModuleContract: s,
|
|
2144
2230
|
managedAddress: e.managedAddress
|
|
2145
2231
|
});
|
|
2146
|
-
let { ensureModularPublishBootstrap: n } = await import("./ensureModularPublishBootstrap-
|
|
2232
|
+
let { ensureModularPublishBootstrap: n } = await import("./ensureModularPublishBootstrap-BImiIFJe.js").then((e) => e.n), { fromThirdwebAccount: r } = await import("./chainConfig-DWzoOtkS.js").then((e) => e.g);
|
|
2147
2233
|
d = r(await n(e.managedAddress));
|
|
2148
2234
|
}
|
|
2149
|
-
} else await
|
|
2150
|
-
let
|
|
2151
|
-
let n = u.txTargetAddress, r = f ?
|
|
2152
|
-
await
|
|
2235
|
+
} else await la(t, d);
|
|
2236
|
+
let g = async (e) => {
|
|
2237
|
+
let n = u.txTargetAddress, r = f ? c(n, e, 5000000n) : be(n, e, 5000000n);
|
|
2238
|
+
await gi(f ? {
|
|
2153
2239
|
managedAddress: t,
|
|
2154
2240
|
tx: r,
|
|
2155
2241
|
action: "multiPublish via the executor module"
|
|
@@ -2163,24 +2249,24 @@ var la = L(async ({ input: { context: e } }) => {
|
|
|
2163
2249
|
try {
|
|
2164
2250
|
return await d.txSender.sendTransaction(r);
|
|
2165
2251
|
} catch (e) {
|
|
2166
|
-
throw
|
|
2252
|
+
throw sn(e, d.txSender.address);
|
|
2167
2253
|
}
|
|
2168
|
-
},
|
|
2169
|
-
if (
|
|
2170
|
-
let e = structuredClone(
|
|
2254
|
+
}, _ = h.length > 1 && Yi(h), v, y = null, b = [];
|
|
2255
|
+
if (_) {
|
|
2256
|
+
let e = structuredClone(h), n = {};
|
|
2171
2257
|
for (let r = 0; r < e.length; r++) {
|
|
2172
|
-
e = await
|
|
2173
|
-
let i = e[r], a = /* @__PURE__ */ new Set([i.localId]), o =
|
|
2258
|
+
e = await Xe(e, n);
|
|
2259
|
+
let i = e[r], a = /* @__PURE__ */ new Set([i.localId]), o = Qi({
|
|
2174
2260
|
...i,
|
|
2175
|
-
propertiesToUpdate:
|
|
2261
|
+
propertiesToUpdate: Xi(i.propertiesToUpdate, a)
|
|
2176
2262
|
}), s = /* @__PURE__ */ new Map([[o.localId, o]]);
|
|
2177
|
-
|
|
2178
|
-
let c = await
|
|
2263
|
+
$i([o], s);
|
|
2264
|
+
let c = await g([o]), d = await C(c.transactionHash);
|
|
2179
2265
|
if (!d) throw Error("Failed to send transaction");
|
|
2180
|
-
|
|
2266
|
+
y = d;
|
|
2181
2267
|
let f = o?.listOfAttestations?.length ?? 0;
|
|
2182
|
-
for (let e of
|
|
2183
|
-
await
|
|
2268
|
+
for (let e of Ui(d, l)) e.attestationUid && b.push(e.attestationUid);
|
|
2269
|
+
await pa({
|
|
2184
2270
|
receipt: d,
|
|
2185
2271
|
seedLocalId: i.localId,
|
|
2186
2272
|
versionSchemaUid: o.versionSchemaUid,
|
|
@@ -2191,13 +2277,13 @@ var la = L(async ({ input: { context: e } }) => {
|
|
|
2191
2277
|
});
|
|
2192
2278
|
let p = !o.seedUid || J(o.seedUid) === W, m = o?.seedSchemaUid;
|
|
2193
2279
|
if (p) {
|
|
2194
|
-
let t =
|
|
2280
|
+
let t = zi(d, m, l) ?? Vi(d, u.contractAddressForEvents, f, l);
|
|
2195
2281
|
t && (n[i.localId] = t, e[r] = {
|
|
2196
2282
|
...e[r],
|
|
2197
2283
|
seedUid: t
|
|
2198
|
-
},
|
|
2284
|
+
}, b.push(t));
|
|
2199
2285
|
}
|
|
2200
|
-
await
|
|
2286
|
+
await ga({
|
|
2201
2287
|
receipt: d,
|
|
2202
2288
|
normalizedRequests: [o],
|
|
2203
2289
|
useModularExecutor: l,
|
|
@@ -2208,19 +2294,19 @@ var la = L(async ({ input: { context: e } }) => {
|
|
|
2208
2294
|
let e = t?.localId, r = t?.seedUid;
|
|
2209
2295
|
e && r && J(r) !== W && (n[e] = J(r));
|
|
2210
2296
|
}
|
|
2211
|
-
|
|
2297
|
+
v = (await Xe(structuredClone(h), n)).map((e) => Qi({
|
|
2212
2298
|
...e,
|
|
2213
2299
|
seedUid: n[e.localId] ?? e.seedUid
|
|
2214
2300
|
}));
|
|
2215
2301
|
} else {
|
|
2216
|
-
let e =
|
|
2217
|
-
|
|
2218
|
-
let n = Array.isArray(m) ? e : [e[0]], r = await
|
|
2302
|
+
let e = h.map((e) => Qi(e));
|
|
2303
|
+
$i(e, new Map(e.map((e) => [e?.localId, e])));
|
|
2304
|
+
let n = Array.isArray(m) ? e : [e[0]], r = await g(n), i = await C(r.transactionHash);
|
|
2219
2305
|
if (!i) throw Error("Failed to send transaction");
|
|
2220
|
-
|
|
2221
|
-
for (let e of
|
|
2222
|
-
let a = e.find((e) => e?.localId ===
|
|
2223
|
-
await
|
|
2306
|
+
y = i;
|
|
2307
|
+
for (let e of Ui(i, l)) e.attestationUid && b.push(e.attestationUid);
|
|
2308
|
+
let a = e.find((e) => e?.localId === o.seedLocalId) ?? e[0];
|
|
2309
|
+
await pa({
|
|
2224
2310
|
receipt: i,
|
|
2225
2311
|
seedLocalId: a?.localId,
|
|
2226
2312
|
versionSchemaUid: a?.versionSchemaUid,
|
|
@@ -2228,62 +2314,62 @@ var la = L(async ({ input: { context: e } }) => {
|
|
|
2228
2314
|
listOfAttestationsCount: a?.listOfAttestations?.length ?? 0,
|
|
2229
2315
|
useModularExecutor: l,
|
|
2230
2316
|
publisherAddress: t
|
|
2231
|
-
}), await
|
|
2317
|
+
}), await ga({
|
|
2232
2318
|
receipt: i,
|
|
2233
2319
|
normalizedRequests: n,
|
|
2234
2320
|
useModularExecutor: l,
|
|
2235
2321
|
contractAddressForEvents: u.contractAddressForEvents
|
|
2236
2322
|
});
|
|
2237
|
-
let
|
|
2238
|
-
|
|
2323
|
+
let s = e[0], c = s?.seedUid, d = c === W || !c, f = s?.listOfAttestations?.length ?? 0, p = s?.seedSchemaUid, _ = d ? zi(i, p, l) ?? Vi(i, u.contractAddressForEvents, f, l) : void 0;
|
|
2324
|
+
_ && b.push(_), v = _ && e.length > 0 ? [{
|
|
2239
2325
|
...e[0],
|
|
2240
|
-
seedUid:
|
|
2326
|
+
seedUid: _
|
|
2241
2327
|
}, ...e.slice(1)] : e;
|
|
2242
2328
|
}
|
|
2243
|
-
|
|
2244
|
-
let
|
|
2245
|
-
ee && ee !== W && await
|
|
2329
|
+
Ii(o, v);
|
|
2330
|
+
let x = o, ee = v.find((e) => e?.localId === o.seedLocalId)?.seedUid;
|
|
2331
|
+
ee && ee !== W && await Li(x, t, y ? await q(y) : void 0), ua("requestData", m), ta(e);
|
|
2246
2332
|
try {
|
|
2247
2333
|
let { clearHtmlEmbeddedImageCoPublishRows: e } = await import("@seedprotocol/sdk");
|
|
2248
|
-
await e(
|
|
2334
|
+
await e(o.seedLocalId);
|
|
2249
2335
|
} catch {}
|
|
2250
|
-
let { collectPublishedBatch:
|
|
2251
|
-
for (let e of
|
|
2336
|
+
let { collectPublishedBatch: te } = await import("./collectBatchUids-CnIe9jUB.js").then((e) => e.t), S = v.find((e) => e?.localId === o.seedLocalId) ?? v[0];
|
|
2337
|
+
for (let e of v) e?.seedUid && b.push(String(e.seedUid)), e?.versionUid && b.push(String(e.versionUid));
|
|
2252
2338
|
return {
|
|
2253
2339
|
easPayload: m,
|
|
2254
|
-
publishedBatch:
|
|
2255
|
-
seedUid: String(
|
|
2256
|
-
versionUid:
|
|
2257
|
-
extraUids:
|
|
2340
|
+
publishedBatch: S?.seedUid ? te({
|
|
2341
|
+
seedUid: String(S.seedUid),
|
|
2342
|
+
versionUid: S.versionUid ? String(S.versionUid) : void 0,
|
|
2343
|
+
extraUids: b
|
|
2258
2344
|
}) : null
|
|
2259
2345
|
};
|
|
2260
|
-
}),
|
|
2261
|
-
async function
|
|
2346
|
+
}), va = R("seedProtocol:services:publish:verifyAttestations"), ya = "0x" + "0".repeat(64), ba = 64, xa = (e) => e == null ? "0x" + "0".repeat(ba) : typeof e == "string" ? "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(ba, "0").slice(-64) : "0x" + "0".repeat(ba), Sa = 5e3, Ca = 6;
|
|
2347
|
+
async function wa({ normalizedRequests: e, item: t }) {
|
|
2262
2348
|
let n = t.seedLocalId;
|
|
2263
2349
|
for (let t of e) {
|
|
2264
|
-
if (t.listOfAttestations.length === 0 || t.versionUid ===
|
|
2265
|
-
let e = t.listOfAttestations.map((e) =>
|
|
2266
|
-
for (let e = 1; e <=
|
|
2267
|
-
e > 1 && await new Promise((e) => setTimeout(e,
|
|
2350
|
+
if (t.listOfAttestations.length === 0 || t.versionUid === ya) continue;
|
|
2351
|
+
let e = t.listOfAttestations.map((e) => xa(e.schema).toLowerCase()), r = [], i;
|
|
2352
|
+
for (let e = 1; e <= Ca; e++) try {
|
|
2353
|
+
e > 1 && await new Promise((e) => setTimeout(e, Sa)), r = await Re({ versionUids: [t.versionUid] });
|
|
2268
2354
|
break;
|
|
2269
2355
|
} catch (t) {
|
|
2270
|
-
if (i = t,
|
|
2356
|
+
if (i = t, va("verifyAttestations attempt %d failed:", e, t), e === Ca) throw va("verifyAttestations: giving up after %d attempts", Ca), i;
|
|
2271
2357
|
}
|
|
2272
|
-
let a = r.map((e) => e.schemaId ?
|
|
2273
|
-
if (e.filter((e) => !o.has(e)).length > 0) throw new
|
|
2358
|
+
let a = r.map((e) => e.schemaId ? xa(e.schemaId).toLowerCase() : "").filter(Boolean), o = new Set(a);
|
|
2359
|
+
if (e.filter((e) => !o.has(e)).length > 0) throw new de(`Publish verification failed: Seed and Version attestations were created, but property/metadata attestations are missing or incomplete. Expected ${e.length} property attestations for schema(s) ${e.join(", ")}; found ${a.length}. Use PublishManager.retryAttestations('${n}') to retry.`, n, e, a, "METADATA_PROPERTIES_MISSING");
|
|
2274
2360
|
}
|
|
2275
2361
|
}
|
|
2276
2362
|
//#endregion
|
|
2277
2363
|
//#region src/services/publish/actors/createAttestationsDirectToEas.ts
|
|
2278
|
-
var
|
|
2279
|
-
if (e == null) return "0x" + "0".repeat(
|
|
2280
|
-
if (typeof e == "string") return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(
|
|
2364
|
+
var Ta = R("seedProtocol:services:publish:createAttestationsDirectToEas"), Ea = 64, Y = (e) => {
|
|
2365
|
+
if (e == null) return "0x" + "0".repeat(Ea);
|
|
2366
|
+
if (typeof e == "string") return "0x" + (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0").padStart(Ea, "0").slice(-64);
|
|
2281
2367
|
if (e instanceof Uint8Array || typeof ArrayBuffer < "u" && e instanceof ArrayBuffer) {
|
|
2282
2368
|
let t = e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
2283
|
-
return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("").padStart(
|
|
2369
|
+
return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("").padStart(Ea, "0").slice(-64);
|
|
2284
2370
|
}
|
|
2285
|
-
return "0x" + "0".repeat(
|
|
2286
|
-
},
|
|
2371
|
+
return "0x" + "0".repeat(Ea);
|
|
2372
|
+
}, Da = (e) => {
|
|
2287
2373
|
if (e == null || typeof e == "string" && (e === "" || e === "0x")) return "0x";
|
|
2288
2374
|
if (typeof e == "string") {
|
|
2289
2375
|
let t = (e.startsWith("0x") ? e.slice(2) : e).replace(/[^0-9a-fA-F]/g, "0");
|
|
@@ -2294,7 +2380,7 @@ var _a = R("seedProtocol:services:publish:createAttestationsDirectToEas"), va =
|
|
|
2294
2380
|
return "0x" + Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
2295
2381
|
}
|
|
2296
2382
|
return "0x";
|
|
2297
|
-
},
|
|
2383
|
+
}, Oa = async (e) => {
|
|
2298
2384
|
let t;
|
|
2299
2385
|
try {
|
|
2300
2386
|
t = await M.find({ seedLocalId: e });
|
|
@@ -2308,26 +2394,26 @@ var _a = R("seedProtocol:services:publish:createAttestationsDirectToEas"), va =
|
|
|
2308
2394
|
} catch {}
|
|
2309
2395
|
}, 200);
|
|
2310
2396
|
});
|
|
2311
|
-
},
|
|
2312
|
-
let { address: n, account: r, wallet:
|
|
2397
|
+
}, ka = L(async ({ input: { context: e, event: t } }) => {
|
|
2398
|
+
let { address: n, account: r, wallet: i } = e, a = e.arweaveTransactions ?? [], o = e.publishUploads ?? [], { item: c } = e;
|
|
2313
2399
|
if (!n || typeof n != "string" || !n.trim()) throw Error("No wallet address for publish. Connect a wallet and try again.");
|
|
2314
|
-
if (!
|
|
2315
|
-
if (!
|
|
2316
|
-
if (typeof
|
|
2317
|
-
let
|
|
2318
|
-
await
|
|
2319
|
-
let
|
|
2400
|
+
if (!i && !r) throw Error("Wallet session is missing. Reconnect your wallet and retry the publish.");
|
|
2401
|
+
if (!c?.seedLocalId) throw Error("Attestation recovery failed: Item data is missing. Delete this publish record and try a full publish from the beginning.");
|
|
2402
|
+
if (typeof c.getPublishUploads != "function" && (c = await Oa(c.seedLocalId)), a.length !== o.length) throw Error("Attestation recovery failed: Arweave transaction data is missing or incomplete. Delete this publish record and try a full publish from the beginning.");
|
|
2403
|
+
let l = Mi(e), d = l.txSender;
|
|
2404
|
+
await xn(c, l, { managedAddress: n });
|
|
2405
|
+
let f = a.map((e, t) => {
|
|
2320
2406
|
let n = e.transaction?.id;
|
|
2321
2407
|
if (!n || typeof n != "string") throw Error("Attestation recovery failed: Arweave transaction data did not survive restore. Delete this publish record and try a full publish from the beginning.");
|
|
2322
|
-
let r =
|
|
2408
|
+
let r = o[t];
|
|
2323
2409
|
if (!r) throw Error("Publish upload index mismatch");
|
|
2324
2410
|
return {
|
|
2325
2411
|
...r,
|
|
2326
2412
|
txId: n
|
|
2327
2413
|
};
|
|
2328
2414
|
});
|
|
2329
|
-
await
|
|
2330
|
-
let
|
|
2415
|
+
await Ri(f.map((e) => e.txId));
|
|
2416
|
+
let m = await c.getPublishPayload(f, { publishMode: e.publishMode ?? "patch" }), h = (Array.isArray(m) ? m : [m]).map((e) => {
|
|
2331
2417
|
let t = (e?.listOfAttestations ?? []).map((e) => {
|
|
2332
2418
|
let t = Array.isArray(e?.data) ? e.data : [];
|
|
2333
2419
|
return {
|
|
@@ -2335,7 +2421,7 @@ var _a = R("seedProtocol:services:publish:createAttestationsDirectToEas"), va =
|
|
|
2335
2421
|
data: t.map((e) => ({
|
|
2336
2422
|
...e,
|
|
2337
2423
|
refUID: Y(e?.refUID),
|
|
2338
|
-
data:
|
|
2424
|
+
data: Da(e?.data)
|
|
2339
2425
|
})),
|
|
2340
2426
|
...typeof e?._propertyName == "string" && e._propertyName !== "" ? { _propertyName: e._propertyName } : {},
|
|
2341
2427
|
...typeof e?._propertyNameForSchema == "string" && e._propertyNameForSchema !== "" ? { _propertyNameForSchema: e._propertyNameForSchema } : {}
|
|
@@ -2353,126 +2439,126 @@ var _a = R("seedProtocol:services:publish:createAttestationsDirectToEas"), va =
|
|
|
2353
2439
|
listOfAttestations: t,
|
|
2354
2440
|
propertiesToUpdate: n
|
|
2355
2441
|
};
|
|
2356
|
-
}),
|
|
2357
|
-
recipient:
|
|
2442
|
+
}), _ = new Map(h.map((e) => [e.localId, e])), y = {
|
|
2443
|
+
recipient: Ft,
|
|
2358
2444
|
expirationTime: BigInt(0),
|
|
2359
2445
|
revocable: !0,
|
|
2360
|
-
refUID:
|
|
2361
|
-
data:
|
|
2446
|
+
refUID: g,
|
|
2447
|
+
data: g,
|
|
2362
2448
|
value: BigInt(0)
|
|
2363
2449
|
};
|
|
2364
|
-
for (let e of
|
|
2450
|
+
for (let e of h) for (let t of e.propertiesToUpdate ?? []) {
|
|
2365
2451
|
let e = t.publishLocalId, n = Y(t.propertySchemaUid);
|
|
2366
2452
|
if (!e || !n) continue;
|
|
2367
|
-
let r =
|
|
2453
|
+
let r = _.get(e);
|
|
2368
2454
|
if (!r?.listOfAttestations) continue;
|
|
2369
2455
|
let i = r.listOfAttestations.find((e) => Y(e?.schema)?.toLowerCase() === n?.toLowerCase());
|
|
2370
2456
|
i && (!Array.isArray(i.data) || i.data.length === 0) && (i.data = [{
|
|
2371
|
-
...
|
|
2372
|
-
refUID:
|
|
2457
|
+
...y,
|
|
2458
|
+
refUID: g
|
|
2373
2459
|
}]);
|
|
2374
2460
|
}
|
|
2375
|
-
let
|
|
2376
|
-
for (let e = 0; e <
|
|
2377
|
-
let t =
|
|
2378
|
-
if (r ===
|
|
2379
|
-
let e =
|
|
2461
|
+
let b = Date.now(), x = [];
|
|
2462
|
+
for (let e = 0; e < h.length; e++) {
|
|
2463
|
+
let t = h[e], r = t.seedUid, i = t.versionUid;
|
|
2464
|
+
if (r === g) {
|
|
2465
|
+
let e = v({
|
|
2380
2466
|
schema: t.seedSchemaUid,
|
|
2381
2467
|
data: {
|
|
2382
|
-
refUID:
|
|
2383
|
-
data:
|
|
2468
|
+
refUID: g,
|
|
2469
|
+
data: s(t.seedSchemaUid),
|
|
2384
2470
|
revocable: t.seedIsRevocable
|
|
2385
2471
|
}
|
|
2386
|
-
}), n = await
|
|
2472
|
+
}), n = await d.sendTransaction(e), i = await C(n.transactionHash);
|
|
2387
2473
|
if (!i) throw Error("Failed to create Seed attestation");
|
|
2388
|
-
|
|
2389
|
-
let { easContractAddress: a } =
|
|
2390
|
-
if (!
|
|
2391
|
-
r =
|
|
2392
|
-
} else r !==
|
|
2393
|
-
if (r !==
|
|
2394
|
-
let e =
|
|
2474
|
+
b = await q(i);
|
|
2475
|
+
let { easContractAddress: a } = T(), o = u(i, a);
|
|
2476
|
+
if (!o || o === g) throw Error("Failed to get Seed UID from attestation receipt");
|
|
2477
|
+
r = o, t.seedUid = o, x.push(o), Ta("created Seed attestation", r);
|
|
2478
|
+
} else r !== g && x.push(r);
|
|
2479
|
+
if (r !== g && i === g) {
|
|
2480
|
+
let e = v({
|
|
2395
2481
|
schema: t.versionSchemaUid,
|
|
2396
2482
|
data: {
|
|
2397
2483
|
refUID: r,
|
|
2398
|
-
data:
|
|
2484
|
+
data: s(t.versionSchemaUid),
|
|
2399
2485
|
revocable: !0
|
|
2400
2486
|
}
|
|
2401
|
-
}),
|
|
2402
|
-
if (!
|
|
2403
|
-
|
|
2404
|
-
let { easContractAddress: c } =
|
|
2405
|
-
if (!
|
|
2406
|
-
|
|
2487
|
+
}), a = await d.sendTransaction(e), o = await C(a.transactionHash);
|
|
2488
|
+
if (!o) throw Error("Failed to create Version attestation");
|
|
2489
|
+
b = await q(o);
|
|
2490
|
+
let { easContractAddress: c } = T(), l = u(o, c);
|
|
2491
|
+
if (!l || l === g) throw Error("Failed to get Version UID from attestation receipt");
|
|
2492
|
+
i = l, t.versionUid = l, x.push(l), await tt({
|
|
2407
2493
|
seedLocalId: t.localId,
|
|
2408
|
-
versionUid:
|
|
2494
|
+
versionUid: l,
|
|
2409
2495
|
publisher: n,
|
|
2410
|
-
attestationCreatedAt:
|
|
2411
|
-
}),
|
|
2412
|
-
} else
|
|
2413
|
-
for (let e of t.listOfAttestations) for (let t of e.data) t.refUID =
|
|
2496
|
+
attestationCreatedAt: b
|
|
2497
|
+
}), Ta("created Version attestation", i);
|
|
2498
|
+
} else i !== g && x.push(i);
|
|
2499
|
+
for (let e of t.listOfAttestations) for (let t of e.data) t.refUID = i;
|
|
2414
2500
|
for (let e of t.propertiesToUpdate ?? []) {
|
|
2415
|
-
let t =
|
|
2501
|
+
let t = _.get(e.publishLocalId);
|
|
2416
2502
|
if (!t?.listOfAttestations) continue;
|
|
2417
2503
|
let n = Y(e.propertySchemaUid), i = t.listOfAttestations.find((e) => Y(e?.schema)?.toLowerCase() === n?.toLowerCase());
|
|
2418
|
-
i?.data?.[0] && (i.data[0].data =
|
|
2504
|
+
i?.data?.[0] && (i.data[0].data = s(r));
|
|
2419
2505
|
}
|
|
2420
|
-
let
|
|
2506
|
+
let a = t.listOfAttestations.map((e) => ({
|
|
2421
2507
|
schema: e.schema,
|
|
2422
2508
|
data: e.data.map((e) => ({
|
|
2423
|
-
recipient: e.recipient ??
|
|
2509
|
+
recipient: e.recipient ?? Ft,
|
|
2424
2510
|
expirationTime: e.expirationTime ?? 0n,
|
|
2425
2511
|
revocable: e.revocable ?? !0,
|
|
2426
|
-
refUID: e.refUID ??
|
|
2512
|
+
refUID: e.refUID ?? g,
|
|
2427
2513
|
data: e.data ?? "0x",
|
|
2428
2514
|
value: e.value ?? 0n
|
|
2429
2515
|
}))
|
|
2430
2516
|
}));
|
|
2431
|
-
if (
|
|
2432
|
-
let n =
|
|
2517
|
+
if (a.length > 0) {
|
|
2518
|
+
let n = ke(a), r = await d.sendTransaction(n), o = await C(r.transactionHash);
|
|
2433
2519
|
if (!o) throw Error("Failed to create property attestations");
|
|
2434
|
-
|
|
2435
|
-
let { easContractAddress:
|
|
2436
|
-
for (let e of
|
|
2437
|
-
let
|
|
2438
|
-
await
|
|
2520
|
+
b = await q(o), Ta("created property attestations for request", e);
|
|
2521
|
+
let { easContractAddress: s } = T(), c = p(o, s);
|
|
2522
|
+
for (let e of c) e.uid && x.push(e.uid);
|
|
2523
|
+
let l = t.listOfAttestations, u = c.length === l.length;
|
|
2524
|
+
await Ne({
|
|
2439
2525
|
seedLocalId: t.localId,
|
|
2440
|
-
attestationCreatedAtMs:
|
|
2441
|
-
versionUid:
|
|
2442
|
-
pairs:
|
|
2526
|
+
attestationCreatedAtMs: b ?? null,
|
|
2527
|
+
versionUid: i === g ? null : i,
|
|
2528
|
+
pairs: c.map((e, t) => ({
|
|
2443
2529
|
schemaUid: e.schemaUid,
|
|
2444
2530
|
attestationUid: e.uid,
|
|
2445
|
-
propertyName:
|
|
2531
|
+
propertyName: u && typeof l[t]?._propertyName == "string" && l[t]._propertyName !== "" ? l[t]._propertyName : void 0
|
|
2446
2532
|
}))
|
|
2447
2533
|
});
|
|
2448
2534
|
}
|
|
2449
2535
|
}
|
|
2450
|
-
|
|
2451
|
-
let ee =
|
|
2452
|
-
|
|
2536
|
+
Ii(c, h);
|
|
2537
|
+
let ee = c;
|
|
2538
|
+
h[0]?.seedUid && h[0].seedUid !== g && await Li(ee, n, b);
|
|
2453
2539
|
try {
|
|
2454
|
-
await
|
|
2455
|
-
normalizedRequests:
|
|
2456
|
-
item:
|
|
2540
|
+
await wa({
|
|
2541
|
+
normalizedRequests: h,
|
|
2542
|
+
item: c
|
|
2457
2543
|
});
|
|
2458
2544
|
} catch (e) {
|
|
2459
|
-
throw e instanceof
|
|
2545
|
+
throw e instanceof de || Ta("verifyAttestations failed (non-verification error):", e), e;
|
|
2460
2546
|
}
|
|
2461
|
-
|
|
2547
|
+
Ta("direct EAS publish complete"), ta(e);
|
|
2462
2548
|
try {
|
|
2463
2549
|
let { clearHtmlEmbeddedImageCoPublishRows: e } = await import("@seedprotocol/sdk");
|
|
2464
|
-
await e(
|
|
2550
|
+
await e(c.seedLocalId);
|
|
2465
2551
|
} catch {}
|
|
2466
|
-
let { collectPublishedBatch:
|
|
2552
|
+
let { collectPublishedBatch: te } = await import("./collectBatchUids-CnIe9jUB.js").then((e) => e.t), S = h.find((e) => e?.localId === c.seedLocalId) ?? h[0];
|
|
2467
2553
|
return {
|
|
2468
|
-
easPayload:
|
|
2469
|
-
publishedBatch:
|
|
2470
|
-
seedUid: String(
|
|
2471
|
-
versionUid:
|
|
2472
|
-
extraUids:
|
|
2554
|
+
easPayload: m,
|
|
2555
|
+
publishedBatch: S?.seedUid ? te({
|
|
2556
|
+
seedUid: String(S.seedUid),
|
|
2557
|
+
versionUid: S.versionUid ? String(S.versionUid) : void 0,
|
|
2558
|
+
extraUids: x
|
|
2473
2559
|
}) : null
|
|
2474
2560
|
};
|
|
2475
|
-
}),
|
|
2561
|
+
}), Aa = async (e) => {
|
|
2476
2562
|
let t;
|
|
2477
2563
|
try {
|
|
2478
2564
|
t = await M.find({ seedLocalId: e });
|
|
@@ -2485,21 +2571,21 @@ var _a = R("seedProtocol:services:publish:createAttestationsDirectToEas"), va =
|
|
|
2485
2571
|
}, 200);
|
|
2486
2572
|
});
|
|
2487
2573
|
};
|
|
2488
|
-
async function
|
|
2489
|
-
let t = typeof e.getPublishUploads == "function" ? e : await
|
|
2490
|
-
return await
|
|
2574
|
+
async function ja(e) {
|
|
2575
|
+
let t = typeof e.getPublishUploads == "function" ? e : await Aa(e.seedLocalId);
|
|
2576
|
+
return await Ge(t);
|
|
2491
2577
|
}
|
|
2492
2578
|
//#endregion
|
|
2493
2579
|
//#region src/services/publish/actors/checking.ts
|
|
2494
2580
|
var X = /* @__PURE__ */ new Set();
|
|
2495
|
-
async function
|
|
2496
|
-
let t =
|
|
2497
|
-
return t.useDirectEas ? "directEas" : t.useModularExecutor || await
|
|
2581
|
+
async function Ma(e) {
|
|
2582
|
+
let t = T();
|
|
2583
|
+
return t.useDirectEas ? "directEas" : t.useModularExecutor || await ce(e) ? "multiPublish" : "directEas";
|
|
2498
2584
|
}
|
|
2499
|
-
var
|
|
2585
|
+
var Na = zt(({ sendBack: e, input: { context: t } }) => {
|
|
2500
2586
|
let { item: n, account: r, wallet: i, publishMode: a, address: o } = t;
|
|
2501
2587
|
return (async () => {
|
|
2502
|
-
if (!await
|
|
2588
|
+
if (!await Ue(n)) {
|
|
2503
2589
|
e({ type: "notOwner" });
|
|
2504
2590
|
return;
|
|
2505
2591
|
}
|
|
@@ -2509,10 +2595,10 @@ var Ta = It(({ sendBack: e, input: { context: t } }) => {
|
|
|
2509
2595
|
}
|
|
2510
2596
|
X.add(n.seedLocalId);
|
|
2511
2597
|
try {
|
|
2512
|
-
await
|
|
2598
|
+
await Fe(), await ue();
|
|
2513
2599
|
let t = i ?? r;
|
|
2514
|
-
t && await
|
|
2515
|
-
let s = await
|
|
2600
|
+
t && await xn(n, t, { managedAddress: typeof o == "string" ? o : void 0 });
|
|
2601
|
+
let s = await nt(n, [], { publishMode: a ?? "patch" });
|
|
2516
2602
|
if (!s.isValid) {
|
|
2517
2603
|
X.delete(n.seedLocalId), e({
|
|
2518
2604
|
type: "validationFailed",
|
|
@@ -2529,15 +2615,15 @@ var Ta = It(({ sendBack: e, input: { context: t } }) => {
|
|
|
2529
2615
|
}
|
|
2530
2616
|
let c;
|
|
2531
2617
|
try {
|
|
2532
|
-
c = await
|
|
2618
|
+
c = await Ma(o.trim());
|
|
2533
2619
|
} catch (t) {
|
|
2534
2620
|
X.delete(n.seedLocalId), e({
|
|
2535
2621
|
type: "checkingFailed",
|
|
2536
|
-
error: Error(`Could not verify whether the publisher is a deployed contract on ${
|
|
2622
|
+
error: Error(`Could not verify whether the publisher is a deployed contract on ${E()}. Check your RPC connection and retry.`, { cause: t })
|
|
2537
2623
|
});
|
|
2538
2624
|
return;
|
|
2539
2625
|
}
|
|
2540
|
-
let l = await
|
|
2626
|
+
let l = await ja(n), u = T().useArweaveBundler, d = { attestationStrategy: c };
|
|
2541
2627
|
e(l ? u ? {
|
|
2542
2628
|
type: "validPublishProcessBundler",
|
|
2543
2629
|
...d
|
|
@@ -2562,38 +2648,38 @@ var Ta = It(({ sendBack: e, input: { context: t } }) => {
|
|
|
2562
2648
|
}), () => {
|
|
2563
2649
|
X.delete(n.seedLocalId);
|
|
2564
2650
|
};
|
|
2565
|
-
}), { SUCCESS:
|
|
2566
|
-
function
|
|
2651
|
+
}), { SUCCESS: Pa, FAILURE: Z } = ge;
|
|
2652
|
+
function Fa(e) {
|
|
2567
2653
|
let t = e.attestationStrategy;
|
|
2568
|
-
return t === "directEas" || t !== "multiPublish" &&
|
|
2654
|
+
return t === "directEas" || t !== "multiPublish" && T().useDirectEas;
|
|
2569
2655
|
}
|
|
2570
|
-
function
|
|
2656
|
+
function Ia(e) {
|
|
2571
2657
|
let t = e.attestationStrategy;
|
|
2572
|
-
return t === "multiPublish" || t !== "directEas" && !
|
|
2658
|
+
return t === "multiPublish" || t !== "directEas" && !T().useDirectEas;
|
|
2573
2659
|
}
|
|
2574
2660
|
function Q(e) {
|
|
2575
2661
|
let t = e;
|
|
2576
2662
|
return t.error ?? t.data;
|
|
2577
2663
|
}
|
|
2578
|
-
var
|
|
2664
|
+
var La = Bt({
|
|
2579
2665
|
types: {
|
|
2580
2666
|
context: {},
|
|
2581
2667
|
input: {}
|
|
2582
2668
|
},
|
|
2583
2669
|
actors: {
|
|
2584
|
-
createArweaveTransactions:
|
|
2585
|
-
createArweaveTransactionsPhase2:
|
|
2586
|
-
createArweaveDataItems:
|
|
2587
|
-
createArweaveDataItemsPhase2:
|
|
2588
|
-
sendReimbursementRequest:
|
|
2589
|
-
pollForConfirmation:
|
|
2590
|
-
uploadData:
|
|
2591
|
-
uploadViaBundler:
|
|
2592
|
-
createAttestations:
|
|
2593
|
-
createAttestationsDirectToEas:
|
|
2594
|
-
checking:
|
|
2595
|
-
preparingHtmlEmbedded:
|
|
2596
|
-
rewritingHtmlEmbedded:
|
|
2670
|
+
createArweaveTransactions: En,
|
|
2671
|
+
createArweaveTransactionsPhase2: Dn,
|
|
2672
|
+
createArweaveDataItems: pr,
|
|
2673
|
+
createArweaveDataItemsPhase2: hr,
|
|
2674
|
+
sendReimbursementRequest: Sr,
|
|
2675
|
+
pollForConfirmation: Cr,
|
|
2676
|
+
uploadData: Tr,
|
|
2677
|
+
uploadViaBundler: Ar,
|
|
2678
|
+
createAttestations: _a,
|
|
2679
|
+
createAttestationsDirectToEas: ka,
|
|
2680
|
+
checking: Na,
|
|
2681
|
+
preparingHtmlEmbedded: On,
|
|
2682
|
+
rewritingHtmlEmbedded: An
|
|
2597
2683
|
},
|
|
2598
2684
|
actions: {
|
|
2599
2685
|
handleError: ({ event: e }) => {
|
|
@@ -2714,7 +2800,7 @@ var ka = Lt({
|
|
|
2714
2800
|
actions: I({ attestationStrategy: ({ event: e }) => e.attestationStrategy })
|
|
2715
2801
|
},
|
|
2716
2802
|
skipArweave: [{
|
|
2717
|
-
guard: ({ context: e }) =>
|
|
2803
|
+
guard: ({ context: e }) => Fa(e),
|
|
2718
2804
|
target: "creatingAttestationsDirectToEas",
|
|
2719
2805
|
actions: I({
|
|
2720
2806
|
arweaveTransactions: () => [],
|
|
@@ -2722,7 +2808,7 @@ var ka = Lt({
|
|
|
2722
2808
|
attestationStrategy: ({ event: e }) => e.attestationStrategy
|
|
2723
2809
|
})
|
|
2724
2810
|
}, {
|
|
2725
|
-
guard: ({ context: e }) =>
|
|
2811
|
+
guard: ({ context: e }) => Ia(e),
|
|
2726
2812
|
target: "creatingAttestations",
|
|
2727
2813
|
actions: I({
|
|
2728
2814
|
arweaveTransactions: () => [],
|
|
@@ -2740,7 +2826,7 @@ var ka = Lt({
|
|
|
2740
2826
|
src: "preparingHtmlEmbedded",
|
|
2741
2827
|
input: ({ context: e }) => ({ context: e }),
|
|
2742
2828
|
onDone: [{
|
|
2743
|
-
guard: () =>
|
|
2829
|
+
guard: () => T().useArweaveBundler,
|
|
2744
2830
|
target: "creatingArweaveDataItems",
|
|
2745
2831
|
actions: I({ htmlEmbeddedDeferredHtmlSeedLocalIds: ({ event: e }) => e.output.deferredHtmlSeedLocalIds })
|
|
2746
2832
|
}, {
|
|
@@ -2826,7 +2912,7 @@ var ka = Lt({
|
|
|
2826
2912
|
on: {
|
|
2827
2913
|
uploadComplete: [
|
|
2828
2914
|
{
|
|
2829
|
-
guard: ({ context: e }) =>
|
|
2915
|
+
guard: ({ context: e }) => Fa(e),
|
|
2830
2916
|
target: "creatingAttestationsDirectToEas",
|
|
2831
2917
|
actions: I({
|
|
2832
2918
|
completionPercentage: 100,
|
|
@@ -2845,7 +2931,7 @@ var ka = Lt({
|
|
|
2845
2931
|
})
|
|
2846
2932
|
},
|
|
2847
2933
|
{
|
|
2848
|
-
guard: ({ context: e }) =>
|
|
2934
|
+
guard: ({ context: e }) => Ia(e),
|
|
2849
2935
|
target: "creatingAttestations",
|
|
2850
2936
|
actions: I({
|
|
2851
2937
|
completionPercentage: 100,
|
|
@@ -2888,7 +2974,7 @@ var ka = Lt({
|
|
|
2888
2974
|
uploadingViaBundlerPhase2: {
|
|
2889
2975
|
on: {
|
|
2890
2976
|
uploadComplete: [{
|
|
2891
|
-
guard: ({ context: e }) =>
|
|
2977
|
+
guard: ({ context: e }) => Fa(e),
|
|
2892
2978
|
target: "creatingAttestationsDirectToEas",
|
|
2893
2979
|
actions: I({
|
|
2894
2980
|
completionPercentage: 100,
|
|
@@ -2896,7 +2982,7 @@ var ka = Lt({
|
|
|
2896
2982
|
arweaveUploadData: () => void 0
|
|
2897
2983
|
})
|
|
2898
2984
|
}, {
|
|
2899
|
-
guard: ({ context: e }) =>
|
|
2985
|
+
guard: ({ context: e }) => Ia(e),
|
|
2900
2986
|
target: "creatingAttestations",
|
|
2901
2987
|
actions: I({
|
|
2902
2988
|
completionPercentage: 100,
|
|
@@ -2925,7 +3011,7 @@ var ka = Lt({
|
|
|
2925
3011
|
}) },
|
|
2926
3012
|
uploadComplete: [
|
|
2927
3013
|
{
|
|
2928
|
-
guard: ({ context: e }) =>
|
|
3014
|
+
guard: ({ context: e }) => Fa(e),
|
|
2929
3015
|
target: "creatingAttestationsDirectToEas",
|
|
2930
3016
|
actions: I({ completionPercentage: 100 })
|
|
2931
3017
|
},
|
|
@@ -2938,7 +3024,7 @@ var ka = Lt({
|
|
|
2938
3024
|
})
|
|
2939
3025
|
},
|
|
2940
3026
|
{
|
|
2941
|
-
guard: ({ context: e }) =>
|
|
3027
|
+
guard: ({ context: e }) => Ia(e),
|
|
2942
3028
|
target: "creatingAttestations",
|
|
2943
3029
|
actions: I({ completionPercentage: 100 })
|
|
2944
3030
|
}
|
|
@@ -2957,10 +3043,10 @@ var ka = Lt({
|
|
|
2957
3043
|
src: "rewritingHtmlEmbedded",
|
|
2958
3044
|
input: ({ context: e }) => ({ context: e }),
|
|
2959
3045
|
onDone: [{
|
|
2960
|
-
guard: () => !
|
|
3046
|
+
guard: () => !T().useArweaveBundler,
|
|
2961
3047
|
target: "creatingArweaveTransactionsPhase2"
|
|
2962
3048
|
}, {
|
|
2963
|
-
guard: () =>
|
|
3049
|
+
guard: () => T().useArweaveBundler,
|
|
2964
3050
|
target: "creatingArweaveDataItemsPhase2"
|
|
2965
3051
|
}],
|
|
2966
3052
|
onError: {
|
|
@@ -2996,11 +3082,11 @@ var ka = Lt({
|
|
|
2996
3082
|
currentTransactionIndex: ({ event: e }) => e.currentTransactionIndex
|
|
2997
3083
|
}) },
|
|
2998
3084
|
uploadComplete: [{
|
|
2999
|
-
guard: ({ context: e }) =>
|
|
3085
|
+
guard: ({ context: e }) => Fa(e),
|
|
3000
3086
|
target: "creatingAttestationsDirectToEas",
|
|
3001
3087
|
actions: I({ completionPercentage: 100 })
|
|
3002
3088
|
}, {
|
|
3003
|
-
guard: ({ context: e }) =>
|
|
3089
|
+
guard: ({ context: e }) => Ia(e),
|
|
3004
3090
|
target: "creatingAttestations",
|
|
3005
3091
|
actions: I({
|
|
3006
3092
|
completionPercentage: 100,
|
|
@@ -3025,7 +3111,7 @@ var ka = Lt({
|
|
|
3025
3111
|
event: t
|
|
3026
3112
|
}),
|
|
3027
3113
|
onDone: {
|
|
3028
|
-
target:
|
|
3114
|
+
target: Pa,
|
|
3029
3115
|
actions: I({
|
|
3030
3116
|
easPayload: ({ event: e }) => e.output?.easPayload,
|
|
3031
3117
|
publishedBatch: ({ event: e }) => e.output?.publishedBatch ?? null
|
|
@@ -3047,7 +3133,7 @@ var ka = Lt({
|
|
|
3047
3133
|
event: t
|
|
3048
3134
|
}),
|
|
3049
3135
|
onDone: {
|
|
3050
|
-
target:
|
|
3136
|
+
target: Pa,
|
|
3051
3137
|
actions: I({
|
|
3052
3138
|
easPayload: ({ event: e }) => e.output?.easPayload,
|
|
3053
3139
|
publishedBatch: ({ event: e }) => e.output?.publishedBatch ?? null
|
|
@@ -3068,7 +3154,7 @@ var ka = Lt({
|
|
|
3068
3154
|
},
|
|
3069
3155
|
type: "final"
|
|
3070
3156
|
},
|
|
3071
|
-
[
|
|
3157
|
+
[Pa]: {
|
|
3072
3158
|
entry: ({ context: e }) => {
|
|
3073
3159
|
let t = e.publishedBatch, n = e.onPublished;
|
|
3074
3160
|
if (!n || !t?.seedUid) return;
|
|
@@ -3089,96 +3175,96 @@ var ka = Lt({
|
|
|
3089
3175
|
type: "final"
|
|
3090
3176
|
}
|
|
3091
3177
|
}
|
|
3092
|
-
}),
|
|
3178
|
+
}), Ra = I(({ context: e, event: t }) => {
|
|
3093
3179
|
let n = t, r = n.publishProcesses ?? /* @__PURE__ */ new Map(), i = n.subscriptions ?? /* @__PURE__ */ new Map();
|
|
3094
3180
|
return {
|
|
3095
3181
|
publishProcesses: new Map(r),
|
|
3096
3182
|
subscriptions: new Map(i)
|
|
3097
3183
|
};
|
|
3098
|
-
}),
|
|
3099
|
-
function
|
|
3100
|
-
|
|
3184
|
+
}), za = null;
|
|
3185
|
+
function Ba(e) {
|
|
3186
|
+
za = e;
|
|
3101
3187
|
}
|
|
3102
|
-
function
|
|
3103
|
-
return
|
|
3188
|
+
function Va() {
|
|
3189
|
+
return za;
|
|
3104
3190
|
}
|
|
3105
3191
|
//#endregion
|
|
3106
3192
|
//#region src/services/publishManager/actors/subscribe.ts
|
|
3107
|
-
var
|
|
3108
|
-
function
|
|
3193
|
+
var Ha = R("seedProtocol:services:PublishManager:actors:subscribe");
|
|
3194
|
+
function Ua(e) {
|
|
3109
3195
|
let t = e.value;
|
|
3110
3196
|
return typeof t == "string" ? t : t && typeof t == "object" ? Object.keys(t)[0] ?? "" : "";
|
|
3111
3197
|
}
|
|
3112
|
-
function
|
|
3113
|
-
return
|
|
3114
|
-
}
|
|
3115
|
-
var
|
|
3116
|
-
let
|
|
3117
|
-
|
|
3118
|
-
},
|
|
3119
|
-
let
|
|
3120
|
-
|
|
3198
|
+
function Wa(e) {
|
|
3199
|
+
return a.includes(e);
|
|
3200
|
+
}
|
|
3201
|
+
var Ga = zt(({ receive: e, input: { publishProcess: n, seedLocalId: r } }) => {
|
|
3202
|
+
let i = Va(), a = null, o = () => {
|
|
3203
|
+
a != null && (clearInterval(a), a = null);
|
|
3204
|
+
}, s = (e) => {
|
|
3205
|
+
let s = Ua(e);
|
|
3206
|
+
Wa(s) && a == null && i ? a = setInterval(() => {
|
|
3121
3207
|
try {
|
|
3122
|
-
let e =
|
|
3208
|
+
let e = n.getSnapshot();
|
|
3123
3209
|
if (e.status === "done") {
|
|
3124
|
-
|
|
3210
|
+
o();
|
|
3125
3211
|
return;
|
|
3126
3212
|
}
|
|
3127
|
-
if (!
|
|
3128
|
-
|
|
3213
|
+
if (!Wa(Ua(e))) {
|
|
3214
|
+
o();
|
|
3129
3215
|
return;
|
|
3130
3216
|
}
|
|
3131
3217
|
} catch {
|
|
3132
3218
|
return;
|
|
3133
3219
|
}
|
|
3134
|
-
|
|
3135
|
-
},
|
|
3136
|
-
},
|
|
3137
|
-
|
|
3220
|
+
i?.savePublish(r, n);
|
|
3221
|
+
}, t) : Wa(s) || o();
|
|
3222
|
+
}, c = n.subscribe(async (e) => {
|
|
3223
|
+
Ha("Publish state:", e.value), i && (e.status === "done" ? (o(), i.savePublish(r, n, { triggerPublishDone: !0 })) : (i.savePublish(r, n), s(e)));
|
|
3138
3224
|
});
|
|
3139
3225
|
e(({ type: e }) => {
|
|
3140
|
-
e === "UNSUBSCRIBE" && (
|
|
3226
|
+
e === "UNSUBSCRIBE" && (Ha("Received UNSUBSCRIBE event"), o(), c.unsubscribe(), i?.removeSubscription(r));
|
|
3141
3227
|
});
|
|
3142
|
-
}),
|
|
3143
|
-
function
|
|
3144
|
-
let t =
|
|
3145
|
-
return
|
|
3228
|
+
}), Ka = /* @__PURE__ */ new Map(), qa = 1;
|
|
3229
|
+
function Ja(e) {
|
|
3230
|
+
let t = qa++;
|
|
3231
|
+
return Ka.set(t, e), t;
|
|
3146
3232
|
}
|
|
3147
|
-
function
|
|
3233
|
+
function Ya(e, t) {
|
|
3148
3234
|
if (e == null) return;
|
|
3149
|
-
let n =
|
|
3150
|
-
n && (
|
|
3235
|
+
let n = Ka.get(e);
|
|
3236
|
+
n && (Ka.delete(e), n(t));
|
|
3151
3237
|
}
|
|
3152
3238
|
//#endregion
|
|
3153
3239
|
//#region src/services/publishManager/actions/createPublish.ts
|
|
3154
|
-
function
|
|
3240
|
+
function Xa(e) {
|
|
3155
3241
|
if (e) {
|
|
3156
|
-
if (
|
|
3157
|
-
if (
|
|
3158
|
-
let t =
|
|
3242
|
+
if (i(e)) return e;
|
|
3243
|
+
if (m(e)) {
|
|
3244
|
+
let t = he();
|
|
3159
3245
|
if (t && t.signer.address.toLowerCase() === e.address.toLowerCase()) return t;
|
|
3160
3246
|
throw Error("@seedprotocol/publish: createPublish requires a PublishWallet (signer + txSender). Use fromEthersWallet, fromEip1193Provider, or fromThirdwebAccount.");
|
|
3161
3247
|
}
|
|
3162
3248
|
throw Error("@seedprotocol/publish: createPublish account must be a PublishWallet. Thirdweb Account must be wrapped with fromThirdwebAccount from @seedprotocol/publish/thirdweb.");
|
|
3163
3249
|
}
|
|
3164
3250
|
}
|
|
3165
|
-
function
|
|
3251
|
+
function Za(e) {
|
|
3166
3252
|
if (e) {
|
|
3167
3253
|
if (e instanceof F.Wallet) return e;
|
|
3168
|
-
if (
|
|
3169
|
-
if (
|
|
3254
|
+
if (i(e)) return e.signer;
|
|
3255
|
+
if (m(e)) return e;
|
|
3170
3256
|
}
|
|
3171
3257
|
}
|
|
3172
|
-
var
|
|
3258
|
+
var Qa = Rt(({ event: e, enqueue: t }) => {
|
|
3173
3259
|
let { item: n, address: r, account: i, options: a, createToken: o } = e;
|
|
3174
3260
|
if (!(r != null && typeof r == "string" && r.trim().length > 0)) {
|
|
3175
|
-
console.warn("[createPublish] No valid wallet address; skipping spawn."),
|
|
3261
|
+
console.warn("[createPublish] No valid wallet address; skipping spawn."), Ya(o, void 0);
|
|
3176
3262
|
return;
|
|
3177
3263
|
}
|
|
3178
3264
|
t.assign(({ context: e, spawn: t }) => {
|
|
3179
3265
|
let { publishProcesses: s } = e;
|
|
3180
|
-
if (s && s.has(n.seedLocalId)) return console.warn(`Publish process with seedLocalId "${n.seedLocalId}" already exists.`),
|
|
3181
|
-
let c = typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `run_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`, l =
|
|
3266
|
+
if (s && s.has(n.seedLocalId)) return console.warn(`Publish process with seedLocalId "${n.seedLocalId}" already exists.`), Ya(o, void 0), e;
|
|
3267
|
+
let c = typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `run_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`, l = T(), u = [...l.arweaveUploadTags ?? [], ...a?.arweaveUploadTags ?? []], d = Xa(i) ?? he() ?? void 0, f = t(La, { input: {
|
|
3182
3268
|
item: n,
|
|
3183
3269
|
address: r,
|
|
3184
3270
|
wallet: d,
|
|
@@ -3186,7 +3272,7 @@ var Wa = Ft(({ event: e, enqueue: t }) => {
|
|
|
3186
3272
|
modelName: n.modelName,
|
|
3187
3273
|
schemaId: n.schemaUid,
|
|
3188
3274
|
signDataItems: a?.signDataItems,
|
|
3189
|
-
dataItemSigner:
|
|
3275
|
+
dataItemSigner: Za(a?.dataItemSigner),
|
|
3190
3276
|
signArweaveTransactions: a?.signArweaveTransactions,
|
|
3191
3277
|
arweaveJwk: a?.arweaveJwk,
|
|
3192
3278
|
publishMode: a?.publishMode ?? "patch",
|
|
@@ -3197,7 +3283,7 @@ var Wa = Ft(({ event: e, enqueue: t }) => {
|
|
|
3197
3283
|
} });
|
|
3198
3284
|
s.set(n.seedLocalId, f);
|
|
3199
3285
|
let p = new Map(e.settledPublishes);
|
|
3200
|
-
return p.delete(n.seedLocalId),
|
|
3286
|
+
return p.delete(n.seedLocalId), Ya(o, f), {
|
|
3201
3287
|
...e,
|
|
3202
3288
|
publishProcesses: s,
|
|
3203
3289
|
settledPublishes: p
|
|
@@ -3206,7 +3292,7 @@ var Wa = Ft(({ event: e, enqueue: t }) => {
|
|
|
3206
3292
|
let { subscriptions: r, publishProcesses: i } = e, a = i.get(n.seedLocalId);
|
|
3207
3293
|
if (!a) return console.warn(`Publish process with seedLocalId "${n.seedLocalId}" does not exist.`), e;
|
|
3208
3294
|
if (r.has(n.seedLocalId)) return console.warn(`Subscription with seedLocalId "${n.seedLocalId}" already exists.`), e;
|
|
3209
|
-
let o = t(
|
|
3295
|
+
let o = t(Ga, { input: {
|
|
3210
3296
|
publishProcess: a,
|
|
3211
3297
|
seedLocalId: n.seedLocalId
|
|
3212
3298
|
} });
|
|
@@ -3215,47 +3301,47 @@ var Wa = Ft(({ event: e, enqueue: t }) => {
|
|
|
3215
3301
|
subscriptions: new Map(r)
|
|
3216
3302
|
};
|
|
3217
3303
|
});
|
|
3218
|
-
}),
|
|
3219
|
-
let { seedLocalId: n, account: r } = t,
|
|
3220
|
-
if (!
|
|
3304
|
+
}), $a = ({ context: e, event: t }) => {
|
|
3305
|
+
let { seedLocalId: n, account: r } = t, a = e.publishProcesses.get(n);
|
|
3306
|
+
if (!a) {
|
|
3221
3307
|
console.warn(`Publish process with seedLocalId "${n}" does not exist.`);
|
|
3222
3308
|
return;
|
|
3223
3309
|
}
|
|
3224
|
-
let
|
|
3225
|
-
r != null && !
|
|
3310
|
+
let o = r == null ? he() ?? void 0 : i(r) ? r : void 0;
|
|
3311
|
+
r != null && !o && console.warn("[retryAttestations] account must be a PublishWallet. Use fromThirdwebAccount / fromEip1193Provider / fromEthersWallet."), a.send({
|
|
3226
3312
|
type: "retry",
|
|
3227
|
-
account:
|
|
3228
|
-
wallet:
|
|
3313
|
+
account: o,
|
|
3314
|
+
wallet: o
|
|
3229
3315
|
});
|
|
3230
3316
|
};
|
|
3231
3317
|
//#endregion
|
|
3232
3318
|
//#region src/services/publishManager/actions/stopScopedOrStandaloneChild.ts
|
|
3233
|
-
function
|
|
3319
|
+
function eo(e, t, n) {
|
|
3234
3320
|
t._parent === e ? n.stopChild(t) : t.stop();
|
|
3235
3321
|
}
|
|
3236
3322
|
//#endregion
|
|
3237
3323
|
//#region src/services/publishManager/actors/savePublish.ts
|
|
3238
|
-
var
|
|
3239
|
-
function
|
|
3240
|
-
let n = (
|
|
3241
|
-
return
|
|
3324
|
+
var to = R("seedProtocol:services:PublishManager:actors:savePublish"), no = /* @__PURE__ */ new Map();
|
|
3325
|
+
function ro(e, t) {
|
|
3326
|
+
let n = (no.get(e) ?? Promise.resolve()).then(t);
|
|
3327
|
+
return no.set(e, n.catch(() => {})), n;
|
|
3242
3328
|
}
|
|
3243
|
-
function
|
|
3329
|
+
function io(e) {
|
|
3244
3330
|
return e === "completed" || e === "failed" || e === "interrupted";
|
|
3245
3331
|
}
|
|
3246
|
-
function
|
|
3332
|
+
function ao(e) {
|
|
3247
3333
|
return e.status === "done" ? e.value === "success" ? "completed" : e.value === "failure" ? "failed" : "completed" : "in_progress";
|
|
3248
3334
|
}
|
|
3249
|
-
var
|
|
3250
|
-
function
|
|
3335
|
+
var oo = 500, so = 2e3, co = 100;
|
|
3336
|
+
function lo(e) {
|
|
3251
3337
|
return JSON.stringify(e, (e, t) => typeof t == "bigint" ? t.toString() : t);
|
|
3252
3338
|
}
|
|
3253
|
-
function
|
|
3339
|
+
function uo(e) {
|
|
3254
3340
|
if (typeof e != "object" || !e) return;
|
|
3255
3341
|
let t = e, n = t.snapshot, r = (t.context ?? n?.context)?.publishRunId;
|
|
3256
3342
|
return typeof r == "string" && r.length > 0 ? r : void 0;
|
|
3257
3343
|
}
|
|
3258
|
-
function
|
|
3344
|
+
function fo(e) {
|
|
3259
3345
|
if (e instanceof Error) return e.message;
|
|
3260
3346
|
if (typeof e == "object") {
|
|
3261
3347
|
let t = e.message;
|
|
@@ -3263,21 +3349,21 @@ function ro(e) {
|
|
|
3263
3349
|
}
|
|
3264
3350
|
return String(e);
|
|
3265
3351
|
}
|
|
3266
|
-
function
|
|
3352
|
+
function po(e) {
|
|
3267
3353
|
if (typeof e != "object" || !e) return;
|
|
3268
3354
|
let t = e.code;
|
|
3269
|
-
return typeof t == "string" && t.length > 0 ? t.slice(0,
|
|
3355
|
+
return typeof t == "string" && t.length > 0 ? t.slice(0, co) : void 0;
|
|
3270
3356
|
}
|
|
3271
|
-
function
|
|
3357
|
+
function mo(e, t) {
|
|
3272
3358
|
if (!e?.error || t !== "failed" && t !== "in_progress") return {};
|
|
3273
|
-
let n = e.error, r =
|
|
3274
|
-
if (n instanceof Error && n.stack) o = n.stack.slice(0,
|
|
3359
|
+
let n = e.error, r = fo(n)?.slice(0, oo), i = e.errorStep, a = po(n), o;
|
|
3360
|
+
if (n instanceof Error && n.stack) o = n.stack.slice(0, so);
|
|
3275
3361
|
else if (typeof n == "object" && n) try {
|
|
3276
|
-
o = JSON.stringify(n).slice(0,
|
|
3362
|
+
o = JSON.stringify(n).slice(0, so);
|
|
3277
3363
|
} catch {
|
|
3278
|
-
o = String(n).slice(0,
|
|
3364
|
+
o = String(n).slice(0, so);
|
|
3279
3365
|
}
|
|
3280
|
-
else n != null && (o = String(n).slice(0,
|
|
3366
|
+
else n != null && (o = String(n).slice(0, so));
|
|
3281
3367
|
return {
|
|
3282
3368
|
...r === void 0 ? {} : { errorMessage: r },
|
|
3283
3369
|
errorStep: i,
|
|
@@ -3285,14 +3371,14 @@ function ao(e, t) {
|
|
|
3285
3371
|
errorCode: a ?? null
|
|
3286
3372
|
};
|
|
3287
3373
|
}
|
|
3288
|
-
function
|
|
3289
|
-
return
|
|
3374
|
+
function ho(e) {
|
|
3375
|
+
return ro(e, async () => {
|
|
3290
3376
|
let t = A.getAppDb();
|
|
3291
3377
|
if (!t) {
|
|
3292
|
-
|
|
3378
|
+
to("markInProgressPublishInterrupted: DB not ready, skipping");
|
|
3293
3379
|
return;
|
|
3294
3380
|
}
|
|
3295
|
-
let n = await t.select().from(N).where(
|
|
3381
|
+
let n = await t.select().from(N).where(Vt(z(N.seedLocalId, e), z(N.status, "in_progress"))).orderBy(Ht(N.updatedAt)).limit(1);
|
|
3296
3382
|
if (n.length === 0) return;
|
|
3297
3383
|
let r = Date.now();
|
|
3298
3384
|
await t.update(N).set({
|
|
@@ -3306,20 +3392,20 @@ function oo(e) {
|
|
|
3306
3392
|
}).where(z(N.id, n[0].id));
|
|
3307
3393
|
});
|
|
3308
3394
|
}
|
|
3309
|
-
var
|
|
3310
|
-
|
|
3395
|
+
var go = zt(({ sendBack: e, input: { persistedSnapshot: t, seedLocalId: n, triggerPublishDone: r } }) => {
|
|
3396
|
+
to("savePublish seedLocalId", n);
|
|
3311
3397
|
let i = t;
|
|
3312
|
-
|
|
3398
|
+
ro(n, async () => {
|
|
3313
3399
|
let a = A.getAppDb();
|
|
3314
3400
|
if (!a) {
|
|
3315
|
-
|
|
3401
|
+
to("savePublish: DB not ready, skipping"), e({
|
|
3316
3402
|
type: "SAVE_PUBLISH_DONE",
|
|
3317
3403
|
seedLocalId: n,
|
|
3318
3404
|
triggerPublishDone: r
|
|
3319
3405
|
});
|
|
3320
3406
|
return;
|
|
3321
3407
|
}
|
|
3322
|
-
let o = await a.select().from(N).where(
|
|
3408
|
+
let o = await a.select().from(N).where(Vt(z(N.seedLocalId, n), z(N.status, "in_progress"))).orderBy(Ht(N.updatedAt)).limit(1), s = typeof t == "string" ? t : lo(t), c = ao(i), l = Date.now(), u = mo(i.context, c);
|
|
3323
3409
|
if (o.length > 0) {
|
|
3324
3410
|
let e = o[0];
|
|
3325
3411
|
await a.update(N).set({
|
|
@@ -3330,12 +3416,12 @@ var so = It(({ sendBack: e, input: { persistedSnapshot: t, seedLocalId: n, trigg
|
|
|
3330
3416
|
...u
|
|
3331
3417
|
}).where(z(N.id, e.id));
|
|
3332
3418
|
} else {
|
|
3333
|
-
let e =
|
|
3419
|
+
let e = uo(i);
|
|
3334
3420
|
if (e != null && c === "in_progress" && i.status !== "done") {
|
|
3335
|
-
let t = (await a.select().from(N).where(z(N.seedLocalId, n)).orderBy(
|
|
3336
|
-
if (t &&
|
|
3337
|
-
if (
|
|
3338
|
-
|
|
3421
|
+
let t = (await a.select().from(N).where(z(N.seedLocalId, n)).orderBy(Ht(N.startedAt)).limit(1))[0];
|
|
3422
|
+
if (t && io(t.status)) try {
|
|
3423
|
+
if (uo(JSON.parse(t.persistedSnapshot)) === e) {
|
|
3424
|
+
to("savePublish: skip stale insert — same publishRunId as latest terminal row", n, e);
|
|
3339
3425
|
return;
|
|
3340
3426
|
}
|
|
3341
3427
|
} catch {}
|
|
@@ -3360,15 +3446,15 @@ var so = It(({ sendBack: e, input: { persistedSnapshot: t, seedLocalId: n, trigg
|
|
|
3360
3446
|
triggerPublishDone: r
|
|
3361
3447
|
});
|
|
3362
3448
|
}).catch((t) => {
|
|
3363
|
-
|
|
3449
|
+
to("savePublish error", t), e({
|
|
3364
3450
|
type: "SAVE_PUBLISH_DONE",
|
|
3365
3451
|
seedLocalId: n,
|
|
3366
3452
|
triggerPublishDone: r
|
|
3367
3453
|
});
|
|
3368
3454
|
});
|
|
3369
|
-
}),
|
|
3455
|
+
}), _o = Rt(({ context: e, event: t, enqueue: n, self: r }) => {
|
|
3370
3456
|
let { publishProcesses: i, subscriptions: a } = e, { seedLocalId: o } = t;
|
|
3371
|
-
|
|
3457
|
+
ho(o).catch((e) => {
|
|
3372
3458
|
console.warn(`[stopPublish] Failed to mark publish_processes row interrupted for "${o}":`, e);
|
|
3373
3459
|
});
|
|
3374
3460
|
let s = i.get(o);
|
|
@@ -3376,9 +3462,9 @@ var so = It(({ sendBack: e, input: { persistedSnapshot: t, seedLocalId: n, trigg
|
|
|
3376
3462
|
console.warn(`Publish process with seedLocalId "${o}" does not exist.`);
|
|
3377
3463
|
return;
|
|
3378
3464
|
}
|
|
3379
|
-
|
|
3465
|
+
eo(r, s, n);
|
|
3380
3466
|
let c = a.get(o);
|
|
3381
|
-
c &&
|
|
3467
|
+
c && eo(r, c, n);
|
|
3382
3468
|
let l = new Map(i);
|
|
3383
3469
|
l.delete(o);
|
|
3384
3470
|
let u = new Map(a);
|
|
@@ -3386,16 +3472,16 @@ var so = It(({ sendBack: e, input: { persistedSnapshot: t, seedLocalId: n, trigg
|
|
|
3386
3472
|
publishProcesses: l,
|
|
3387
3473
|
subscriptions: u
|
|
3388
3474
|
});
|
|
3389
|
-
}),
|
|
3390
|
-
|
|
3391
|
-
|
|
3475
|
+
}), vo = R("seedProtocol:PublishManager:index"), yo = Rt(({ context: e, enqueue: t, self: n }) => {
|
|
3476
|
+
vo("Stopping all actors..."), e.publishProcesses.forEach((e) => {
|
|
3477
|
+
eo(n, e, t);
|
|
3392
3478
|
}), e.subscriptions.forEach((e) => {
|
|
3393
|
-
|
|
3479
|
+
eo(n, e, t);
|
|
3394
3480
|
}), t.assign({
|
|
3395
3481
|
publishProcesses: /* @__PURE__ */ new Map(),
|
|
3396
3482
|
subscriptions: /* @__PURE__ */ new Map()
|
|
3397
3483
|
});
|
|
3398
|
-
}),
|
|
3484
|
+
}), bo = Rt(({ context: e, event: t, enqueue: n }) => {
|
|
3399
3485
|
let { seedLocalId: r } = t, i = e.publishProcesses.get(r);
|
|
3400
3486
|
if (!i) {
|
|
3401
3487
|
console.warn(`Publish process with seedLocalId "${r}" does not exist.`);
|
|
@@ -3411,35 +3497,35 @@ var so = It(({ sendBack: e, input: { persistedSnapshot: t, seedLocalId: n, trigg
|
|
|
3411
3497
|
publishProcesses: o,
|
|
3412
3498
|
subscriptions: s
|
|
3413
3499
|
});
|
|
3414
|
-
}),
|
|
3500
|
+
}), xo = I(({ context: e, event: t }) => {
|
|
3415
3501
|
let { subscriptions: n } = e, { seedLocalId: r, newSubscription: i } = t;
|
|
3416
3502
|
return i && n.set(r, i), { subscriptions: new Map(n) };
|
|
3417
|
-
}),
|
|
3418
|
-
function
|
|
3503
|
+
}), So = ["signedDataItems", "arweaveUploadData"];
|
|
3504
|
+
function Co(e) {
|
|
3419
3505
|
if (typeof e != "object" || !e) return e;
|
|
3420
3506
|
let t = { ...e };
|
|
3421
|
-
for (let e of
|
|
3507
|
+
for (let e of So) delete t[e];
|
|
3422
3508
|
return t;
|
|
3423
3509
|
}
|
|
3424
|
-
function
|
|
3510
|
+
function wo(e) {
|
|
3425
3511
|
if (typeof e != "object" || !e) return e;
|
|
3426
3512
|
let t = e, n = { ...t };
|
|
3427
|
-
t.context != null && typeof t.context == "object" && (n.context =
|
|
3513
|
+
t.context != null && typeof t.context == "object" && (n.context = Co(t.context));
|
|
3428
3514
|
let r = t.snapshot;
|
|
3429
3515
|
if (typeof r == "object" && r) {
|
|
3430
3516
|
let e = r, t = { ...e };
|
|
3431
|
-
e.context != null && typeof e.context == "object" && (t.context =
|
|
3517
|
+
e.context != null && typeof e.context == "object" && (t.context = Co(e.context)), n.snapshot = t;
|
|
3432
3518
|
}
|
|
3433
3519
|
return n;
|
|
3434
3520
|
}
|
|
3435
|
-
function
|
|
3521
|
+
function To(e) {
|
|
3436
3522
|
try {
|
|
3437
|
-
return
|
|
3523
|
+
return wo(e.getPersistedSnapshot?.() ?? e.getSnapshot());
|
|
3438
3524
|
} catch {
|
|
3439
3525
|
let t = e.getSnapshot(), n = t.context;
|
|
3440
|
-
if (!n?.item) return
|
|
3526
|
+
if (!n?.item) return wo(t);
|
|
3441
3527
|
let r = n.item;
|
|
3442
|
-
return
|
|
3528
|
+
return wo({
|
|
3443
3529
|
...t,
|
|
3444
3530
|
context: {
|
|
3445
3531
|
...n,
|
|
@@ -3452,13 +3538,13 @@ function _o(e) {
|
|
|
3452
3538
|
});
|
|
3453
3539
|
}
|
|
3454
3540
|
}
|
|
3455
|
-
var
|
|
3541
|
+
var Eo = I(({ context: e, event: t, spawn: n }) => {
|
|
3456
3542
|
let { publishProcesses: r } = e, { seedLocalId: i, publishProcess: a, triggerPublishDone: o } = t;
|
|
3457
3543
|
if (!a) return e;
|
|
3458
3544
|
let s = new Map(r);
|
|
3459
3545
|
s.set(i, a);
|
|
3460
|
-
let c =
|
|
3461
|
-
return n(
|
|
3546
|
+
let c = To(a);
|
|
3547
|
+
return n(go, {
|
|
3462
3548
|
id: `savePublish_${i}_${Date.now()}`,
|
|
3463
3549
|
input: {
|
|
3464
3550
|
persistedSnapshot: c,
|
|
@@ -3466,7 +3552,7 @@ var vo = I(({ context: e, event: t, spawn: n }) => {
|
|
|
3466
3552
|
triggerPublishDone: o
|
|
3467
3553
|
}
|
|
3468
3554
|
}), { publishProcesses: s };
|
|
3469
|
-
}),
|
|
3555
|
+
}), Do = I(({ context: e, event: t }) => {
|
|
3470
3556
|
let { publishProcesses: n, subscriptions: r, settledPublishes: i } = e, a = t.seedLocalId, o = r.get(a);
|
|
3471
3557
|
o && o.send({ type: "UNSUBSCRIBE" });
|
|
3472
3558
|
let s = n.get(a), c = new Map(n);
|
|
@@ -3479,17 +3565,17 @@ var vo = I(({ context: e, event: t, spawn: n }) => {
|
|
|
3479
3565
|
subscriptions: l,
|
|
3480
3566
|
settledPublishes: u
|
|
3481
3567
|
};
|
|
3482
|
-
}),
|
|
3568
|
+
}), Oo = I(({ context: e, event: t }) => {
|
|
3483
3569
|
let { subscriptions: n } = e, r = t.seedLocalId, i = new Map(n);
|
|
3484
3570
|
return i.delete(r), { subscriptions: i };
|
|
3485
|
-
}),
|
|
3486
|
-
function
|
|
3571
|
+
}), ko = 6e4, Ao = 2e3;
|
|
3572
|
+
function jo(e, t) {
|
|
3487
3573
|
let n = typeof process < "u" ? process.env[e] : void 0;
|
|
3488
3574
|
if (n == null || n === "") return t;
|
|
3489
3575
|
let r = Number(n);
|
|
3490
3576
|
return Number.isFinite(r) && r >= 0 ? r : t;
|
|
3491
3577
|
}
|
|
3492
|
-
async function
|
|
3578
|
+
async function Mo(e, t) {
|
|
3493
3579
|
let n = Date.now() + e;
|
|
3494
3580
|
for (; Date.now() < n;) {
|
|
3495
3581
|
try {
|
|
@@ -3499,12 +3585,12 @@ async function wo(e, t) {
|
|
|
3499
3585
|
}
|
|
3500
3586
|
return !1;
|
|
3501
3587
|
}
|
|
3502
|
-
function
|
|
3588
|
+
function No(e) {
|
|
3503
3589
|
let t = e.value;
|
|
3504
3590
|
return typeof t == "string" ? t : t && typeof t == "object" ? Object.keys(t)[0] ?? "" : "";
|
|
3505
3591
|
}
|
|
3506
|
-
function
|
|
3507
|
-
let t =
|
|
3592
|
+
function Po(e) {
|
|
3593
|
+
let t = No(e);
|
|
3508
3594
|
if (t === "pollingForConfirmation" && (!e.context?.reimbursementTransactionId || !e.context?.requestResponse)) return !1;
|
|
3509
3595
|
if (t === "uploadingData") {
|
|
3510
3596
|
let t = e.context?.arweaveTransactions, n = e.context?.publishUploads;
|
|
@@ -3512,13 +3598,13 @@ function Eo(e) {
|
|
|
3512
3598
|
}
|
|
3513
3599
|
return !0;
|
|
3514
3600
|
}
|
|
3515
|
-
function
|
|
3601
|
+
function Fo(e) {
|
|
3516
3602
|
return typeof e == "object" && !!e && "xstate$$type" in e && e.xstate$$type === 1 && typeof e.id == "string";
|
|
3517
3603
|
}
|
|
3518
|
-
function
|
|
3604
|
+
function Io(e, t, n) {
|
|
3519
3605
|
e.context = e.context ?? {};
|
|
3520
3606
|
let r = e.context.item;
|
|
3521
|
-
if (
|
|
3607
|
+
if (Fo(r)) {
|
|
3522
3608
|
e.context.item = {
|
|
3523
3609
|
seedLocalId: t,
|
|
3524
3610
|
modelName: e.context.modelName ?? n.modelName ?? "",
|
|
@@ -3533,10 +3619,10 @@ function Oo(e, t, n) {
|
|
|
3533
3619
|
schemaId: r?.schemaId ?? e.context.schemaId ?? n.schemaId ?? void 0
|
|
3534
3620
|
};
|
|
3535
3621
|
}
|
|
3536
|
-
var
|
|
3622
|
+
var Lo = zt(({ sendBack: e, input: { context: t } }) => {
|
|
3537
3623
|
let n = async () => {
|
|
3538
3624
|
let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
|
|
3539
|
-
if (!await
|
|
3625
|
+
if (!await Mo(jo("SEED_PUBLISH_RESTORE_WAIT_MS", ko), jo("SEED_PUBLISH_RESTORE_POLL_MS", Ao))) return {
|
|
3540
3626
|
newPublishProcesses: e,
|
|
3541
3627
|
newSubscriptions: t
|
|
3542
3628
|
};
|
|
@@ -3557,12 +3643,12 @@ var ko = It(({ sendBack: e, input: { context: t } }) => {
|
|
|
3557
3643
|
}
|
|
3558
3644
|
if (r.status === "done") continue;
|
|
3559
3645
|
let i = r.context?.item?.seedLocalId ?? n.seedLocalId;
|
|
3560
|
-
if (!i || !
|
|
3561
|
-
|
|
3562
|
-
let a =
|
|
3646
|
+
if (!i || !Po(r)) continue;
|
|
3647
|
+
Io(r, i, n);
|
|
3648
|
+
let a = Lt(La, {
|
|
3563
3649
|
snapshot: r,
|
|
3564
3650
|
input: void 0
|
|
3565
|
-
}), o =
|
|
3651
|
+
}), o = Lt(Ga, { input: {
|
|
3566
3652
|
publishProcess: a,
|
|
3567
3653
|
seedLocalId: i
|
|
3568
3654
|
} });
|
|
@@ -3591,32 +3677,32 @@ var ko = It(({ sendBack: e, input: { context: t } }) => {
|
|
|
3591
3677
|
subscriptions: n
|
|
3592
3678
|
});
|
|
3593
3679
|
});
|
|
3594
|
-
}),
|
|
3680
|
+
}), Ro = I(({ context: e, event: t }) => ({ pendingCreates: [...e.pendingCreates ?? [], t] })), zo = Rt(({ context: e, enqueue: t }) => {
|
|
3595
3681
|
let n = e.pendingCreates ?? [];
|
|
3596
3682
|
if (n.length !== 0) {
|
|
3597
3683
|
t.assign({ pendingCreates: [] });
|
|
3598
3684
|
for (let e of n) t.raise(e);
|
|
3599
3685
|
}
|
|
3600
|
-
}),
|
|
3686
|
+
}), Bo = R("seedProtocol:PublishManager:index"), Vo = Bt({
|
|
3601
3687
|
types: {
|
|
3602
3688
|
context: {},
|
|
3603
3689
|
input: {},
|
|
3604
3690
|
events: {}
|
|
3605
3691
|
},
|
|
3606
|
-
actors: { restoreFromDb:
|
|
3692
|
+
actors: { restoreFromDb: Lo },
|
|
3607
3693
|
actions: {
|
|
3608
|
-
assignRestoreFromDb:
|
|
3609
|
-
createPublish:
|
|
3610
|
-
queueCreatePublish:
|
|
3611
|
-
drainPendingCreates:
|
|
3612
|
-
addSubscription:
|
|
3613
|
-
requestSavePublish:
|
|
3614
|
-
publishDone:
|
|
3615
|
-
removeSubscription:
|
|
3616
|
-
retryAttestations:
|
|
3617
|
-
stopPublish:
|
|
3618
|
-
stopAll:
|
|
3619
|
-
query:
|
|
3694
|
+
assignRestoreFromDb: Ra,
|
|
3695
|
+
createPublish: Qa,
|
|
3696
|
+
queueCreatePublish: Ro,
|
|
3697
|
+
drainPendingCreates: zo,
|
|
3698
|
+
addSubscription: xo,
|
|
3699
|
+
requestSavePublish: Eo,
|
|
3700
|
+
publishDone: Do,
|
|
3701
|
+
removeSubscription: Oo,
|
|
3702
|
+
retryAttestations: $a,
|
|
3703
|
+
stopPublish: _o,
|
|
3704
|
+
stopAll: yo,
|
|
3705
|
+
query: bo
|
|
3620
3706
|
}
|
|
3621
3707
|
}).createMachine({
|
|
3622
3708
|
id: "publishManager",
|
|
@@ -3660,24 +3746,24 @@ var ko = It(({ sendBack: e, input: { context: t } }) => {
|
|
|
3660
3746
|
}
|
|
3661
3747
|
}
|
|
3662
3748
|
}
|
|
3663
|
-
}), $ =
|
|
3749
|
+
}), $ = Lt(Vo, { input: {
|
|
3664
3750
|
publishProcesses: /* @__PURE__ */ new Map(),
|
|
3665
3751
|
subscriptions: /* @__PURE__ */ new Map(),
|
|
3666
3752
|
pendingCreates: [],
|
|
3667
3753
|
settledPublishes: /* @__PURE__ */ new Map()
|
|
3668
|
-
} }),
|
|
3669
|
-
function
|
|
3670
|
-
if (!
|
|
3754
|
+
} }), Ho = !1;
|
|
3755
|
+
function Uo() {
|
|
3756
|
+
if (!Ho) {
|
|
3671
3757
|
try {
|
|
3672
3758
|
$.start();
|
|
3673
3759
|
} catch (e) {
|
|
3674
3760
|
let t = e instanceof Error ? e.message : String(e);
|
|
3675
3761
|
if (!/already started/i.test(t)) throw e;
|
|
3676
3762
|
}
|
|
3677
|
-
|
|
3763
|
+
Ho = !0;
|
|
3678
3764
|
}
|
|
3679
3765
|
}
|
|
3680
|
-
|
|
3766
|
+
Ba({
|
|
3681
3767
|
savePublish: (e, t, n) => {
|
|
3682
3768
|
$.send({
|
|
3683
3769
|
type: "REQUEST_SAVE_PUBLISH",
|
|
@@ -3699,24 +3785,24 @@ Ma({
|
|
|
3699
3785
|
});
|
|
3700
3786
|
}
|
|
3701
3787
|
});
|
|
3702
|
-
var
|
|
3703
|
-
|
|
3788
|
+
var Wo = $.subscribe((e) => {
|
|
3789
|
+
Bo("PublishManager snapshot:", e);
|
|
3704
3790
|
});
|
|
3705
|
-
typeof document < "u" && (
|
|
3706
|
-
|
|
3791
|
+
typeof document < "u" && (Uo(), window.addEventListener("load", () => {
|
|
3792
|
+
Bo("PublishManager started");
|
|
3707
3793
|
}), window.addEventListener("beforeunload", () => {
|
|
3708
|
-
|
|
3794
|
+
Wo.unsubscribe(), $.stop();
|
|
3709
3795
|
}));
|
|
3710
|
-
var
|
|
3796
|
+
var Go = {
|
|
3711
3797
|
getService: () => $,
|
|
3712
|
-
ready: () => (
|
|
3798
|
+
ready: () => (Uo(), $.getSnapshot().value === "active" ? Promise.resolve() : new Promise((e) => {
|
|
3713
3799
|
let t = $.subscribe((n) => {
|
|
3714
3800
|
n.value === "active" && (t.unsubscribe(), e());
|
|
3715
3801
|
});
|
|
3716
3802
|
$.getSnapshot().value === "active" && (t.unsubscribe(), e());
|
|
3717
3803
|
})),
|
|
3718
3804
|
createPublish: (e, t, n, r) => new Promise((i) => {
|
|
3719
|
-
let a =
|
|
3805
|
+
let a = Ja(i);
|
|
3720
3806
|
$.send({
|
|
3721
3807
|
type: "CREATE_PUBLISH",
|
|
3722
3808
|
item: e,
|
|
@@ -3761,26 +3847,26 @@ var Lo = {
|
|
|
3761
3847
|
};
|
|
3762
3848
|
//#endregion
|
|
3763
3849
|
//#region src/helpers/approvedTargetsForAutomationPublish.ts
|
|
3764
|
-
function
|
|
3765
|
-
let e =
|
|
3850
|
+
function Ko() {
|
|
3851
|
+
let e = T().modularAccountModuleContract?.trim();
|
|
3766
3852
|
if (!e || !/^0x[0-9a-fA-F]{40}$/.test(e)) throw Error("@seedprotocol/publish: session keys require PublishConfig.modularAccountModuleContract (their only approved target is the Seed executor module).");
|
|
3767
3853
|
return [e.toLowerCase()];
|
|
3768
3854
|
}
|
|
3769
3855
|
//#endregion
|
|
3770
3856
|
//#region src/helpers/automationSessionKeyPermissions.ts
|
|
3771
|
-
var
|
|
3772
|
-
function
|
|
3857
|
+
var qo = "publish,revoke";
|
|
3858
|
+
function Jo(e) {
|
|
3773
3859
|
let t = {
|
|
3774
|
-
approvedTargets:
|
|
3860
|
+
approvedTargets: Ko(),
|
|
3775
3861
|
nativeTokenLimitPerTransaction: 0
|
|
3776
3862
|
};
|
|
3777
3863
|
return typeof e?.expiresAt == "number" && e.expiresAt > 0 && (t.expiresAt = Math.trunc(e.expiresAt)), t;
|
|
3778
3864
|
}
|
|
3779
|
-
function
|
|
3865
|
+
function Yo(e, t = qo) {
|
|
3780
3866
|
let n = `${[...e.approvedTargets].map((e) => e.toLowerCase()).sort().join(",")}|${e.nativeTokenLimitPerTransaction}|${e.expiresAt ?? 0}|${t.trim()}`;
|
|
3781
|
-
return
|
|
3867
|
+
return ft(pt(n));
|
|
3782
3868
|
}
|
|
3783
|
-
function
|
|
3869
|
+
function Xo(e) {
|
|
3784
3870
|
let t = {
|
|
3785
3871
|
approvedTargets: e.approvedTargets,
|
|
3786
3872
|
nativeTokenLimitPerTransaction: e.nativeTokenLimitPerTransaction
|
|
@@ -3792,37 +3878,37 @@ function Ho(e) {
|
|
|
3792
3878
|
}
|
|
3793
3879
|
//#endregion
|
|
3794
3880
|
//#region src/services/publishAuthorization/index.ts
|
|
3795
|
-
var
|
|
3796
|
-
function
|
|
3797
|
-
if (
|
|
3798
|
-
if (
|
|
3881
|
+
var Zo = "0x0000000000000000000000000000000000000000", Qo = !0, $o = "0x0000000000000000000000000000000000000000";
|
|
3882
|
+
function es(e) {
|
|
3883
|
+
if (i(e)) return e.txSender;
|
|
3884
|
+
if (_e(e)) return e;
|
|
3799
3885
|
throw Error("@seedprotocol/publish: publish authorization write APIs require a PublishWallet or SeedTxSender");
|
|
3800
3886
|
}
|
|
3801
|
-
async function
|
|
3887
|
+
async function ts(e, t) {
|
|
3802
3888
|
let n = await e.sendTransaction(t);
|
|
3803
3889
|
return C(n.transactionHash);
|
|
3804
3890
|
}
|
|
3805
|
-
function
|
|
3891
|
+
function ns(e, t) {
|
|
3806
3892
|
let n = t.trim();
|
|
3807
3893
|
if (!/^0x[0-9a-fA-F]{40}$/.test(n)) throw Error(`@seedprotocol/publish: ${e} must be a valid address`);
|
|
3808
3894
|
return n;
|
|
3809
3895
|
}
|
|
3810
|
-
function
|
|
3811
|
-
return
|
|
3896
|
+
function rs() {
|
|
3897
|
+
return Pt.getSchemaUID(ht, Zo, Qo);
|
|
3812
3898
|
}
|
|
3813
|
-
async function
|
|
3814
|
-
let t =
|
|
3815
|
-
return await V(n) || (await
|
|
3816
|
-
schema:
|
|
3817
|
-
resolverAddress:
|
|
3818
|
-
revocable:
|
|
3819
|
-
})), await
|
|
3899
|
+
async function is(e) {
|
|
3900
|
+
let t = es(e), n = rs();
|
|
3901
|
+
return await V(n) || (await ts(t, cn({
|
|
3902
|
+
schema: ht,
|
|
3903
|
+
resolverAddress: Zo,
|
|
3904
|
+
revocable: Qo
|
|
3905
|
+
})), await ts(t, un({
|
|
3820
3906
|
schemaUid: n,
|
|
3821
|
-
schemaName:
|
|
3907
|
+
schemaName: _t
|
|
3822
3908
|
}))), n;
|
|
3823
3909
|
}
|
|
3824
|
-
function
|
|
3825
|
-
return new
|
|
3910
|
+
function as(e) {
|
|
3911
|
+
return new Nt(ht).encodeData([
|
|
3826
3912
|
{
|
|
3827
3913
|
name: "identity",
|
|
3828
3914
|
value: e.identity,
|
|
@@ -3855,64 +3941,64 @@ function Zo(e) {
|
|
|
3855
3941
|
},
|
|
3856
3942
|
{
|
|
3857
3943
|
name: "permissionsHash",
|
|
3858
|
-
value:
|
|
3944
|
+
value: Tt(e.permissionsHash),
|
|
3859
3945
|
type: "bytes32"
|
|
3860
3946
|
}
|
|
3861
3947
|
]);
|
|
3862
3948
|
}
|
|
3863
|
-
async function
|
|
3864
|
-
let t =
|
|
3865
|
-
if (
|
|
3866
|
-
let
|
|
3949
|
+
async function os(e) {
|
|
3950
|
+
let t = es(e.wallet), n = e.ensureSchema === !1 ? rs() : await is(e.wallet), r = ns("identity", e.identity), i = ns("sessionKey", e.sessionKey), a = e.app?.trim() ? ns("app", e.app) : $o, o = e.grantedAt ?? Math.floor(Date.now() / 1e3), s = typeof e.expiresAt == "number" && e.expiresAt > 0 ? Math.trunc(e.expiresAt) : 0, c = e.scopes ?? yt, l = Tt(e.permissionsHash ?? Yo(Jo({ expiresAt: s > 0 ? s : void 0 }), c === yt ? "publish,revoke" : c));
|
|
3951
|
+
if (l === It) throw Error("@seedprotocol/publish: attestPublishAuthorization requires a non-zero permissionsHash");
|
|
3952
|
+
let d = typeof e.expirationTime == "number" && e.expirationTime > 0 ? e.expirationTime : s > 0 ? s : o + mt, f = as({
|
|
3867
3953
|
identity: r,
|
|
3868
3954
|
sessionKey: i,
|
|
3869
3955
|
app: a,
|
|
3870
|
-
scopes:
|
|
3871
|
-
grantedAt:
|
|
3872
|
-
expiresAt:
|
|
3873
|
-
permissionsHash:
|
|
3874
|
-
}),
|
|
3956
|
+
scopes: c,
|
|
3957
|
+
grantedAt: o,
|
|
3958
|
+
expiresAt: s,
|
|
3959
|
+
permissionsHash: l
|
|
3960
|
+
}), p = await ts(t, v({
|
|
3875
3961
|
schema: n,
|
|
3876
3962
|
data: {
|
|
3877
3963
|
recipient: i,
|
|
3878
|
-
expirationTime: BigInt(
|
|
3964
|
+
expirationTime: BigInt(d),
|
|
3879
3965
|
revocable: !0,
|
|
3880
|
-
refUID:
|
|
3881
|
-
data:
|
|
3966
|
+
refUID: It,
|
|
3967
|
+
data: f,
|
|
3882
3968
|
value: 0n
|
|
3883
3969
|
}
|
|
3884
3970
|
}));
|
|
3885
|
-
if (!
|
|
3886
|
-
let { easContractAddress:
|
|
3887
|
-
if (!
|
|
3971
|
+
if (!p) throw Error("@seedprotocol/publish: attestPublishAuthorization failed — no receipt");
|
|
3972
|
+
let { easContractAddress: m } = T(), h = u(p, m);
|
|
3973
|
+
if (!h || !wt(h)) throw Error("@seedprotocol/publish: attestPublishAuthorization failed — could not parse attestation UID");
|
|
3888
3974
|
return {
|
|
3889
|
-
uid:
|
|
3975
|
+
uid: h,
|
|
3890
3976
|
schemaUid: n,
|
|
3891
|
-
permissionsHash:
|
|
3892
|
-
grantedAt:
|
|
3893
|
-
expiresAt:
|
|
3894
|
-
expirationTime:
|
|
3977
|
+
permissionsHash: l,
|
|
3978
|
+
grantedAt: o,
|
|
3979
|
+
expiresAt: s,
|
|
3980
|
+
expirationTime: d
|
|
3895
3981
|
};
|
|
3896
3982
|
}
|
|
3897
|
-
async function
|
|
3898
|
-
let t =
|
|
3899
|
-
if (!
|
|
3900
|
-
if (!await
|
|
3901
|
-
schema:
|
|
3902
|
-
data: [{ uid:
|
|
3983
|
+
async function ss(e) {
|
|
3984
|
+
let t = es(e.wallet), r = e.schemaUid ?? rs(), i = Tt(e.uid);
|
|
3985
|
+
if (!wt(i)) throw Error("@seedprotocol/publish: revokePublishAuthorization requires a valid attestation uid");
|
|
3986
|
+
if (!await ts(t, n([{
|
|
3987
|
+
schema: r,
|
|
3988
|
+
data: [{ uid: i }]
|
|
3903
3989
|
}]))) throw Error("@seedprotocol/publish: revokePublishAuthorization failed — no receipt");
|
|
3904
3990
|
}
|
|
3905
|
-
async function
|
|
3906
|
-
let t = (await
|
|
3991
|
+
async function cs(e) {
|
|
3992
|
+
let t = (await Ct({
|
|
3907
3993
|
identities: e.identities,
|
|
3908
3994
|
excludeRevoked: !1
|
|
3909
3995
|
})).find((t) => t.id?.toLowerCase() === e.uid.toLowerCase());
|
|
3910
3996
|
if (!t) return null;
|
|
3911
|
-
let n =
|
|
3997
|
+
let n = St(t.decodedDataJson ?? "[]"), r = typeof t.expirationTime == "number" ? t.expirationTime : typeof t.expirationTime == "string" ? Number(t.expirationTime) : null;
|
|
3912
3998
|
return {
|
|
3913
3999
|
uid: t.id,
|
|
3914
4000
|
decoded: n,
|
|
3915
|
-
assess:
|
|
4001
|
+
assess: xt({
|
|
3916
4002
|
decoded: n,
|
|
3917
4003
|
expirationTime: r
|
|
3918
4004
|
}),
|
|
@@ -3920,6 +4006,6 @@ async function es(e) {
|
|
|
3920
4006
|
};
|
|
3921
4007
|
}
|
|
3922
4008
|
//#endregion
|
|
3923
|
-
export {
|
|
4009
|
+
export { B as $, Qr as A, zr as B, mi as C, Xr as D, Zr as E, Wr as F, jr as G, Ur as H, si as I, lr as J, Nr as K, Gr as L, ii as M, oi as N, Yr as O, Rr as P, cn as Q, Kr as R, vi as S, Jr as T, Hr as U, Pr as V, Vr as W, un as X, xn as Y, V as Z, ca as _, os as a, ji as b, rs as c, Jo as d, nn as et, Yo as f, La as g, Go as h, cs as i, ei as j, $r as k, ss as l, Ko as m, vt as n, Yt as nt, as as o, Xo as p, qn as q, bt as r, is as s, gt as t, Jt as tt, qo as u, la as v, gi as w, Ai as x, Ei as y, qr as z };
|
|
3924
4010
|
|
|
3925
|
-
//# sourceMappingURL=publishAuthorization-
|
|
4011
|
+
//# sourceMappingURL=publishAuthorization-DgDI4zor.js.map
|