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