@akita-protocol/algomd-core 1.0.0-alpha.0 → 1.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  refFromTag,
10
10
  serializeRef,
11
11
  sizeFromProps
12
- } from "./chunk-NRZTLFVI.js";
12
+ } from "./chunk-6KYOB5JM.js";
13
13
 
14
14
  // src/types.ts
15
15
  var refKey = (ref) => `${ref.kind}:${ref.id}`;
@@ -7533,6 +7533,1428 @@ var CONTRACT_SCHEMAS = {
7533
7533
  }
7534
7534
  ]
7535
7535
  }
7536
+ },
7537
+ "guild": {
7538
+ "name": "Guild",
7539
+ "global": {
7540
+ "state": {
7541
+ "key": "state",
7542
+ "type": "uint8"
7543
+ },
7544
+ "consensus": {
7545
+ "key": "consensus",
7546
+ "type": "AVMUint64"
7547
+ },
7548
+ "version": {
7549
+ "key": "version",
7550
+ "type": "AVMString"
7551
+ },
7552
+ "creator": {
7553
+ "key": "creator",
7554
+ "type": "address"
7555
+ },
7556
+ "wallet": {
7557
+ "key": "wallet",
7558
+ "type": "AVMUint64"
7559
+ },
7560
+ "walletFactory": {
7561
+ "key": "wallet_factory",
7562
+ "type": "AVMUint64"
7563
+ },
7564
+ "proposalActionLimit": {
7565
+ "key": "proposal_action_limit",
7566
+ "type": "AVMUint64"
7567
+ },
7568
+ "proposalID": {
7569
+ "key": "proposal_id",
7570
+ "type": "AVMUint64"
7571
+ },
7572
+ "pluginSetLocked": {
7573
+ "key": "plugins_locked",
7574
+ "type": "AVMUint64"
7575
+ },
7576
+ "reserved": {
7577
+ "key": "reserved",
7578
+ "type": "AVMUint64"
7579
+ },
7580
+ "upgradeAppProposalSettings": {
7581
+ "key": "upgrade_app_ps",
7582
+ "type": "GuildProposalSettings"
7583
+ },
7584
+ "addPluginProposalSettings": {
7585
+ "key": "add_plugin_ps",
7586
+ "type": "GuildProposalSettings"
7587
+ },
7588
+ "removeExecutionProposalSettings": {
7589
+ "key": "remove_execution_ps",
7590
+ "type": "GuildProposalSettings"
7591
+ },
7592
+ "removePluginProposalSettings": {
7593
+ "key": "remove_plugin_ps",
7594
+ "type": "GuildProposalSettings"
7595
+ },
7596
+ "addAllowancesProposalSettings": {
7597
+ "key": "add_allowances_ps",
7598
+ "type": "GuildProposalSettings"
7599
+ },
7600
+ "removeAllowancesProposalSettings": {
7601
+ "key": "remove_allowances_ps",
7602
+ "type": "GuildProposalSettings"
7603
+ },
7604
+ "newEscrowProposalSettings": {
7605
+ "key": "new_escrow_ps",
7606
+ "type": "GuildProposalSettings"
7607
+ },
7608
+ "toggleEscrowLockProposalSettings": {
7609
+ "key": "toggle_escrow_ps",
7610
+ "type": "GuildProposalSettings"
7611
+ },
7612
+ "updateGuildProposalSettings": {
7613
+ "key": "update_guild_ps",
7614
+ "type": "GuildProposalSettings"
7615
+ }
7616
+ },
7617
+ "boxes": {
7618
+ "plugins": {
7619
+ "prefix": "g",
7620
+ "keyType": "GuildPluginKey",
7621
+ "valueType": "GuildProposalSettings"
7622
+ },
7623
+ "proposals": {
7624
+ "prefix": "l",
7625
+ "keyType": "uint64",
7626
+ "valueType": "GuildProposal"
7627
+ },
7628
+ "executions": {
7629
+ "prefix": "x",
7630
+ "keyType": "AVMBytes",
7631
+ "valueType": "GuildExecutionMetadata"
7632
+ },
7633
+ "consensusActions": {
7634
+ "prefix": "c",
7635
+ "keyType": "uint64",
7636
+ "valueType": "GuildProposalSettings"
7637
+ }
7638
+ },
7639
+ "methods": {
7640
+ "create": {
7641
+ "signature": "create(string,address,uint64,uint64,(uint64,((uint64,uint64,uint64,uint64,uint64,uint64),(uint64,uint64,uint64,uint64,uint64,uint64),(uint64,uint64,uint64,uint64,uint64,uint64),(uint64,uint64,uint64,uint64,uint64,uint64),(uint64,uint64,uint64,uint64,uint64,uint64),(uint64,uint64,uint64,uint64,uint64,uint64),(uint64,uint64,uint64,uint64,uint64,uint64),(uint64,uint64,uint64,uint64,uint64,uint64),(uint64,uint64,uint64,uint64,uint64,uint64))))void",
7642
+ "selector": "06cb2e54",
7643
+ "args": [
7644
+ {
7645
+ "name": "version",
7646
+ "type": "string"
7647
+ },
7648
+ {
7649
+ "name": "creator",
7650
+ "type": "address"
7651
+ },
7652
+ {
7653
+ "name": "walletFactory",
7654
+ "type": "uint64"
7655
+ },
7656
+ {
7657
+ "name": "consensus",
7658
+ "type": "uint64"
7659
+ },
7660
+ {
7661
+ "name": "config",
7662
+ "type": "(uint64,((uint64,uint64,uint64,uint64,uint64,uint64),(uint64,uint64,uint64,uint64,uint64,uint64),(uint64,uint64,uint64,uint64,uint64,uint64),(uint64,uint64,uint64,uint64,uint64,uint64),(uint64,uint64,uint64,uint64,uint64,uint64),(uint64,uint64,uint64,uint64,uint64,uint64),(uint64,uint64,uint64,uint64,uint64,uint64),(uint64,uint64,uint64,uint64,uint64,uint64),(uint64,uint64,uint64,uint64,uint64,uint64)))",
7663
+ "struct": "GuildBaseConfig"
7664
+ }
7665
+ ],
7666
+ "returns": "void",
7667
+ "actions": [
7668
+ "create:NoOp"
7669
+ ]
7670
+ },
7671
+ "consensusConfigurationMbr": {
7672
+ "signature": "consensusConfigurationMbr(byte[])uint64",
7673
+ "selector": "97881e21",
7674
+ "args": [
7675
+ {
7676
+ "name": "config",
7677
+ "type": "byte[]"
7678
+ }
7679
+ ],
7680
+ "returns": "uint64",
7681
+ "actions": [
7682
+ "NoOp"
7683
+ ]
7684
+ },
7685
+ "configureConsensus": {
7686
+ "signature": "configureConsensus(pay,byte[])void",
7687
+ "selector": "5081f793",
7688
+ "args": [
7689
+ {
7690
+ "name": "mbrPayment",
7691
+ "type": "pay"
7692
+ },
7693
+ {
7694
+ "name": "config",
7695
+ "type": "byte[]"
7696
+ }
7697
+ ],
7698
+ "returns": "void",
7699
+ "actions": [
7700
+ "NoOp"
7701
+ ]
7702
+ },
7703
+ "setup": {
7704
+ "signature": "setup(string,byte[32])uint64",
7705
+ "selector": "f8e140aa",
7706
+ "args": [
7707
+ {
7708
+ "name": "nickname",
7709
+ "type": "string"
7710
+ },
7711
+ {
7712
+ "name": "salt",
7713
+ "type": "byte[32]"
7714
+ }
7715
+ ],
7716
+ "returns": "uint64",
7717
+ "actions": [
7718
+ "NoOp"
7719
+ ]
7720
+ },
7721
+ "setProposalSettings": {
7722
+ "signature": "setProposalSettings(uint8,(uint64,uint64,uint64,uint64,uint64,uint64))void",
7723
+ "selector": "ce73147b",
7724
+ "args": [
7725
+ {
7726
+ "name": "actionType",
7727
+ "type": "uint8"
7728
+ },
7729
+ {
7730
+ "name": "settings",
7731
+ "type": "(uint64,uint64,uint64,uint64,uint64,uint64)",
7732
+ "struct": "GuildProposalSettings"
7733
+ }
7734
+ ],
7735
+ "returns": "void",
7736
+ "actions": [
7737
+ "NoOp"
7738
+ ]
7739
+ },
7740
+ "setConsensusActionSettings": {
7741
+ "signature": "setConsensusActionSettings(uint64,(uint64,uint64,uint64,uint64,uint64,uint64))void",
7742
+ "selector": "236cb1bb",
7743
+ "args": [
7744
+ {
7745
+ "name": "code",
7746
+ "type": "uint64"
7747
+ },
7748
+ {
7749
+ "name": "settings",
7750
+ "type": "(uint64,uint64,uint64,uint64,uint64,uint64)",
7751
+ "struct": "GuildProposalSettings"
7752
+ }
7753
+ ],
7754
+ "returns": "void",
7755
+ "actions": [
7756
+ "NoOp"
7757
+ ]
7758
+ },
7759
+ "setProposalActionLimit": {
7760
+ "signature": "setProposalActionLimit(uint64)void",
7761
+ "selector": "78b643e8",
7762
+ "args": [
7763
+ {
7764
+ "name": "limit",
7765
+ "type": "uint64"
7766
+ }
7767
+ ],
7768
+ "returns": "void",
7769
+ "actions": [
7770
+ "NoOp"
7771
+ ]
7772
+ },
7773
+ "lockPluginSet": {
7774
+ "signature": "lockPluginSet()void",
7775
+ "selector": "40988cb9",
7776
+ "args": [],
7777
+ "returns": "void",
7778
+ "actions": [
7779
+ "NoOp"
7780
+ ]
7781
+ },
7782
+ "partiallyInitialize": {
7783
+ "signature": "partiallyInitialize()void",
7784
+ "selector": "53c47566",
7785
+ "args": [],
7786
+ "returns": "void",
7787
+ "actions": [
7788
+ "NoOp"
7789
+ ]
7790
+ },
7791
+ "initialize": {
7792
+ "signature": "initialize()void",
7793
+ "selector": "fd2c93cd",
7794
+ "args": [],
7795
+ "returns": "void",
7796
+ "actions": [
7797
+ "NoOp"
7798
+ ]
7799
+ },
7800
+ "newProposal": {
7801
+ "signature": "newProposal(pay,byte[36],(uint8,byte[])[],byte[])uint64",
7802
+ "selector": "3495781a",
7803
+ "args": [
7804
+ {
7805
+ "name": "payment",
7806
+ "type": "pay"
7807
+ },
7808
+ {
7809
+ "name": "cid",
7810
+ "type": "byte[36]"
7811
+ },
7812
+ {
7813
+ "name": "actions",
7814
+ "type": "(uint8,byte[])[]"
7815
+ },
7816
+ {
7817
+ "name": "evidence",
7818
+ "type": "byte[]"
7819
+ }
7820
+ ],
7821
+ "returns": "uint64",
7822
+ "actions": [
7823
+ "NoOp"
7824
+ ]
7825
+ },
7826
+ "editProposal": {
7827
+ "signature": "editProposal(uint64,byte[36],(uint8,byte[])[],byte[])void",
7828
+ "selector": "d046fb71",
7829
+ "args": [
7830
+ {
7831
+ "name": "id",
7832
+ "type": "uint64"
7833
+ },
7834
+ {
7835
+ "name": "cid",
7836
+ "type": "byte[36]"
7837
+ },
7838
+ {
7839
+ "name": "actions",
7840
+ "type": "(uint8,byte[])[]"
7841
+ },
7842
+ {
7843
+ "name": "evidence",
7844
+ "type": "byte[]"
7845
+ }
7846
+ ],
7847
+ "returns": "void",
7848
+ "actions": [
7849
+ "NoOp"
7850
+ ]
7851
+ },
7852
+ "editProposalWithPayment": {
7853
+ "signature": "editProposalWithPayment(pay,uint64,byte[36],(uint8,byte[])[],byte[])void",
7854
+ "selector": "880950f9",
7855
+ "args": [
7856
+ {
7857
+ "name": "payment",
7858
+ "type": "pay"
7859
+ },
7860
+ {
7861
+ "name": "id",
7862
+ "type": "uint64"
7863
+ },
7864
+ {
7865
+ "name": "cid",
7866
+ "type": "byte[36]"
7867
+ },
7868
+ {
7869
+ "name": "actions",
7870
+ "type": "(uint8,byte[])[]"
7871
+ },
7872
+ {
7873
+ "name": "evidence",
7874
+ "type": "byte[]"
7875
+ }
7876
+ ],
7877
+ "returns": "void",
7878
+ "actions": [
7879
+ "NoOp"
7880
+ ]
7881
+ },
7882
+ "deleteProposal": {
7883
+ "signature": "deleteProposal(uint64)void",
7884
+ "selector": "28f80154",
7885
+ "args": [
7886
+ {
7887
+ "name": "proposalID",
7888
+ "type": "uint64"
7889
+ }
7890
+ ],
7891
+ "returns": "void",
7892
+ "actions": [
7893
+ "NoOp"
7894
+ ]
7895
+ },
7896
+ "submitProposal": {
7897
+ "signature": "submitProposal(uint64,byte[])void",
7898
+ "selector": "a9e1f57b",
7899
+ "args": [
7900
+ {
7901
+ "name": "proposalID",
7902
+ "type": "uint64"
7903
+ },
7904
+ {
7905
+ "name": "evidence",
7906
+ "type": "byte[]"
7907
+ }
7908
+ ],
7909
+ "returns": "void",
7910
+ "actions": [
7911
+ "NoOp"
7912
+ ]
7913
+ },
7914
+ "voteProposal": {
7915
+ "signature": "voteProposal(pay,uint64,uint8,byte[])void",
7916
+ "selector": "3769989f",
7917
+ "args": [
7918
+ {
7919
+ "name": "mbrPayment",
7920
+ "type": "pay"
7921
+ },
7922
+ {
7923
+ "name": "proposalID",
7924
+ "type": "uint64"
7925
+ },
7926
+ {
7927
+ "name": "vote",
7928
+ "type": "uint8"
7929
+ },
7930
+ {
7931
+ "name": "evidence",
7932
+ "type": "byte[]"
7933
+ }
7934
+ ],
7935
+ "returns": "void",
7936
+ "actions": [
7937
+ "NoOp"
7938
+ ]
7939
+ },
7940
+ "finalizeProposal": {
7941
+ "signature": "finalizeProposal(uint64)void",
7942
+ "selector": "62ce9b5b",
7943
+ "args": [
7944
+ {
7945
+ "name": "proposalID",
7946
+ "type": "uint64"
7947
+ }
7948
+ ],
7949
+ "returns": "void",
7950
+ "actions": [
7951
+ "NoOp"
7952
+ ]
7953
+ },
7954
+ "cleanupProposalConsensus": {
7955
+ "signature": "cleanupProposalConsensus(uint64,address[])uint64",
7956
+ "selector": "b57a1ecd",
7957
+ "args": [
7958
+ {
7959
+ "name": "proposalID",
7960
+ "type": "uint64"
7961
+ },
7962
+ {
7963
+ "name": "voters",
7964
+ "type": "address[]"
7965
+ }
7966
+ ],
7967
+ "returns": "uint64",
7968
+ "actions": [
7969
+ "NoOp"
7970
+ ]
7971
+ },
7972
+ "cancelProposal": {
7973
+ "signature": "cancelProposal(uint64)void",
7974
+ "selector": "bfb5248f",
7975
+ "args": [
7976
+ {
7977
+ "name": "proposalID",
7978
+ "type": "uint64"
7979
+ }
7980
+ ],
7981
+ "returns": "void",
7982
+ "actions": [
7983
+ "NoOp"
7984
+ ]
7985
+ },
7986
+ "executeProposal": {
7987
+ "signature": "executeProposal(uint64)void",
7988
+ "selector": "f1ff28aa",
7989
+ "args": [
7990
+ {
7991
+ "name": "proposalID",
7992
+ "type": "uint64"
7993
+ }
7994
+ ],
7995
+ "returns": "void",
7996
+ "actions": [
7997
+ "NoOp"
7998
+ ]
7999
+ },
8000
+ "update": {
8001
+ "signature": "update(string)void",
8002
+ "selector": "ea9180dd",
8003
+ "args": [
8004
+ {
8005
+ "name": "newVersion",
8006
+ "type": "string"
8007
+ }
8008
+ ],
8009
+ "returns": "void",
8010
+ "actions": [
8011
+ "UpdateApplication"
8012
+ ]
8013
+ },
8014
+ "sweep": {
8015
+ "signature": "sweep()uint64",
8016
+ "selector": "bc0d58a7",
8017
+ "args": [],
8018
+ "returns": "uint64",
8019
+ "actions": [
8020
+ "NoOp"
8021
+ ]
8022
+ },
8023
+ "setupCost": {
8024
+ "signature": "setupCost()uint64",
8025
+ "selector": "9699d108",
8026
+ "args": [],
8027
+ "returns": "uint64",
8028
+ "actions": [
8029
+ "NoOp"
8030
+ ]
8031
+ },
8032
+ "proposalCost": {
8033
+ "signature": "proposalCost((uint8,byte[])[])(uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64)",
8034
+ "selector": "8feadadb",
8035
+ "args": [
8036
+ {
8037
+ "name": "actions",
8038
+ "type": "(uint8,byte[])[]"
8039
+ }
8040
+ ],
8041
+ "returns": "(uint64,uint64,uint64,uint64,uint64,uint64,uint64,uint64)",
8042
+ "actions": [
8043
+ "NoOp"
8044
+ ]
8045
+ },
8046
+ "getProposal": {
8047
+ "signature": "getProposal(uint64)(uint8,byte[36],address,uint64,uint64,uint64,(uint8,byte[])[])",
8048
+ "selector": "fe0227c9",
8049
+ "args": [
8050
+ {
8051
+ "name": "proposalID",
8052
+ "type": "uint64"
8053
+ }
8054
+ ],
8055
+ "returns": "(uint8,byte[36],address,uint64,uint64,uint64,(uint8,byte[])[])",
8056
+ "actions": [
8057
+ "NoOp"
8058
+ ]
8059
+ },
8060
+ "getBallot": {
8061
+ "signature": "getBallot(uint64)(bool,bool,uint64,uint64,uint64,(uint64,uint64,uint64),(uint64,uint64,uint64))",
8062
+ "selector": "92bb769e",
8063
+ "args": [
8064
+ {
8065
+ "name": "proposalID",
8066
+ "type": "uint64"
8067
+ }
8068
+ ],
8069
+ "returns": "(bool,bool,uint64,uint64,uint64,(uint64,uint64,uint64),(uint64,uint64,uint64))",
8070
+ "actions": [
8071
+ "NoOp"
8072
+ ]
8073
+ },
8074
+ "mustGetExecution": {
8075
+ "signature": "mustGetExecution(byte[32])(uint64,uint64)",
8076
+ "selector": "dbbec6d2",
8077
+ "args": [
8078
+ {
8079
+ "name": "lease",
8080
+ "type": "byte[32]"
8081
+ }
8082
+ ],
8083
+ "returns": "(uint64,uint64)",
8084
+ "actions": [
8085
+ "NoOp"
8086
+ ]
8087
+ },
8088
+ "getConsensusActionSettings": {
8089
+ "signature": "getConsensusActionSettings(uint64)(uint64,uint64,uint64,uint64,uint64,uint64)",
8090
+ "selector": "957c752e",
8091
+ "args": [
8092
+ {
8093
+ "name": "code",
8094
+ "type": "uint64"
8095
+ }
8096
+ ],
8097
+ "returns": "(uint64,uint64,uint64,uint64,uint64,uint64)",
8098
+ "actions": [
8099
+ "NoOp"
8100
+ ]
8101
+ },
8102
+ "voteCost": {
8103
+ "signature": "voteCost(uint64,address)uint64",
8104
+ "selector": "8b5f86e0",
8105
+ "args": [
8106
+ {
8107
+ "name": "proposalID",
8108
+ "type": "uint64"
8109
+ },
8110
+ {
8111
+ "name": "voter",
8112
+ "type": "address"
8113
+ }
8114
+ ],
8115
+ "returns": "uint64",
8116
+ "actions": [
8117
+ "NoOp"
8118
+ ]
8119
+ },
8120
+ "voteMbr": {
8121
+ "signature": "voteMbr()uint64",
8122
+ "selector": "6f9378e3",
8123
+ "args": [],
8124
+ "returns": "uint64",
8125
+ "actions": [
8126
+ "NoOp"
8127
+ ]
8128
+ },
8129
+ "sweepable": {
8130
+ "signature": "sweepable()uint64",
8131
+ "selector": "f1c08e6a",
8132
+ "args": [],
8133
+ "returns": "uint64",
8134
+ "actions": [
8135
+ "NoOp"
8136
+ ]
8137
+ },
8138
+ "canChangePluginSet": {
8139
+ "signature": "canChangePluginSet()bool",
8140
+ "selector": "27adf91f",
8141
+ "args": [],
8142
+ "returns": "bool",
8143
+ "actions": [
8144
+ "NoOp"
8145
+ ]
8146
+ },
8147
+ "opUp": {
8148
+ "signature": "opUp()void",
8149
+ "selector": "854dede0",
8150
+ "args": [],
8151
+ "returns": "void",
8152
+ "actions": [
8153
+ "NoOp"
8154
+ ]
8155
+ }
8156
+ },
8157
+ "events": {},
8158
+ "structs": {
8159
+ "GuildBaseConfig": [
8160
+ {
8161
+ "name": "proposalActionLimit",
8162
+ "type": "uint64"
8163
+ },
8164
+ {
8165
+ "name": "proposalSettings",
8166
+ "type": "GuildProposalSettingsConfig"
8167
+ }
8168
+ ],
8169
+ "GuildConsensusBallot": [
8170
+ {
8171
+ "name": "resolved",
8172
+ "type": "bool"
8173
+ },
8174
+ {
8175
+ "name": "approved",
8176
+ "type": "bool"
8177
+ },
8178
+ {
8179
+ "name": "votingEnd",
8180
+ "type": "uint64"
8181
+ },
8182
+ {
8183
+ "name": "eligiblePower",
8184
+ "type": "uint64"
8185
+ },
8186
+ {
8187
+ "name": "voteCount",
8188
+ "type": "uint64"
8189
+ },
8190
+ {
8191
+ "name": "requirements",
8192
+ "type": "GuildConsensusRequirements"
8193
+ },
8194
+ {
8195
+ "name": "votes",
8196
+ "type": "GuildVoteTotals"
8197
+ }
8198
+ ],
8199
+ "GuildConsensusRequirements": [
8200
+ {
8201
+ "name": "participation",
8202
+ "type": "uint64"
8203
+ },
8204
+ {
8205
+ "name": "approval",
8206
+ "type": "uint64"
8207
+ },
8208
+ {
8209
+ "name": "minimumApprovals",
8210
+ "type": "uint64"
8211
+ }
8212
+ ],
8213
+ "GuildExecutionMetadata": [
8214
+ {
8215
+ "name": "proposalID",
8216
+ "type": "uint64"
8217
+ },
8218
+ {
8219
+ "name": "index",
8220
+ "type": "uint64"
8221
+ }
8222
+ ],
8223
+ "GuildPluginKey": [
8224
+ {
8225
+ "name": "plugin",
8226
+ "type": "uint64"
8227
+ },
8228
+ {
8229
+ "name": "escrow",
8230
+ "type": "string"
8231
+ }
8232
+ ],
8233
+ "GuildProposal": [
8234
+ {
8235
+ "name": "status",
8236
+ "type": "uint8"
8237
+ },
8238
+ {
8239
+ "name": "cid",
8240
+ "type": "byte[36]"
8241
+ },
8242
+ {
8243
+ "name": "creator",
8244
+ "type": "address"
8245
+ },
8246
+ {
8247
+ "name": "votingTs",
8248
+ "type": "uint64"
8249
+ },
8250
+ {
8251
+ "name": "created",
8252
+ "type": "uint64"
8253
+ },
8254
+ {
8255
+ "name": "feesPaid",
8256
+ "type": "uint64"
8257
+ },
8258
+ {
8259
+ "name": "actions",
8260
+ "type": "(uint8,byte[])[]"
8261
+ }
8262
+ ],
8263
+ "GuildProposalCostInfo": [
8264
+ {
8265
+ "name": "total",
8266
+ "type": "uint64"
8267
+ },
8268
+ {
8269
+ "name": "mbr",
8270
+ "type": "uint64"
8271
+ },
8272
+ {
8273
+ "name": "fee",
8274
+ "type": "uint64"
8275
+ },
8276
+ {
8277
+ "name": "power",
8278
+ "type": "uint64"
8279
+ },
8280
+ {
8281
+ "name": "duration",
8282
+ "type": "uint64"
8283
+ },
8284
+ {
8285
+ "name": "participation",
8286
+ "type": "uint64"
8287
+ },
8288
+ {
8289
+ "name": "approval",
8290
+ "type": "uint64"
8291
+ },
8292
+ {
8293
+ "name": "minimumApprovals",
8294
+ "type": "uint64"
8295
+ }
8296
+ ],
8297
+ "GuildProposalSettings": [
8298
+ {
8299
+ "name": "fee",
8300
+ "type": "uint64"
8301
+ },
8302
+ {
8303
+ "name": "power",
8304
+ "type": "uint64"
8305
+ },
8306
+ {
8307
+ "name": "duration",
8308
+ "type": "uint64"
8309
+ },
8310
+ {
8311
+ "name": "participation",
8312
+ "type": "uint64"
8313
+ },
8314
+ {
8315
+ "name": "approval",
8316
+ "type": "uint64"
8317
+ },
8318
+ {
8319
+ "name": "minimumApprovals",
8320
+ "type": "uint64"
8321
+ }
8322
+ ],
8323
+ "GuildProposalSettingsConfig": [
8324
+ {
8325
+ "name": "upgradeApp",
8326
+ "type": "GuildProposalSettings"
8327
+ },
8328
+ {
8329
+ "name": "addPlugin",
8330
+ "type": "GuildProposalSettings"
8331
+ },
8332
+ {
8333
+ "name": "removeExecution",
8334
+ "type": "GuildProposalSettings"
8335
+ },
8336
+ {
8337
+ "name": "removePlugin",
8338
+ "type": "GuildProposalSettings"
8339
+ },
8340
+ {
8341
+ "name": "addAllowances",
8342
+ "type": "GuildProposalSettings"
8343
+ },
8344
+ {
8345
+ "name": "removeAllowances",
8346
+ "type": "GuildProposalSettings"
8347
+ },
8348
+ {
8349
+ "name": "newEscrow",
8350
+ "type": "GuildProposalSettings"
8351
+ },
8352
+ {
8353
+ "name": "toggleEscrowLock",
8354
+ "type": "GuildProposalSettings"
8355
+ },
8356
+ {
8357
+ "name": "updateGuild",
8358
+ "type": "GuildProposalSettings"
8359
+ }
8360
+ ],
8361
+ "GuildVoteTotals": [
8362
+ {
8363
+ "name": "approvals",
8364
+ "type": "uint64"
8365
+ },
8366
+ {
8367
+ "name": "rejections",
8368
+ "type": "uint64"
8369
+ },
8370
+ {
8371
+ "name": "abstains",
8372
+ "type": "uint64"
8373
+ }
8374
+ ]
8375
+ }
8376
+ },
8377
+ "guildConsensus": {
8378
+ "name": "FixedSignerGuildConsensus",
8379
+ "global": {
8380
+ "threshold": {
8381
+ "key": "signer_threshold",
8382
+ "type": "AVMUint64"
8383
+ },
8384
+ "memberCount": {
8385
+ "key": "member_count",
8386
+ "type": "AVMUint64"
8387
+ },
8388
+ "eligiblePower": {
8389
+ "key": "member_power",
8390
+ "type": "AVMUint64"
8391
+ },
8392
+ "membershipLocked": {
8393
+ "key": "members_locked",
8394
+ "type": "AVMUint64"
8395
+ },
8396
+ "weightMode": {
8397
+ "key": "weight_mode",
8398
+ "type": "uint8"
8399
+ },
8400
+ "membershipEpoch": {
8401
+ "key": "membership_epoch",
8402
+ "type": "AVMUint64"
8403
+ },
8404
+ "maximumMemberWeight": {
8405
+ "key": "maximum_member_weight",
8406
+ "type": "AVMUint64"
8407
+ },
8408
+ "guild": {
8409
+ "key": "guild",
8410
+ "type": "AVMUint64"
8411
+ },
8412
+ "activeBallots": {
8413
+ "key": "active_ballots",
8414
+ "type": "AVMUint64"
8415
+ },
8416
+ "activated": {
8417
+ "key": "activated",
8418
+ "type": "AVMUint64"
8419
+ }
8420
+ },
8421
+ "boxes": {
8422
+ "members": {
8423
+ "prefix": "m",
8424
+ "keyType": "address",
8425
+ "valueType": "Object75E64AB9"
8426
+ },
8427
+ "memberHistory": {
8428
+ "prefix": "h",
8429
+ "keyType": "ObjectA760343E",
8430
+ "valueType": "ObjectA68503ED"
8431
+ },
8432
+ "memberSnapshots": {
8433
+ "prefix": "s",
8434
+ "keyType": "uint64",
8435
+ "valueType": "ObjectEEB10897"
8436
+ },
8437
+ "ballots": {
8438
+ "prefix": "b",
8439
+ "keyType": "uint64",
8440
+ "valueType": "GuildConsensusBallot"
8441
+ },
8442
+ "votes": {
8443
+ "prefix": "v",
8444
+ "keyType": "GuildVoteKey",
8445
+ "valueType": "GuildVote"
8446
+ }
8447
+ },
8448
+ "methods": {
8449
+ "memberAdditionMbr": {
8450
+ "signature": "memberAdditionMbr(uint64)uint64",
8451
+ "selector": "aa927d7b",
8452
+ "args": [
8453
+ {
8454
+ "name": "count",
8455
+ "type": "uint64"
8456
+ }
8457
+ ],
8458
+ "returns": "uint64",
8459
+ "actions": [
8460
+ "NoOp"
8461
+ ]
8462
+ },
8463
+ "historyMbr": {
8464
+ "signature": "historyMbr()uint64",
8465
+ "selector": "db28eb21",
8466
+ "args": [],
8467
+ "returns": "uint64",
8468
+ "actions": [
8469
+ "NoOp"
8470
+ ]
8471
+ },
8472
+ "validateSettings": {
8473
+ "signature": "validateSettings((uint64,uint64,uint64,uint64,uint64,uint64))void",
8474
+ "selector": "9140c638",
8475
+ "args": [
8476
+ {
8477
+ "name": "settings",
8478
+ "type": "(uint64,uint64,uint64,uint64,uint64,uint64)",
8479
+ "struct": "GuildProposalSettings"
8480
+ }
8481
+ ],
8482
+ "returns": "void",
8483
+ "actions": [
8484
+ "NoOp"
8485
+ ]
8486
+ },
8487
+ "ballotMbr": {
8488
+ "signature": "ballotMbr()uint64",
8489
+ "selector": "d3d29643",
8490
+ "args": [],
8491
+ "returns": "uint64",
8492
+ "actions": [
8493
+ "NoOp"
8494
+ ]
8495
+ },
8496
+ "memberPowerAt": {
8497
+ "signature": "memberPowerAt(address,uint64,byte[])uint64",
8498
+ "selector": "f12a468e",
8499
+ "args": [
8500
+ {
8501
+ "name": "account",
8502
+ "type": "address"
8503
+ },
8504
+ {
8505
+ "name": "proposalID",
8506
+ "type": "uint64"
8507
+ },
8508
+ {
8509
+ "name": "evidence",
8510
+ "type": "byte[]"
8511
+ }
8512
+ ],
8513
+ "returns": "uint64",
8514
+ "actions": [
8515
+ "NoOp"
8516
+ ]
8517
+ },
8518
+ "cleanupBallot": {
8519
+ "signature": "cleanupBallot(uint64,address[])uint64",
8520
+ "selector": "a9e823cd",
8521
+ "args": [
8522
+ {
8523
+ "name": "proposalID",
8524
+ "type": "uint64"
8525
+ },
8526
+ {
8527
+ "name": "voters",
8528
+ "type": "address[]"
8529
+ }
8530
+ ],
8531
+ "returns": "uint64",
8532
+ "actions": [
8533
+ "NoOp"
8534
+ ]
8535
+ },
8536
+ "validateActivation": {
8537
+ "signature": "validateActivation()void",
8538
+ "selector": "b9865a61",
8539
+ "args": [],
8540
+ "returns": "void",
8541
+ "actions": [
8542
+ "NoOp"
8543
+ ]
8544
+ },
8545
+ "openProposal": {
8546
+ "signature": "openProposal(pay,uint64,uint64,(uint64,uint64,uint64))void",
8547
+ "selector": "68449088",
8548
+ "args": [
8549
+ {
8550
+ "name": "mbrPayment",
8551
+ "type": "pay"
8552
+ },
8553
+ {
8554
+ "name": "proposalID",
8555
+ "type": "uint64"
8556
+ },
8557
+ {
8558
+ "name": "votingEnd",
8559
+ "type": "uint64"
8560
+ },
8561
+ {
8562
+ "name": "requirements",
8563
+ "type": "(uint64,uint64,uint64)",
8564
+ "struct": "GuildConsensusRequirements"
8565
+ }
8566
+ ],
8567
+ "returns": "void",
8568
+ "actions": [
8569
+ "NoOp"
8570
+ ]
8571
+ },
8572
+ "resolveProposal": {
8573
+ "signature": "resolveProposal(uint64)(bool,uint64,uint64,uint64,uint64)",
8574
+ "selector": "5b3a8b00",
8575
+ "args": [
8576
+ {
8577
+ "name": "proposalID",
8578
+ "type": "uint64"
8579
+ }
8580
+ ],
8581
+ "returns": "(bool,uint64,uint64,uint64,uint64)",
8582
+ "actions": [
8583
+ "NoOp"
8584
+ ]
8585
+ },
8586
+ "vote": {
8587
+ "signature": "vote(pay,address,uint64,uint8,byte[])void",
8588
+ "selector": "3d7525e9",
8589
+ "args": [
8590
+ {
8591
+ "name": "mbrPayment",
8592
+ "type": "pay"
8593
+ },
8594
+ {
8595
+ "name": "voter",
8596
+ "type": "address"
8597
+ },
8598
+ {
8599
+ "name": "proposalID",
8600
+ "type": "uint64"
8601
+ },
8602
+ {
8603
+ "name": "vote",
8604
+ "type": "uint8"
8605
+ },
8606
+ {
8607
+ "name": "evidence",
8608
+ "type": "byte[]"
8609
+ }
8610
+ ],
8611
+ "returns": "void",
8612
+ "actions": [
8613
+ "NoOp"
8614
+ ]
8615
+ },
8616
+ "proposalPower": {
8617
+ "signature": "proposalPower(address,byte[],uint64)uint64",
8618
+ "selector": "c3eb7cd4",
8619
+ "args": [
8620
+ {
8621
+ "name": "account",
8622
+ "type": "address"
8623
+ },
8624
+ {
8625
+ "name": "evidence",
8626
+ "type": "byte[]"
8627
+ },
8628
+ {
8629
+ "name": "requiredThrough",
8630
+ "type": "uint64"
8631
+ }
8632
+ ],
8633
+ "returns": "uint64",
8634
+ "actions": [
8635
+ "NoOp"
8636
+ ]
8637
+ },
8638
+ "create": {
8639
+ "signature": "create(byte[])void",
8640
+ "selector": "8e79358d",
8641
+ "args": [
8642
+ {
8643
+ "name": "governanceConfig",
8644
+ "type": "byte[]"
8645
+ }
8646
+ ],
8647
+ "returns": "void",
8648
+ "actions": [
8649
+ "create:NoOp"
8650
+ ]
8651
+ },
8652
+ "configurationMbr": {
8653
+ "signature": "configurationMbr(byte[])uint64",
8654
+ "selector": "aa3e40a8",
8655
+ "args": [
8656
+ {
8657
+ "name": "config",
8658
+ "type": "byte[]"
8659
+ }
8660
+ ],
8661
+ "returns": "uint64",
8662
+ "actions": [
8663
+ "NoOp"
8664
+ ]
8665
+ },
8666
+ "configure": {
8667
+ "signature": "configure(pay,byte[])void",
8668
+ "selector": "8bff8387",
8669
+ "args": [
8670
+ {
8671
+ "name": "mbrPayment",
8672
+ "type": "pay"
8673
+ },
8674
+ {
8675
+ "name": "config",
8676
+ "type": "byte[]"
8677
+ }
8678
+ ],
8679
+ "returns": "void",
8680
+ "actions": [
8681
+ "NoOp"
8682
+ ]
8683
+ },
8684
+ "consensusActionMbr": {
8685
+ "signature": "consensusActionMbr(byte[])uint64",
8686
+ "selector": "857e2717",
8687
+ "args": [
8688
+ {
8689
+ "name": "data",
8690
+ "type": "byte[]"
8691
+ }
8692
+ ],
8693
+ "returns": "uint64",
8694
+ "actions": [
8695
+ "NoOp"
8696
+ ]
8697
+ },
8698
+ "applyConsensusAction": {
8699
+ "signature": "applyConsensusAction(pay,uint64,byte[])void",
8700
+ "selector": "67ed5fed",
8701
+ "args": [
8702
+ {
8703
+ "name": "mbrPayment",
8704
+ "type": "pay"
8705
+ },
8706
+ {
8707
+ "name": "proposalID",
8708
+ "type": "uint64"
8709
+ },
8710
+ {
8711
+ "name": "data",
8712
+ "type": "byte[]"
8713
+ }
8714
+ ],
8715
+ "returns": "void",
8716
+ "actions": [
8717
+ "NoOp"
8718
+ ]
8719
+ },
8720
+ "bindGuild": {
8721
+ "signature": "bindGuild(uint64)void",
8722
+ "selector": "3e87013b",
8723
+ "args": [
8724
+ {
8725
+ "name": "guild",
8726
+ "type": "uint64"
8727
+ }
8728
+ ],
8729
+ "returns": "void",
8730
+ "actions": [
8731
+ "NoOp"
8732
+ ]
8733
+ },
8734
+ "getBallot": {
8735
+ "signature": "getBallot(uint64)(bool,bool,uint64,uint64,uint64,(uint64,uint64,uint64),(uint64,uint64,uint64))",
8736
+ "selector": "92bb769e",
8737
+ "args": [
8738
+ {
8739
+ "name": "proposalID",
8740
+ "type": "uint64"
8741
+ }
8742
+ ],
8743
+ "returns": "(bool,bool,uint64,uint64,uint64,(uint64,uint64,uint64),(uint64,uint64,uint64))",
8744
+ "actions": [
8745
+ "NoOp"
8746
+ ]
8747
+ },
8748
+ "voteMbr": {
8749
+ "signature": "voteMbr()uint64",
8750
+ "selector": "6f9378e3",
8751
+ "args": [],
8752
+ "returns": "uint64",
8753
+ "actions": [
8754
+ "NoOp"
8755
+ ]
8756
+ },
8757
+ "hasVoted": {
8758
+ "signature": "hasVoted(uint64,address)bool",
8759
+ "selector": "f50808ef",
8760
+ "args": [
8761
+ {
8762
+ "name": "proposalID",
8763
+ "type": "uint64"
8764
+ },
8765
+ {
8766
+ "name": "voter",
8767
+ "type": "address"
8768
+ }
8769
+ ],
8770
+ "returns": "bool",
8771
+ "actions": [
8772
+ "NoOp"
8773
+ ]
8774
+ },
8775
+ "opUp": {
8776
+ "signature": "opUp()void",
8777
+ "selector": "854dede0",
8778
+ "args": [],
8779
+ "returns": "void",
8780
+ "actions": [
8781
+ "NoOp"
8782
+ ]
8783
+ }
8784
+ },
8785
+ "events": {},
8786
+ "structs": {
8787
+ "Object75E64AB9": [
8788
+ {
8789
+ "name": "weight",
8790
+ "type": "uint64"
8791
+ },
8792
+ {
8793
+ "name": "since",
8794
+ "type": "uint64"
8795
+ },
8796
+ {
8797
+ "name": "slot",
8798
+ "type": "uint64"
8799
+ }
8800
+ ],
8801
+ "ObjectA68503ED": [
8802
+ {
8803
+ "name": "weight",
8804
+ "type": "uint64"
8805
+ },
8806
+ {
8807
+ "name": "until",
8808
+ "type": "uint64"
8809
+ }
8810
+ ],
8811
+ "ObjectA760343E": [
8812
+ {
8813
+ "name": "account",
8814
+ "type": "address"
8815
+ },
8816
+ {
8817
+ "name": "since",
8818
+ "type": "uint64"
8819
+ }
8820
+ ],
8821
+ "ObjectEEB10897": [
8822
+ {
8823
+ "name": "epoch",
8824
+ "type": "uint64"
8825
+ },
8826
+ {
8827
+ "name": "mode",
8828
+ "type": "uint8"
8829
+ }
8830
+ ],
8831
+ "GuildConsensusBallot": [
8832
+ {
8833
+ "name": "resolved",
8834
+ "type": "bool"
8835
+ },
8836
+ {
8837
+ "name": "approved",
8838
+ "type": "bool"
8839
+ },
8840
+ {
8841
+ "name": "votingEnd",
8842
+ "type": "uint64"
8843
+ },
8844
+ {
8845
+ "name": "eligiblePower",
8846
+ "type": "uint64"
8847
+ },
8848
+ {
8849
+ "name": "voteCount",
8850
+ "type": "uint64"
8851
+ },
8852
+ {
8853
+ "name": "requirements",
8854
+ "type": "GuildConsensusRequirements"
8855
+ },
8856
+ {
8857
+ "name": "votes",
8858
+ "type": "GuildVoteTotals"
8859
+ }
8860
+ ],
8861
+ "GuildConsensusRequirements": [
8862
+ {
8863
+ "name": "participation",
8864
+ "type": "uint64"
8865
+ },
8866
+ {
8867
+ "name": "approval",
8868
+ "type": "uint64"
8869
+ },
8870
+ {
8871
+ "name": "minimumApprovals",
8872
+ "type": "uint64"
8873
+ }
8874
+ ],
8875
+ "GuildConsensusResult": [
8876
+ {
8877
+ "name": "approved",
8878
+ "type": "bool"
8879
+ },
8880
+ {
8881
+ "name": "approvals",
8882
+ "type": "uint64"
8883
+ },
8884
+ {
8885
+ "name": "rejections",
8886
+ "type": "uint64"
8887
+ },
8888
+ {
8889
+ "name": "abstains",
8890
+ "type": "uint64"
8891
+ },
8892
+ {
8893
+ "name": "eligiblePower",
8894
+ "type": "uint64"
8895
+ }
8896
+ ],
8897
+ "GuildProposalSettings": [
8898
+ {
8899
+ "name": "fee",
8900
+ "type": "uint64"
8901
+ },
8902
+ {
8903
+ "name": "power",
8904
+ "type": "uint64"
8905
+ },
8906
+ {
8907
+ "name": "duration",
8908
+ "type": "uint64"
8909
+ },
8910
+ {
8911
+ "name": "participation",
8912
+ "type": "uint64"
8913
+ },
8914
+ {
8915
+ "name": "approval",
8916
+ "type": "uint64"
8917
+ },
8918
+ {
8919
+ "name": "minimumApprovals",
8920
+ "type": "uint64"
8921
+ }
8922
+ ],
8923
+ "GuildVote": [
8924
+ {
8925
+ "name": "type",
8926
+ "type": "uint8"
8927
+ },
8928
+ {
8929
+ "name": "power",
8930
+ "type": "uint64"
8931
+ }
8932
+ ],
8933
+ "GuildVoteKey": [
8934
+ {
8935
+ "name": "proposalID",
8936
+ "type": "uint64"
8937
+ },
8938
+ {
8939
+ "name": "voter",
8940
+ "type": "address"
8941
+ }
8942
+ ],
8943
+ "GuildVoteTotals": [
8944
+ {
8945
+ "name": "approvals",
8946
+ "type": "uint64"
8947
+ },
8948
+ {
8949
+ "name": "rejections",
8950
+ "type": "uint64"
8951
+ },
8952
+ {
8953
+ "name": "abstains",
8954
+ "type": "uint64"
8955
+ }
8956
+ ]
8957
+ }
7536
8958
  }
