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