7537
8959
  };
7538
8960
 
@@ -7578,9 +9000,9 @@ function decodeGlobalState(contract, state) {
7578
9000
  const schema = CONTRACT_SCHEMAS[contract];
7579
9001
  const structs = schema.structs;
7580
9002
  const out = {};
7581
- for (const [field2, def] of Object.entries(schema.global)) {
9003
+ for (const [field3, def] of Object.entries(schema.global)) {
7582
9004
  const raw = state.get(def.key);
7583
- if (raw) out[field2] = decodeValue(def.type, raw, structs);
9005
+ if (raw) out[field3] = decodeValue(def.type, raw, structs);
7584
9006
  }
7585
9007
  return out;
7586
9008
  }
@@ -8426,7 +9848,7 @@ async function verifyArchived(entity, options) {
8426
9848
  if (!history.application.deleted) mismatches.push("status");
8427
9849
  const claimed = entity.data ?? {};
8428
9850
  const derived = reduced.data;
8429
- for (const field2 of family.verifyFields) if (!same(claimed[field2], derived[field2])) mismatches.push(field2);
9851
+ for (const field3 of family.verifyFields) if (!same(claimed[field3], derived[field3])) mismatches.push(field3);
8430
9852
  return {
8431
9853
  ...entity,
8432
9854
  status: history.application.deleted ? "archived" : "live",
@@ -8685,8 +10107,180 @@ var PUBLIC_ENDPOINTS = {
8685
10107
  testnet: { algod: "https://testnet-api.4160.nodely.dev", indexer: "https://testnet-idx.4160.nodely.dev" }
8686
10108
  };
8687
10109
 
10110
+ // src/guild.ts
10111
+ import algosdk6 from "algosdk";
10112
+ var STATUS = {
10113
+ "0": "draft",
10114
+ "10": "invalid",
10115
+ "20": "voting",
10116
+ "30": "rejected",
10117
+ "40": "approved",
10118
+ "50": "executed"
10119
+ };
10120
+ var GUILD_ZERO_ADDRESS = algosdk6.ALGORAND_ZERO_ADDRESS_STRING;
10121
+ function splitGuildProposalId(id) {
10122
+ const match = /^(\d+)\/(\d+)$/.exec(id.trim());
10123
+ return match ? { guildAppId: match[1], proposalId: match[2] } : void 0;
10124
+ }
10125
+ var ACTION_LABELS = {
10126
+ 10: "Upgrade the guild",
10127
+ 20: "Install a plugin",
10128
+ 21: "Install a named plugin",
10129
+ 22: "Change plugin vote settings",
10130
+ 30: "Run a plugin",
10131
+ 31: "Revoke a plugin run",
10132
+ 40: "Remove a plugin",
10133
+ 41: "Remove a named plugin",
10134
+ 50: "Add spending allowances",
10135
+ 60: "Remove spending allowances",
10136
+ 70: "Create an escrow",
10137
+ 71: "Lock or unlock an escrow",
10138
+ 72: "Reclaim from an escrow",
10139
+ 80: "Change proposal rules",
10140
+ 81: "Change the action limit",
10141
+ 82: "Create a wallet",
10142
+ 83: "Change membership",
10143
+ 84: "Change membership vote settings",
10144
+ 86: "Set the chat steward",
10145
+ 90: "Update the wallet",
10146
+ 91: "Hand the wallet to a new admin",
10147
+ 100: "Finish setup",
10148
+ 110: "Lock the plugin set"
10149
+ };
10150
+ function readUint64(data, offset) {
10151
+ if (data.length < offset + 8) return void 0;
10152
+ let value = 0n;
10153
+ for (let i = 0; i < 8; i += 1) value = value << 8n | BigInt(data[offset + i]);
10154
+ return value;
10155
+ }
10156
+ function summarizeGuildActions(actions) {
10157
+ return actions.map(([type, data]) => {
10158
+ const label = ACTION_LABELS[type] ?? `Action ${type}`;
10159
+ if (type !== 20 && type !== 22 && type !== 30 && type !== 40) return { type, label };
10160
+ const plugin = readUint64(data, 0);
10161
+ const action = { type, label, ...plugin !== void 0 && { pluginAppId: plugin.toString() } };
10162
+ if ((type === 20 || type === 40) && data.length >= 40) action.caller = algosdk6.encodeAddress(data.slice(8, 40));
10163
+ return action;
10164
+ });
10165
+ }
10166
+ var str3 = (v) => typeof v === "string" ? v : v == null ? "" : String(v);
10167
+ var field2 = (v, k) => v && typeof v === "object" && !Array.isArray(v) ? v[k] : void 0;
10168
+ var positive = (v) => str3(v) && str3(v) !== "0" ? str3(v) : void 0;
10169
+ function decodedActions(value) {
10170
+ if (!Array.isArray(value)) return [];
10171
+ return value.flatMap((entry) => {
10172
+ if (!Array.isArray(entry) || entry.length < 2) return [];
10173
+ const type = Number(str3(entry[0]));
10174
+ const raw = entry[1];
10175
+ const data = typeof raw === "string" ? fromHex(raw) : Array.isArray(raw) ? Uint8Array.from(raw, (b) => Number(str3(b))) : new Uint8Array();
10176
+ return Number.isSafeInteger(type) ? [[type, data]] : [];
10177
+ });
10178
+ }
10179
+ function ballotFrom(b) {
10180
+ const req = field2(b, "requirements");
10181
+ const votes = field2(b, "votes");
10182
+ return {
10183
+ resolved: field2(b, "resolved") === true,
10184
+ approved: field2(b, "approved") === true,
10185
+ votingEnd: str3(field2(b, "votingEnd")),
10186
+ eligiblePower: str3(field2(b, "eligiblePower")),
10187
+ voteCount: str3(field2(b, "voteCount")),
10188
+ requirements: {
10189
+ participation: str3(field2(req, "participation")) || "0",
10190
+ approval: str3(field2(req, "approval")) || "0",
10191
+ minimumApprovals: str3(field2(req, "minimumApprovals")) || "0"
10192
+ },
10193
+ votes: {
10194
+ approvals: str3(field2(votes, "approvals")) || "0",
10195
+ rejections: str3(field2(votes, "rejections")) || "0",
10196
+ abstains: str3(field2(votes, "abstains")) || "0"
10197
+ }
10198
+ };
10199
+ }
10200
+ async function readGuildProposal(fetchFn, algod, id) {
10201
+ const parts = splitGuildProposalId(id);
10202
+ if (!parts) return void 0;
10203
+ const { guildAppId, proposalId } = parts;
10204
+ const [app, value] = await Promise.all([
10205
+ requestJson(fetchFn, algod, `/v2/applications/${guildAppId}`),
10206
+ readBox(fetchFn, algod, guildAppId, boxName("guild", "proposals", BigInt(proposalId)))
10207
+ ]);
10208
+ if (!app || !value) return void 0;
10209
+ const guild = decodeGlobalState("guild", stateFromTeal(app.params["global-state"]));
10210
+ const p = decodeBoxValue("guild", "proposals", value);
10211
+ const status = STATUS[str3(field2(p, "status"))] ?? "invalid";
10212
+ const consensusAppId = positive(guild.consensus);
10213
+ const creator = str3(field2(p, "creator"));
10214
+ const data = {
10215
+ guildAppId,
10216
+ proposalId,
10217
+ consensusAppId,
10218
+ walletAppId: positive(guild.wallet),
10219
+ status,
10220
+ creator: creator && creator !== GUILD_ZERO_ADDRESS ? creator : void 0,
10221
+ created: str3(field2(p, "created")),
10222
+ votingTs: str3(field2(p, "votingTs")),
10223
+ actions: summarizeGuildActions(decodedActions(field2(p, "actions")))
10224
+ };
10225
+ if (consensusAppId && status !== "draft" && status !== "invalid") {
10226
+ const ballot = await readBox(fetchFn, algod, consensusAppId, boxName("guildConsensus", "ballots", BigInt(proposalId))).catch(() => void 0);
10227
+ if (ballot) data.ballot = ballotFrom(decodeBoxValue("guildConsensus", "ballots", ballot));
10228
+ }
10229
+ return data;
10230
+ }
10231
+ var HUNDRED = 100000n;
10232
+ function meets(b, approvals, rejections, turnout) {
10233
+ const participation = BigInt(b.requirements.participation);
10234
+ const approval = BigInt(b.requirements.approval);
10235
+ const minimum = BigInt(b.requirements.minimumApprovals);
10236
+ const eligible = BigInt(b.eligiblePower || "0");
10237
+ const decisive = approvals + rejections;
10238
+ return approvals > 0n && (participation === 0n || turnout * HUNDRED >= eligible * participation) && (minimum === 0n || approvals >= minimum) && (approval === 0n || decisive > 0n && approvals * HUNDRED >= decisive * approval);
10239
+ }
10240
+ function guildBallotOutcome(b, now) {
10241
+ if (b.resolved) return void 0;
10242
+ const approvals = BigInt(b.votes.approvals);
10243
+ const rejections = BigInt(b.votes.rejections);
10244
+ const turnout = approvals + rejections + BigInt(b.votes.abstains);
10245
+ const passes = meets(b, approvals, rejections, turnout);
10246
+ if (now > Number(b.votingEnd)) return passes ? "approved" : "rejected";
10247
+ const eligible = BigInt(b.eligiblePower || "0");
10248
+ if (eligible === 0n) return void 0;
10249
+ const remaining = eligible > turnout ? eligible - turnout : 0n;
10250
+ if (passes) return meets(b, approvals, rejections + remaining, turnout) ? "approved" : void 0;
10251
+ return meets(b, approvals + remaining, rejections, turnout + remaining) ? void 0 : "rejected";
10252
+ }
10253
+ function formatGuildPercent(value) {
10254
+ const tenths = Number((BigInt(value || "0") * 1000n + HUNDRED - 1n) / HUNDRED);
10255
+ return `${tenths % 10 === 0 ? tenths / 10 : (tenths / 10).toFixed(1)}%`;
10256
+ }
10257
+ function guildProposalStatusLabel(status) {
10258
+ switch (status) {
10259
+ case "draft":
10260
+ return "Draft";
10261
+ case "invalid":
10262
+ return "Invalid";
10263
+ case "voting":
10264
+ return "Voting";
10265
+ case "rejected":
10266
+ return "Rejected";
10267
+ case "approved":
10268
+ return "Passed";
10269
+ case "executed":
10270
+ return "Done";
10271
+ }
10272
+ }
10273
+ function guildRequirementsText(b) {
10274
+ const { approval, minimumApprovals, participation } = b.requirements;
10275
+ return [
10276
+ approval !== "0" ? `Needs ${formatGuildPercent(approval)} yes` : null,
10277
+ minimumApprovals !== "0" ? `at least ${minimumApprovals} approval${minimumApprovals === "1" ? "" : "s"}` : null,
10278
+ participation !== "0" ? `${formatGuildPercent(participation)} turnout` : null
10279
+ ].filter(Boolean).join(", ");
10280
+ }
10281
+
8688
10282
  // src/sources/algod.ts
8689
- var KINDS2 = /* @__PURE__ */ new Set(["account", "asset", "application"]);
10283
+ var KINDS2 = /* @__PURE__ */ new Set(["account", "asset", "application", "guild-proposal"]);
8690
10284
  function createAlgodSource(endpoint, singletons = {}) {
8691
10285
  const singletonKinds = {
8692
10286
  reward: singletons.rewards,
@@ -8709,6 +10303,11 @@ function createAlgodSource(endpoint, singletons = {}) {
8709
10303
  if (a) out.set(refKey(ref), { ...base, data: accountFromJson(a), provenance: { ...provenance, round: Number(a.round ?? 0) || void 0 } });
8710
10304
  return out;
8711
10305
  }
10306
+ if (ref.kind === "guild-proposal") {
10307
+ const data = await readGuildProposal(ctx.fetch, endpoint, ref.id);
10308
+ if (data) out.set(refKey(ref), { ...base, data, provenance });
10309
+ return out;
10310
+ }
8712
10311
  const singleton = singletonKinds[ref.kind];
8713
10312
  if (singleton) {
8714
10313
  const data = ref.kind === "reward" ? await readReward(ctx.fetch, endpoint, singleton, ref.id) : ref.kind === "subscription" ? await readSubscription(ctx.fetch, endpoint, singleton, ref.id) : await readTrade(ctx.fetch, endpoint, singleton, ref.id);
@@ -9037,6 +10636,7 @@ export {
9037
10636
  CONTRACT_SCHEMAS,
9038
10637
  DEFAULT_IPFS_GATEWAY,
9039
10638
  FAMILIES,
10639
+ GUILD_ZERO_ADDRESS,
9040
10640
  HttpError,
9041
10641
  INTERFACE_NAMESPACE,
9042
10642
  KindRegistry,
@@ -9071,9 +10671,13 @@ export {
9071
10671
  formatAlgo,
9072
10672
  formatAmount,
9073
10673
  formatDuration,
10674
+ formatGuildPercent,
9074
10675
  formatRelativeTime,
9075
10676
  fromBase64,
9076
10677
  fromHex,
10678
+ guildBallotOutcome,
10679
+ guildProposalStatusLabel,
10680
+ guildRequirementsText,
9077
10681
  hasRefs,
9078
10682
  interfaceAction,
9079
10683
  interfaceCards,
@@ -9090,6 +10694,7 @@ export {
9090
10694
  parseProps,
9091
10695
  policyFor,
9092
10696
  readBox,
10697
+ readGuildProposal,
9093
10698
  readInterfacePointer,
9094
10699
  readReward,
9095
10700
  readStakingPool,
@@ -9108,9 +10713,11 @@ export {
9108
10713
  serializeRef,
9109
10714
  shortAddress,
9110
10715
  sizeFromProps,
10716
+ splitGuildProposalId,
9111
10717
  splitSubscriptionId,
9112
10718
  stakingPoolFromDecoded,
9113
10719
  stateFromTeal,
10720
+ summarizeGuildActions,
9114
10721
  toBase64,
9115
10722
  toHex,
9116
10723
  utf8,