diff --git a/Cargo.lock b/Cargo.lock index 433b78dcc1..f3836ac5f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,6 +26,12 @@ dependencies = [ "prost 0.12.6", ] +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + [[package]] name = "base16ct" version = "0.1.1" @@ -104,6 +110,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" +dependencies = [ + "num-traits", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -193,6 +208,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "cosmwasm-storage" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66de2ab9db04757bcedef2b5984fbe536903ada4a8a9766717a4a71197ef34f6" +dependencies = [ + "cosmwasm-std", + "serde", +] + [[package]] name = "cpufeatures" version = "0.2.14" @@ -271,6 +296,75 @@ dependencies = [ "thiserror", ] +[[package]] +name = "cw-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "468b8f2696f625c8e15b5468f9420c8eabfaf23cb4fd7e6c660fc7e0cc8d77b8" +dependencies = [ + "cosmwasm-std", + "cosmwasm-storage", + "cw-core-interface", + "cw-core-macros", + "cw-paginate-storage", + "cw-storage-plus 0.13.4", + "cw-utils 0.13.4", + "cw2 0.13.4", + "cw20 0.13.4", + "cw721 0.13.4", + "schemars", + "serde", + "thiserror", +] + +[[package]] +name = "cw-core-interface" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c93e684945473777ebed2bcaf9f0af2291653f79d5c81774c6826350ba6d88de" +dependencies = [ + "cosmwasm-std", + "cw-core-macros", + "cw2 0.13.4", + "schemars", + "serde", +] + +[[package]] +name = "cw-core-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f20a77489d2dc8a1c12cb0b9671b6cbdca88f12fe65e1a4ee9899490f7669dcc" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "cw-denom" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e07529f645ad1d3db81129a9621268ce50e71a55ab4d19d8f3776b3d82108906" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw20 1.1.2", + "thiserror", +] + +[[package]] +name = "cw-hooks" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "babe643781092ff2386991ea3cbb17b7753d91a6df484168af9255e7a16ad5b6" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 1.2.0", + "thiserror", +] + [[package]] name = "cw-multi-test" version = "0.16.5" @@ -336,6 +430,43 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "cw-paginate-storage" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b854833e07c557dee02d1b61a21bb0731743bb2e3bbdc3e446a0d8a38af40ec4" +dependencies = [ + "cosmwasm-std", + "cosmwasm-storage", + "cw-storage-plus 0.13.4", + "serde", +] + +[[package]] +name = "cw-proposal-single" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6408483e1ac17a7e2b98ef6fa1379776964353bcbf501942d22ee1c1323117" +dependencies = [ + "cosmwasm-std", + "cosmwasm-storage", + "cw-core", + "cw-core-interface", + "cw-core-macros", + "cw-storage-plus 0.13.4", + "cw-utils 0.13.4", + "cw2 0.13.4", + "cw20 0.13.4", + "cw3", + "dao-voting 0.1.0", + "indexable-hooks", + "proposal-hooks", + "schemars", + "serde", + "thiserror", + "vote-hooks", +] + [[package]] name = "cw-storage-plus" version = "0.13.4" @@ -437,6 +568,18 @@ dependencies = [ "thiserror", ] +[[package]] +name = "cw2" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04cf4639517490dd36b333bbd6c4fbd92e325fd0acf4683b41753bc5eb63bfc1" +dependencies = [ + "cosmwasm-std", + "cw-storage-plus 0.13.4", + "schemars", + "serde", +] + [[package]] name = "cw2" version = "0.15.1" @@ -478,6 +621,31 @@ dependencies = [ "thiserror", ] +[[package]] +name = "cw20" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cb782b8f110819a4eb5dbbcfed25ffba49ec16bbe32b4ad8da50a5ce68fec05" +dependencies = [ + "cosmwasm-std", + "cw-utils 0.13.4", + "schemars", + "serde", +] + +[[package]] +name = "cw20" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "526e39bb20534e25a1cd0386727f0038f4da294e5e535729ba3ef54055246abd" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-utils 1.0.3", + "schemars", + "serde", +] + [[package]] name = "cw2981-royalties" version = "0.18.0" @@ -494,6 +662,31 @@ dependencies = [ "thiserror", ] +[[package]] +name = "cw3" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe19462a7f644ba60c19d3443cb90d00c50d9b6b3b0a3a7fca93df8261af979b" +dependencies = [ + "cosmwasm-std", + "cw-utils 0.13.4", + "schemars", + "serde", +] + +[[package]] +name = "cw4" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24754ff6e45f2a1c60adc409d9b2eb87666012c44021329141ffaab3388fccd2" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 1.2.0", + "schemars", + "serde", +] + [[package]] name = "cw721" version = "0.13.4" @@ -632,6 +825,120 @@ dependencies = [ "serde", ] +[[package]] +name = "dao-dao-macros" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ec9711ada60774da75cf8f26301cc606afb2c16fde1172d85af3483b8085cc3" +dependencies = [ + "cosmwasm-schema", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "dao-hooks" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79df3ba2fd85f249d02a52004fbb44648d499a01c010e56e897a5b12ecf880d0" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-hooks", + "cw4", + "dao-pre-propose-base", + "dao-voting 2.6.0", +] + +[[package]] +name = "dao-interface" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3502ffbcb4d4634a36901a91911722e9dba384e72f413ba625022472fc4b8e46" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-utils 1.0.3", + "cw2 1.1.2", + "cw20 1.1.2", + "cw721 0.18.0", + "osmosis-std", +] + +[[package]] +name = "dao-pre-propose-base" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd101d3154507b05213e837af306e157eb42682684f2358d6aee740cafff33ba" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-denom", + "cw-hooks", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.3", + "cw2 1.1.2", + "dao-interface", + "dao-voting 2.6.0", + "semver", + "serde", + "thiserror", +] + +[[package]] +name = "dao-proposal-single" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7d30cc75360cf8dad9e95378fa20776693f207409266aeb6c91707e3746af42" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-hooks", + "cw-proposal-single", + "cw-storage-plus 1.2.0", + "cw-utils 0.13.4", + "cw-utils 1.0.3", + "cw2 1.1.2", + "cw20 1.1.2", + "dao-dao-macros", + "dao-hooks", + "dao-interface", + "dao-pre-propose-base", + "dao-voting 0.1.0", + "dao-voting 2.6.0", + "thiserror", +] + +[[package]] +name = "dao-voting" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "442d770933e3b3ecab4cfb4d6e9d054082b007d35fda3cf0c3d3ddd1cfa91782" +dependencies = [ + "cosmwasm-std", + "schemars", + "serde", + "thiserror", +] + +[[package]] +name = "dao-voting" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a96db7109c0273433cb46b12904a1c2b2444bc656ebd2f5ccc645e430784eba5" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "cw-denom", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.3", + "cw20 1.1.2", + "dao-dao-macros", + "dao-interface", + "thiserror", +] + [[package]] name = "der" version = "0.6.1" @@ -884,6 +1191,19 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "indexable-hooks" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d70922e1e0e68d99ec1a24446c70756cc3e56deaddb505b1f4b43914522d809" +dependencies = [ + "cosmwasm-std", + "cw-storage-plus 0.13.4", + "schemars", + "serde", + "thiserror", +] + [[package]] name = "indexmap" version = "2.5.0" @@ -1024,6 +1344,8 @@ dependencies = [ "cw2981-royalties", "cw721 0.18.0", "cw721-base 0.18.0", + "dao-proposal-single", + "dao-voting 2.6.0", "nft-tr721", "schemars", "serde", @@ -1088,6 +1410,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + [[package]] name = "once_cell" version = "1.19.0" @@ -1100,6 +1431,35 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" +[[package]] +name = "osmosis-std" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d7aa053bc3fad557ac90a0377688b400c395e2537f0f1de3293a15cad2e970" +dependencies = [ + "chrono", + "cosmwasm-std", + "osmosis-std-derive", + "prost 0.11.9", + "prost-types", + "schemars", + "serde", + "serde-cw-value", +] + +[[package]] +name = "osmosis-std-derive" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5ebdfd1bc8ed04db596e110c6baa9b174b04f6ed1ec22c666ddc5cb3fa91bd7" +dependencies = [ + "itertools 0.10.5", + "proc-macro2", + "prost-types", + "quote", + "syn 1.0.109", +] + [[package]] name = "pkcs8" version = "0.9.0" @@ -1163,6 +1523,18 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proposal-hooks" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9a2f15b848398bad689771b35313c7e7095e772d444e299dbdb54b906691f8a" +dependencies = [ + "cosmwasm-std", + "indexable-hooks", + "schemars", + "serde", +] + [[package]] name = "prost" version = "0.9.0" @@ -1173,6 +1545,16 @@ dependencies = [ "prost-derive 0.9.0", ] +[[package]] +name = "prost" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +dependencies = [ + "bytes", + "prost-derive 0.11.9", +] + [[package]] name = "prost" version = "0.12.6" @@ -1196,6 +1578,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "prost-derive" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +dependencies = [ + "anyhow", + "itertools 0.10.5", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "prost-derive" version = "0.12.6" @@ -1203,12 +1598,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.12.1", "proc-macro2", "quote", "syn 2.0.77", ] +[[package]] +name = "prost-types" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" +dependencies = [ + "prost 0.11.9", +] + [[package]] name = "quote" version = "1.0.37" @@ -1662,6 +2066,18 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "vote-hooks" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef617ad17edd195f8a3bce72498bfcc406a27cecfc23828f562fa91a3e2fb141" +dependencies = [ + "cosmwasm-std", + "indexable-hooks", + "schemars", + "serde", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/go/pkg/networks/features.gen.go b/go/pkg/networks/features.gen.go index dc028972b1..536dd2ce2f 100644 --- a/go/pkg/networks/features.gen.go +++ b/go/pkg/networks/features.gen.go @@ -66,11 +66,12 @@ func (nb *NetworkBase) GetFeatureCosmWasmNFTsBurner() (*FeatureCosmWasmNFTsBurne type FeatureCosmWasmNFTLaunchpad struct { *FeatureBase - LaunchpadContractAddress string `json:"launchpadContractAddress"` - DefaultMintDenom string `json:"defaultMintDenom"` - LaunchpadEndpoint string `json:"launchpadEndpoint"` - CodeId float64 `json:"codeId"` - NftTr721CodeId float64 `json:"nftTr721CodeId"` + LaunchpadContractAddress string `json:"launchpadContractAddress"` + DefaultMintDenom string `json:"defaultMintDenom"` + LaunchpadEndpoint string `json:"launchpadEndpoint"` + CodeId float64 `json:"codeId"` + NftTr721CodeId float64 `json:"nftTr721CodeId"` + DaoProposalSingleContractAddress string `json:"daoProposalSingleContractAddress"` } var _ Feature = &FeatureCosmWasmNFTLaunchpad{} diff --git a/networks.json b/networks.json index b782b92608..7cbe7ca912 100644 --- a/networks.json +++ b/networks.json @@ -11547,6 +11547,17 @@ "RiotP2E", "NFTMarketplaceLeaderboard" ], + "featureObjects": [ + { + "type": "CosmWasmNFTLaunchpad", + "launchpadContractAddress": "", + "launchpadEndpoint": "http://localhost:9090", + "nftTr721CodeId": 0, + "codeId": 0, + "defaultMintDenom": "utori", + "daoProposalSingleContractAddress": "" + } + ], "currencies": [ { "denom": "utori", @@ -11647,8 +11658,9 @@ "launchpadContractAddress": "tori1te7ku4de0k4rl8lhyuvpmhygaq7k7vy5zpsjq9y638efxsnx3aaqck2utf", "launchpadEndpoint": "https://dapp-backend.testnet.teritori.com", "nftTr721CodeId": 60, - "codeId": 71, - "defaultMintDenom": "utori" + "codeId": 93, + "defaultMintDenom": "utori", + "daoProposalSingleContractAddress": "tori1kprr6paf06nhwavaduasdeh7cs8z90mwg7w783kluya7aachndkqes2s7x" }, { "type": "CosmWasmRakki", diff --git a/packages/api/google/protobuf/any.ts b/packages/api/google/protobuf/any.ts index 1f3e89aeaf..99dfc69c1a 100644 --- a/packages/api/google/protobuf/any.ts +++ b/packages/api/google/protobuf/any.ts @@ -33,7 +33,7 @@ export const protobufPackage = "google.protobuf"; * foo = any.unpack(Foo.getDefaultInstance()); * } * - * Example 3: Pack and unpack a message in Python. + * Example 3: Pack and unpack a message in Python. * * foo = Foo(...) * any = Any() @@ -43,7 +43,7 @@ export const protobufPackage = "google.protobuf"; * any.Unpack(foo) * ... * - * Example 4: Pack and unpack a message in Go + * Example 4: Pack and unpack a message in Go * * foo := &pb.Foo{...} * any, err := anypb.New(foo) @@ -63,7 +63,7 @@ export const protobufPackage = "google.protobuf"; * name "y.z". * * JSON - * ==== + * * The JSON representation of an `Any` value uses the regular * representation of the deserialized, embedded message, with an * additional field `@type` which contains the type URL. Example: @@ -115,8 +115,7 @@ export interface Any { * * Note: this functionality is not currently available in the official * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. As of May 2023, there are no widely used type server - * implementations and no plans to implement one. + * type.googleapis.com. * * Schemes other than `http`, `https` (or the empty scheme) might be * used with implementation specific semantics. diff --git a/packages/api/weshnet/google/protobuf/descriptor.ts b/packages/api/weshnet/google/protobuf/descriptor.ts index c922333981..afbd56df56 100644 --- a/packages/api/weshnet/google/protobuf/descriptor.ts +++ b/packages/api/weshnet/google/protobuf/descriptor.ts @@ -4,98 +4,6 @@ import _m0 from "protobufjs/minimal"; export const protobufPackage = "google.protobuf"; -/** The full set of known editions. */ -export enum Edition { - /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ - EDITION_UNKNOWN = 0, - /** - * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like - * distinct editions. These can't be used to specify the edition of proto - * files, but feature definitions must supply proto2/proto3 defaults for - * backwards compatibility. - */ - EDITION_PROTO2 = 998, - EDITION_PROTO3 = 999, - /** - * EDITION_2023 - Editions that have been released. The specific values are arbitrary and - * should not be depended on, but they will always be time-ordered for easy - * comparison. - */ - EDITION_2023 = 1000, - /** - * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be - * used or relyed on outside of tests. - */ - EDITION_1_TEST_ONLY = 1, - EDITION_2_TEST_ONLY = 2, - EDITION_99997_TEST_ONLY = 99997, - EDITION_99998_TEST_ONLY = 99998, - EDITION_99999_TEST_ONLY = 99999, - UNRECOGNIZED = -1, -} - -export function editionFromJSON(object: any): Edition { - switch (object) { - case 0: - case "EDITION_UNKNOWN": - return Edition.EDITION_UNKNOWN; - case 998: - case "EDITION_PROTO2": - return Edition.EDITION_PROTO2; - case 999: - case "EDITION_PROTO3": - return Edition.EDITION_PROTO3; - case 1000: - case "EDITION_2023": - return Edition.EDITION_2023; - case 1: - case "EDITION_1_TEST_ONLY": - return Edition.EDITION_1_TEST_ONLY; - case 2: - case "EDITION_2_TEST_ONLY": - return Edition.EDITION_2_TEST_ONLY; - case 99997: - case "EDITION_99997_TEST_ONLY": - return Edition.EDITION_99997_TEST_ONLY; - case 99998: - case "EDITION_99998_TEST_ONLY": - return Edition.EDITION_99998_TEST_ONLY; - case 99999: - case "EDITION_99999_TEST_ONLY": - return Edition.EDITION_99999_TEST_ONLY; - case -1: - case "UNRECOGNIZED": - default: - return Edition.UNRECOGNIZED; - } -} - -export function editionToJSON(object: Edition): string { - switch (object) { - case Edition.EDITION_UNKNOWN: - return "EDITION_UNKNOWN"; - case Edition.EDITION_PROTO2: - return "EDITION_PROTO2"; - case Edition.EDITION_PROTO3: - return "EDITION_PROTO3"; - case Edition.EDITION_2023: - return "EDITION_2023"; - case Edition.EDITION_1_TEST_ONLY: - return "EDITION_1_TEST_ONLY"; - case Edition.EDITION_2_TEST_ONLY: - return "EDITION_2_TEST_ONLY"; - case Edition.EDITION_99997_TEST_ONLY: - return "EDITION_99997_TEST_ONLY"; - case Edition.EDITION_99998_TEST_ONLY: - return "EDITION_99998_TEST_ONLY"; - case Edition.EDITION_99999_TEST_ONLY: - return "EDITION_99999_TEST_ONLY"; - case Edition.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - /** * The protocol compiler can output a FileDescriptorSet containing the .proto * files it parses. @@ -143,8 +51,8 @@ export interface FileDescriptorProto { * If `edition` is present, this value must be "editions". */ syntax: string; - /** The edition of the proto file. */ - edition: Edition; + /** The edition of the proto file, which is an opaque string. */ + edition: string; } /** Describes a message type. */ @@ -188,84 +96,6 @@ export interface DescriptorProto_ReservedRange { export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; - /** - * For external users: DO NOT USE. We are in the process of open sourcing - * extension declaration and executing internal cleanups before it can be - * used externally. - */ - declaration: ExtensionRangeOptions_Declaration[]; - /** Any features defined in the specific edition. */ - features: - | FeatureSet - | undefined; - /** - * The verification state of the range. - * TODO: flip the default to DECLARATION once all empty ranges - * are marked as UNVERIFIED. - */ - verification: ExtensionRangeOptions_VerificationState; -} - -/** The verification state of the extension range. */ -export enum ExtensionRangeOptions_VerificationState { - /** DECLARATION - All the extensions of the range must be declared. */ - DECLARATION = 0, - UNVERIFIED = 1, - UNRECOGNIZED = -1, -} - -export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { - switch (object) { - case 0: - case "DECLARATION": - return ExtensionRangeOptions_VerificationState.DECLARATION; - case 1: - case "UNVERIFIED": - return ExtensionRangeOptions_VerificationState.UNVERIFIED; - case -1: - case "UNRECOGNIZED": - default: - return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; - } -} - -export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { - switch (object) { - case ExtensionRangeOptions_VerificationState.DECLARATION: - return "DECLARATION"; - case ExtensionRangeOptions_VerificationState.UNVERIFIED: - return "UNVERIFIED"; - case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface ExtensionRangeOptions_Declaration { - /** The extension number declared within the extension range. */ - number: number; - /** - * The fully-qualified name of the extension field. There must be a leading - * dot in front of the full name. - */ - fullName: string; - /** - * The fully-qualified type name of the extension field. Unlike - * Metadata.type, Declaration.type must have a leading dot for messages - * and enums. - */ - type: string; - /** - * If true, indicates that the number is reserved in the extension range, - * and any extension field with the number will fail to compile. Set this - * when a declared extension field is deleted. - */ - reserved: boolean; - /** - * If true, indicates that the extension must be defined as repeated. - * Otherwise the extension must be defined as optional. - */ - repeated: boolean; } /** Describes a field within a message. */ @@ -363,10 +193,9 @@ export enum FieldDescriptorProto_Type { TYPE_STRING = 9, /** * TYPE_GROUP - Tag-delimited aggregate. - * Group type is deprecated and not supported after google.protobuf. However, Proto3 + * Group type is deprecated and not supported in proto3. However, Proto3 * implementations should still be able to parse the group wire format and - * treat group fields as unknown fields. In Editions, the group wire format - * can be enabled via the `message_encoding` feature. + * treat group fields as unknown fields. */ TYPE_GROUP = 10, /** TYPE_MESSAGE - Length-delimited aggregate. */ @@ -494,13 +323,8 @@ export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Typ export enum FieldDescriptorProto_Label { /** LABEL_OPTIONAL - 0 is reserved for errors */ LABEL_OPTIONAL = 1, - LABEL_REPEATED = 3, - /** - * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions - * it's explicitly prohibited. In Editions, the `field_presence` feature - * can be used to get this behavior. - */ LABEL_REQUIRED = 2, + LABEL_REPEATED = 3, UNRECOGNIZED = -1, } @@ -509,12 +333,12 @@ export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptor case 1: case "LABEL_OPTIONAL": return FieldDescriptorProto_Label.LABEL_OPTIONAL; - case 3: - case "LABEL_REPEATED": - return FieldDescriptorProto_Label.LABEL_REPEATED; case 2: case "LABEL_REQUIRED": return FieldDescriptorProto_Label.LABEL_REQUIRED; + case 3: + case "LABEL_REPEATED": + return FieldDescriptorProto_Label.LABEL_REPEATED; case -1: case "UNRECOGNIZED": default: @@ -526,10 +350,10 @@ export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_La switch (object) { case FieldDescriptorProto_Label.LABEL_OPTIONAL: return "LABEL_OPTIONAL"; - case FieldDescriptorProto_Label.LABEL_REPEATED: - return "LABEL_REPEATED"; case FieldDescriptorProto_Label.LABEL_REQUIRED: return "LABEL_REQUIRED"; + case FieldDescriptorProto_Label.LABEL_REPEATED: + return "LABEL_REPEATED"; case FieldDescriptorProto_Label.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -723,10 +547,6 @@ export interface FileOptions { * determining the ruby package. */ rubyPackage: string; - /** Any features defined in the specific edition. */ - features: - | FeatureSet - | undefined; /** * The parser stores options it doesn't recognize here. * See the documentation for the "Options" section above. @@ -845,16 +665,12 @@ export interface MessageOptions { * This should only be used as a temporary measure against broken builds due * to the change in behavior for JSON field name conflicts. * - * TODO This is legacy behavior we plan to remove once downstream + * TODO(b/261750190) This is legacy behavior we plan to remove once downstream * teams have had time to migrate. * * @deprecated */ deprecatedLegacyJsonFieldConflicts: boolean; - /** Any features defined in the specific edition. */ - features: - | FeatureSet - | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -863,10 +679,8 @@ export interface FieldOptions { /** * The ctype option instructs the C++ code generator to use a different * representation of the field than it normally would. See the specific - * options below. This option is only implemented to support use of - * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of - * type "bytes" in the open source release -- sorry, we'll try to include - * other types in a future version! + * options below. This option is not yet implemented in the open source + * release -- sorry, we'll try to include it in a future version! */ ctype: FieldOptions_CType; /** @@ -874,9 +688,7 @@ export interface FieldOptions { * a more efficient representation on the wire. Rather than repeatedly * writing the tag and type for each element, the entire array is encoded as * a single length-delimited blob. In proto3, only explicit setting it to - * false will avoid using packed encoding. This option is prohibited in - * Editions, but the `repeated_field_encoding` feature can be used to control - * the behavior. + * false will avoid using packed encoding. */ packed: boolean; /** @@ -947,12 +759,7 @@ export interface FieldOptions { */ debugRedact: boolean; retention: FieldOptions_OptionRetention; - targets: FieldOptions_OptionTargetType[]; - editionDefaults: FieldOptions_EditionDefault[]; - /** Any features defined in the specific edition. */ - features: - | FeatureSet - | undefined; + target: FieldOptions_OptionTargetType; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -960,14 +767,6 @@ export interface FieldOptions { export enum FieldOptions_CType { /** STRING - Default mode. */ STRING = 0, - /** - * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type - * "bytes". It indicates that in C++, the data should be stored in a Cord - * instead of a string. For very large strings, this may reduce memory - * fragmentation. It may also allow better performance when parsing from a - * Cord, or when parsing with aliasing enabled, as the parsed Cord may then - * alias the original buffer. - */ CORD = 1, STRING_PIECE = 2, UNRECOGNIZED = -1, @@ -1178,17 +977,7 @@ export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionT } } -export interface FieldOptions_EditionDefault { - edition: Edition; - /** Textproto value. */ - value: string; -} - export interface OneofOptions { - /** Any features defined in the specific edition. */ - features: - | FeatureSet - | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -1211,16 +1000,12 @@ export interface EnumOptions { * and strips underscored from the fields before comparison in proto3 only. * The new behavior takes `json_name` into account and applies to proto2 as * well. - * TODO Remove this legacy behavior once downstream teams have + * TODO(b/261750190) Remove this legacy behavior once downstream teams have * had time to migrate. * * @deprecated */ deprecatedLegacyJsonFieldConflicts: boolean; - /** Any features defined in the specific edition. */ - features: - | FeatureSet - | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -1233,25 +1018,11 @@ export interface EnumValueOptions { * this is a formalization for deprecating enum values. */ deprecated: boolean; - /** Any features defined in the specific edition. */ - features: - | FeatureSet - | undefined; - /** - * Indicate that fields annotated with this enum value should not be printed - * out when using debug formats, e.g. when the field contains sensitive - * credentials. - */ - debugRedact: boolean; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } export interface ServiceOptions { - /** Any features defined in the specific edition. */ - features: - | FeatureSet - | undefined; /** * Is this service deprecated? * Depending on the target platform, this can emit Deprecated annotations @@ -1272,10 +1043,6 @@ export interface MethodOptions { */ deprecated: boolean; idempotencyLevel: MethodOptions_IdempotencyLevel; - /** Any features defined in the specific edition. */ - features: - | FeatureSet - | undefined; /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } @@ -1360,294 +1127,6 @@ export interface UninterpretedOption_NamePart { isExtension: boolean; } -/** - * TODO Enums in C++ gencode (and potentially other languages) are - * not well scoped. This means that each of the feature enums below can clash - * with each other. The short names we've chosen maximize call-site - * readability, but leave us very open to this scenario. A future feature will - * be designed and implemented to handle this, hopefully before we ever hit a - * conflict here. - */ -export interface FeatureSet { - fieldPresence: FeatureSet_FieldPresence; - enumType: FeatureSet_EnumType; - repeatedFieldEncoding: FeatureSet_RepeatedFieldEncoding; - utf8Validation: FeatureSet_Utf8Validation; - messageEncoding: FeatureSet_MessageEncoding; - jsonFormat: FeatureSet_JsonFormat; -} - -export enum FeatureSet_FieldPresence { - FIELD_PRESENCE_UNKNOWN = 0, - EXPLICIT = 1, - IMPLICIT = 2, - LEGACY_REQUIRED = 3, - UNRECOGNIZED = -1, -} - -export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { - switch (object) { - case 0: - case "FIELD_PRESENCE_UNKNOWN": - return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; - case 1: - case "EXPLICIT": - return FeatureSet_FieldPresence.EXPLICIT; - case 2: - case "IMPLICIT": - return FeatureSet_FieldPresence.IMPLICIT; - case 3: - case "LEGACY_REQUIRED": - return FeatureSet_FieldPresence.LEGACY_REQUIRED; - case -1: - case "UNRECOGNIZED": - default: - return FeatureSet_FieldPresence.UNRECOGNIZED; - } -} - -export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { - switch (object) { - case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: - return "FIELD_PRESENCE_UNKNOWN"; - case FeatureSet_FieldPresence.EXPLICIT: - return "EXPLICIT"; - case FeatureSet_FieldPresence.IMPLICIT: - return "IMPLICIT"; - case FeatureSet_FieldPresence.LEGACY_REQUIRED: - return "LEGACY_REQUIRED"; - case FeatureSet_FieldPresence.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export enum FeatureSet_EnumType { - ENUM_TYPE_UNKNOWN = 0, - OPEN = 1, - CLOSED = 2, - UNRECOGNIZED = -1, -} - -export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { - switch (object) { - case 0: - case "ENUM_TYPE_UNKNOWN": - return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; - case 1: - case "OPEN": - return FeatureSet_EnumType.OPEN; - case 2: - case "CLOSED": - return FeatureSet_EnumType.CLOSED; - case -1: - case "UNRECOGNIZED": - default: - return FeatureSet_EnumType.UNRECOGNIZED; - } -} - -export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { - switch (object) { - case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: - return "ENUM_TYPE_UNKNOWN"; - case FeatureSet_EnumType.OPEN: - return "OPEN"; - case FeatureSet_EnumType.CLOSED: - return "CLOSED"; - case FeatureSet_EnumType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export enum FeatureSet_RepeatedFieldEncoding { - REPEATED_FIELD_ENCODING_UNKNOWN = 0, - PACKED = 1, - EXPANDED = 2, - UNRECOGNIZED = -1, -} - -export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { - switch (object) { - case 0: - case "REPEATED_FIELD_ENCODING_UNKNOWN": - return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; - case 1: - case "PACKED": - return FeatureSet_RepeatedFieldEncoding.PACKED; - case 2: - case "EXPANDED": - return FeatureSet_RepeatedFieldEncoding.EXPANDED; - case -1: - case "UNRECOGNIZED": - default: - return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; - } -} - -export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { - switch (object) { - case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: - return "REPEATED_FIELD_ENCODING_UNKNOWN"; - case FeatureSet_RepeatedFieldEncoding.PACKED: - return "PACKED"; - case FeatureSet_RepeatedFieldEncoding.EXPANDED: - return "EXPANDED"; - case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export enum FeatureSet_Utf8Validation { - UTF8_VALIDATION_UNKNOWN = 0, - NONE = 1, - VERIFY = 2, - UNRECOGNIZED = -1, -} - -export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { - switch (object) { - case 0: - case "UTF8_VALIDATION_UNKNOWN": - return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; - case 1: - case "NONE": - return FeatureSet_Utf8Validation.NONE; - case 2: - case "VERIFY": - return FeatureSet_Utf8Validation.VERIFY; - case -1: - case "UNRECOGNIZED": - default: - return FeatureSet_Utf8Validation.UNRECOGNIZED; - } -} - -export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { - switch (object) { - case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: - return "UTF8_VALIDATION_UNKNOWN"; - case FeatureSet_Utf8Validation.NONE: - return "NONE"; - case FeatureSet_Utf8Validation.VERIFY: - return "VERIFY"; - case FeatureSet_Utf8Validation.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export enum FeatureSet_MessageEncoding { - MESSAGE_ENCODING_UNKNOWN = 0, - LENGTH_PREFIXED = 1, - DELIMITED = 2, - UNRECOGNIZED = -1, -} - -export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { - switch (object) { - case 0: - case "MESSAGE_ENCODING_UNKNOWN": - return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; - case 1: - case "LENGTH_PREFIXED": - return FeatureSet_MessageEncoding.LENGTH_PREFIXED; - case 2: - case "DELIMITED": - return FeatureSet_MessageEncoding.DELIMITED; - case -1: - case "UNRECOGNIZED": - default: - return FeatureSet_MessageEncoding.UNRECOGNIZED; - } -} - -export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { - switch (object) { - case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: - return "MESSAGE_ENCODING_UNKNOWN"; - case FeatureSet_MessageEncoding.LENGTH_PREFIXED: - return "LENGTH_PREFIXED"; - case FeatureSet_MessageEncoding.DELIMITED: - return "DELIMITED"; - case FeatureSet_MessageEncoding.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export enum FeatureSet_JsonFormat { - JSON_FORMAT_UNKNOWN = 0, - ALLOW = 1, - LEGACY_BEST_EFFORT = 2, - UNRECOGNIZED = -1, -} - -export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { - switch (object) { - case 0: - case "JSON_FORMAT_UNKNOWN": - return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; - case 1: - case "ALLOW": - return FeatureSet_JsonFormat.ALLOW; - case 2: - case "LEGACY_BEST_EFFORT": - return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; - case -1: - case "UNRECOGNIZED": - default: - return FeatureSet_JsonFormat.UNRECOGNIZED; - } -} - -export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { - switch (object) { - case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: - return "JSON_FORMAT_UNKNOWN"; - case FeatureSet_JsonFormat.ALLOW: - return "ALLOW"; - case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: - return "LEGACY_BEST_EFFORT"; - case FeatureSet_JsonFormat.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** - * A compiled specification for the defaults of a set of features. These - * messages are generated from FeatureSet extensions and can be used to seed - * feature resolution. The resolution with this object becomes a simple search - * for the closest matching edition, followed by proto merges. - */ -export interface FeatureSetDefaults { - defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; - /** - * The minimum supported edition (inclusive) when this was constructed. - * Editions before this will not have defaults. - */ - minimumEdition: Edition; - /** - * The maximum known edition (inclusive) when this was constructed. Editions - * after this will not have reliable defaults. - */ - maximumEdition: Edition; -} - -/** - * A map from every known edition with a unique set of defaults to its - * defaults. Not all editions may be contained here. For a given edition, - * the defaults at the closest matching edition ordered at or before it should - * be used. This field must be in strict ascending order by edition. - */ -export interface FeatureSetDefaults_FeatureSetEditionDefault { - edition: Edition; - features: FeatureSet | undefined; -} - /** * Encapsulates information about the original source file from which a * FileDescriptorProto was generated. @@ -1944,7 +1423,7 @@ function createBaseFileDescriptorProto(): FileDescriptorProto { options: undefined, sourceCodeInfo: undefined, syntax: "", - edition: 0, + edition: "", }; } @@ -1990,8 +1469,8 @@ export const FileDescriptorProto = { if (message.syntax !== "") { writer.uint32(98).string(message.syntax); } - if (message.edition !== 0) { - writer.uint32(112).int32(message.edition); + if (message.edition !== "") { + writer.uint32(106).string(message.edition); } return writer; }, @@ -2107,12 +1586,12 @@ export const FileDescriptorProto = { message.syntax = reader.string(); continue; - case 14: - if (tag !== 112) { + case 13: + if (tag !== 106) { break; } - message.edition = reader.int32() as any; + message.edition = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { @@ -2151,7 +1630,7 @@ export const FileDescriptorProto = { options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, sourceCodeInfo: isSet(object.sourceCodeInfo) ? SourceCodeInfo.fromJSON(object.sourceCodeInfo) : undefined, syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", - edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + edition: isSet(object.edition) ? globalThis.String(object.edition) : "", }; }, @@ -2193,8 +1672,8 @@ export const FileDescriptorProto = { if (message.syntax !== "") { obj.syntax = message.syntax; } - if (message.edition !== 0) { - obj.edition = editionToJSON(message.edition); + if (message.edition !== "") { + obj.edition = message.edition; } return obj; }, @@ -2220,7 +1699,7 @@ export const FileDescriptorProto = { ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; message.syntax = object.syntax ?? ""; - message.edition = object.edition ?? 0; + message.edition = object.edition ?? ""; return message; }, }; @@ -2618,7 +2097,7 @@ export const DescriptorProto_ReservedRange = { }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { - return { uninterpretedOption: [], declaration: [], features: undefined, verification: 0 }; + return { uninterpretedOption: [] }; } export const ExtensionRangeOptions = { @@ -2626,15 +2105,6 @@ export const ExtensionRangeOptions = { for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } - for (const v of message.declaration) { - ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).ldelim(); - } - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(402).fork()).ldelim(); - } - if (message.verification !== 0) { - writer.uint32(24).int32(message.verification); - } return writer; }, @@ -2652,27 +2122,6 @@ export const ExtensionRangeOptions = { message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); continue; - case 2: - if (tag !== 18) { - break; - } - - message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); - continue; - case 50: - if (tag !== 402) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 24) { - break; - } - - message.verification = reader.int32() as any; - continue; } if ((tag & 7) === 4 || tag === 0) { break; @@ -2687,13 +2136,6 @@ export const ExtensionRangeOptions = { uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], - declaration: globalThis.Array.isArray(object?.declaration) - ? object.declaration.map((e: any) => ExtensionRangeOptions_Declaration.fromJSON(e)) - : [], - features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, - verification: isSet(object.verification) - ? extensionRangeOptions_VerificationStateFromJSON(object.verification) - : 0, }; }, @@ -2702,15 +2144,6 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } - if (message.declaration?.length) { - obj.declaration = message.declaration.map((e) => ExtensionRangeOptions_Declaration.toJSON(e)); - } - if (message.features !== undefined) { - obj.features = FeatureSet.toJSON(message.features); - } - if (message.verification !== 0) { - obj.verification = extensionRangeOptions_VerificationStateToJSON(message.verification); - } return obj; }, @@ -2720,134 +2153,6 @@ export const ExtensionRangeOptions = { fromPartial, I>>(object: I): ExtensionRangeOptions { const message = createBaseExtensionRangeOptions(); message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; - message.declaration = object.declaration?.map((e) => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; - message.verification = object.verification ?? 0; - return message; - }, -}; - -function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { - return { number: 0, fullName: "", type: "", reserved: false, repeated: false }; -} - -export const ExtensionRangeOptions_Declaration = { - encode(message: ExtensionRangeOptions_Declaration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.number !== 0) { - writer.uint32(8).int32(message.number); - } - if (message.fullName !== "") { - writer.uint32(18).string(message.fullName); - } - if (message.type !== "") { - writer.uint32(26).string(message.type); - } - if (message.reserved === true) { - writer.uint32(40).bool(message.reserved); - } - if (message.repeated === true) { - writer.uint32(48).bool(message.repeated); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseExtensionRangeOptions_Declaration(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - - message.number = reader.int32(); - continue; - case 2: - if (tag !== 18) { - break; - } - - message.fullName = reader.string(); - continue; - case 3: - if (tag !== 26) { - break; - } - - message.type = reader.string(); - continue; - case 5: - if (tag !== 40) { - break; - } - - message.reserved = reader.bool(); - continue; - case 6: - if (tag !== 48) { - break; - } - - message.repeated = reader.bool(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - - fromJSON(object: any): ExtensionRangeOptions_Declaration { - return { - number: isSet(object.number) ? globalThis.Number(object.number) : 0, - fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", - type: isSet(object.type) ? globalThis.String(object.type) : "", - reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, - repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, - }; - }, - - toJSON(message: ExtensionRangeOptions_Declaration): unknown { - const obj: any = {}; - if (message.number !== 0) { - obj.number = Math.round(message.number); - } - if (message.fullName !== "") { - obj.fullName = message.fullName; - } - if (message.type !== "") { - obj.type = message.type; - } - if (message.reserved === true) { - obj.reserved = message.reserved; - } - if (message.repeated === true) { - obj.repeated = message.repeated; - } - return obj; - }, - - create, I>>( - base?: I, - ): ExtensionRangeOptions_Declaration { - return ExtensionRangeOptions_Declaration.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>( - object: I, - ): ExtensionRangeOptions_Declaration { - const message = createBaseExtensionRangeOptions_Declaration(); - message.number = object.number ?? 0; - message.fullName = object.fullName ?? ""; - message.type = object.type ?? ""; - message.reserved = object.reserved ?? false; - message.repeated = object.repeated ?? false; return message; }, }; @@ -3706,7 +3011,6 @@ function createBaseFileOptions(): FileOptions { phpNamespace: "", phpMetadataNamespace: "", rubyPackage: "", - features: undefined, uninterpretedOption: [], }; } @@ -3773,9 +3077,6 @@ export const FileOptions = { if (message.rubyPackage !== "") { writer.uint32(362).string(message.rubyPackage); } - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(402).fork()).ldelim(); - } for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } @@ -3929,13 +3230,6 @@ export const FileOptions = { message.rubyPackage = reader.string(); continue; - case 50: - if (tag !== 402) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; case 999: if (tag !== 7994) { break; @@ -3976,7 +3270,6 @@ export const FileOptions = { phpNamespace: isSet(object.phpNamespace) ? globalThis.String(object.phpNamespace) : "", phpMetadataNamespace: isSet(object.phpMetadataNamespace) ? globalThis.String(object.phpMetadataNamespace) : "", rubyPackage: isSet(object.rubyPackage) ? globalThis.String(object.rubyPackage) : "", - features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], @@ -4045,9 +3338,6 @@ export const FileOptions = { if (message.rubyPackage !== "") { obj.rubyPackage = message.rubyPackage; } - if (message.features !== undefined) { - obj.features = FeatureSet.toJSON(message.features); - } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -4079,9 +3369,6 @@ export const FileOptions = { message.phpNamespace = object.phpNamespace ?? ""; message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; message.rubyPackage = object.rubyPackage ?? ""; - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -4094,7 +3381,6 @@ function createBaseMessageOptions(): MessageOptions { deprecated: false, mapEntry: false, deprecatedLegacyJsonFieldConflicts: false, - features: undefined, uninterpretedOption: [], }; } @@ -4116,9 +3402,6 @@ export const MessageOptions = { if (message.deprecatedLegacyJsonFieldConflicts === true) { writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); } - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(98).fork()).ldelim(); - } for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } @@ -4167,13 +3450,6 @@ export const MessageOptions = { message.deprecatedLegacyJsonFieldConflicts = reader.bool(); continue; - case 12: - if (tag !== 98) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; case 999: if (tag !== 7994) { break; @@ -4203,7 +3479,6 @@ export const MessageOptions = { deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) : false, - features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], @@ -4227,9 +3502,6 @@ export const MessageOptions = { if (message.deprecatedLegacyJsonFieldConflicts === true) { obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; } - if (message.features !== undefined) { - obj.features = FeatureSet.toJSON(message.features); - } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -4246,9 +3518,6 @@ export const MessageOptions = { message.deprecated = object.deprecated ?? false; message.mapEntry = object.mapEntry ?? false; message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -4265,9 +3534,7 @@ function createBaseFieldOptions(): FieldOptions { weak: false, debugRedact: false, retention: 0, - targets: [], - editionDefaults: [], - features: undefined, + target: 0, uninterpretedOption: [], }; } @@ -4301,16 +3568,8 @@ export const FieldOptions = { if (message.retention !== 0) { writer.uint32(136).int32(message.retention); } - writer.uint32(154).fork(); - for (const v of message.targets) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.editionDefaults) { - FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).ldelim(); - } - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(170).fork()).ldelim(); + if (message.target !== 0) { + writer.uint32(144).int32(message.target); } for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); @@ -4388,36 +3647,12 @@ export const FieldOptions = { message.retention = reader.int32() as any; continue; - case 19: - if (tag === 152) { - message.targets.push(reader.int32() as any); - - continue; - } - - if (tag === 154) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.targets.push(reader.int32() as any); - } - - continue; - } - - break; - case 20: - if (tag !== 162) { - break; - } - - message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); - continue; - case 21: - if (tag !== 170) { + case 18: + if (tag !== 144) { break; } - message.features = FeatureSet.decode(reader, reader.uint32()); + message.target = reader.int32() as any; continue; case 999: if (tag !== 7994) { @@ -4446,13 +3681,7 @@ export const FieldOptions = { weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, retention: isSet(object.retention) ? fieldOptions_OptionRetentionFromJSON(object.retention) : 0, - targets: globalThis.Array.isArray(object?.targets) - ? object.targets.map((e: any) => fieldOptions_OptionTargetTypeFromJSON(e)) - : [], - editionDefaults: globalThis.Array.isArray(object?.editionDefaults) - ? object.editionDefaults.map((e: any) => FieldOptions_EditionDefault.fromJSON(e)) - : [], - features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + target: isSet(object.target) ? fieldOptions_OptionTargetTypeFromJSON(object.target) : 0, uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], @@ -4488,14 +3717,8 @@ export const FieldOptions = { if (message.retention !== 0) { obj.retention = fieldOptions_OptionRetentionToJSON(message.retention); } - if (message.targets?.length) { - obj.targets = message.targets.map((e) => fieldOptions_OptionTargetTypeToJSON(e)); - } - if (message.editionDefaults?.length) { - obj.editionDefaults = message.editionDefaults.map((e) => FieldOptions_EditionDefault.toJSON(e)); - } - if (message.features !== undefined) { - obj.features = FeatureSet.toJSON(message.features); + if (message.target !== 0) { + obj.target = fieldOptions_OptionTargetTypeToJSON(message.target); } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); @@ -4517,99 +3740,18 @@ export const FieldOptions = { message.weak = object.weak ?? false; message.debugRedact = object.debugRedact ?? false; message.retention = object.retention ?? 0; - message.targets = object.targets?.map((e) => e) || []; - message.editionDefaults = object.editionDefaults?.map((e) => FieldOptions_EditionDefault.fromPartial(e)) || []; - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; + message.target = object.target ?? 0; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; -function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { - return { edition: 0, value: "" }; -} - -export const FieldOptions_EditionDefault = { - encode(message: FieldOptions_EditionDefault, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.edition !== 0) { - writer.uint32(24).int32(message.edition); - } - if (message.value !== "") { - writer.uint32(18).string(message.value); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): FieldOptions_EditionDefault { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFieldOptions_EditionDefault(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 3: - if (tag !== 24) { - break; - } - - message.edition = reader.int32() as any; - continue; - case 2: - if (tag !== 18) { - break; - } - - message.value = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - - fromJSON(object: any): FieldOptions_EditionDefault { - return { - edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, - value: isSet(object.value) ? globalThis.String(object.value) : "", - }; - }, - - toJSON(message: FieldOptions_EditionDefault): unknown { - const obj: any = {}; - if (message.edition !== 0) { - obj.edition = editionToJSON(message.edition); - } - if (message.value !== "") { - obj.value = message.value; - } - return obj; - }, - - create, I>>(base?: I): FieldOptions_EditionDefault { - return FieldOptions_EditionDefault.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): FieldOptions_EditionDefault { - const message = createBaseFieldOptions_EditionDefault(); - message.edition = object.edition ?? 0; - message.value = object.value ?? ""; - return message; - }, -}; - function createBaseOneofOptions(): OneofOptions { - return { features: undefined, uninterpretedOption: [] }; + return { uninterpretedOption: [] }; } export const OneofOptions = { encode(message: OneofOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(10).fork()).ldelim(); - } for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } @@ -4623,13 +3765,6 @@ export const OneofOptions = { while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; case 999: if (tag !== 7994) { break; @@ -4648,7 +3783,6 @@ export const OneofOptions = { fromJSON(object: any): OneofOptions { return { - features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], @@ -4657,9 +3791,6 @@ export const OneofOptions = { toJSON(message: OneofOptions): unknown { const obj: any = {}; - if (message.features !== undefined) { - obj.features = FeatureSet.toJSON(message.features); - } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -4671,22 +3802,13 @@ export const OneofOptions = { }, fromPartial, I>>(object: I): OneofOptions { const message = createBaseOneofOptions(); - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumOptions(): EnumOptions { - return { - allowAlias: false, - deprecated: false, - deprecatedLegacyJsonFieldConflicts: false, - features: undefined, - uninterpretedOption: [], - }; + return { allowAlias: false, deprecated: false, deprecatedLegacyJsonFieldConflicts: false, uninterpretedOption: [] }; } export const EnumOptions = { @@ -4700,9 +3822,6 @@ export const EnumOptions = { if (message.deprecatedLegacyJsonFieldConflicts === true) { writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); } - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(58).fork()).ldelim(); - } for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } @@ -4737,13 +3856,6 @@ export const EnumOptions = { message.deprecatedLegacyJsonFieldConflicts = reader.bool(); continue; - case 7: - if (tag !== 58) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; case 999: if (tag !== 7994) { break; @@ -4767,7 +3879,6 @@ export const EnumOptions = { deprecatedLegacyJsonFieldConflicts: isSet(object.deprecatedLegacyJsonFieldConflicts) ? globalThis.Boolean(object.deprecatedLegacyJsonFieldConflicts) : false, - features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], @@ -4785,9 +3896,6 @@ export const EnumOptions = { if (message.deprecatedLegacyJsonFieldConflicts === true) { obj.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; } - if (message.features !== undefined) { - obj.features = FeatureSet.toJSON(message.features); - } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -4802,16 +3910,13 @@ export const EnumOptions = { message.allowAlias = object.allowAlias ?? false; message.deprecated = object.deprecated ?? false; message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseEnumValueOptions(): EnumValueOptions { - return { deprecated: false, features: undefined, debugRedact: false, uninterpretedOption: [] }; + return { deprecated: false, uninterpretedOption: [] }; } export const EnumValueOptions = { @@ -4819,12 +3924,6 @@ export const EnumValueOptions = { if (message.deprecated === true) { writer.uint32(8).bool(message.deprecated); } - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(18).fork()).ldelim(); - } - if (message.debugRedact === true) { - writer.uint32(24).bool(message.debugRedact); - } for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } @@ -4845,20 +3944,6 @@ export const EnumValueOptions = { message.deprecated = reader.bool(); continue; - case 2: - if (tag !== 18) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 24) { - break; - } - - message.debugRedact = reader.bool(); - continue; case 999: if (tag !== 7994) { break; @@ -4878,8 +3963,6 @@ export const EnumValueOptions = { fromJSON(object: any): EnumValueOptions { return { deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, - features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, - debugRedact: isSet(object.debugRedact) ? globalThis.Boolean(object.debugRedact) : false, uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], @@ -4891,12 +3974,6 @@ export const EnumValueOptions = { if (message.deprecated === true) { obj.deprecated = message.deprecated; } - if (message.features !== undefined) { - obj.features = FeatureSet.toJSON(message.features); - } - if (message.debugRedact === true) { - obj.debugRedact = message.debugRedact; - } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -4909,24 +3986,17 @@ export const EnumValueOptions = { fromPartial, I>>(object: I): EnumValueOptions { const message = createBaseEnumValueOptions(); message.deprecated = object.deprecated ?? false; - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; - message.debugRedact = object.debugRedact ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, }; function createBaseServiceOptions(): ServiceOptions { - return { features: undefined, deprecated: false, uninterpretedOption: [] }; + return { deprecated: false, uninterpretedOption: [] }; } export const ServiceOptions = { encode(message: ServiceOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(274).fork()).ldelim(); - } if (message.deprecated === true) { writer.uint32(264).bool(message.deprecated); } @@ -4943,13 +4013,6 @@ export const ServiceOptions = { while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { - case 34: - if (tag !== 274) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; case 33: if (tag !== 264) { break; @@ -4975,7 +4038,6 @@ export const ServiceOptions = { fromJSON(object: any): ServiceOptions { return { - features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) @@ -4985,9 +4047,6 @@ export const ServiceOptions = { toJSON(message: ServiceOptions): unknown { const obj: any = {}; - if (message.features !== undefined) { - obj.features = FeatureSet.toJSON(message.features); - } if (message.deprecated === true) { obj.deprecated = message.deprecated; } @@ -5002,9 +4061,6 @@ export const ServiceOptions = { }, fromPartial, I>>(object: I): ServiceOptions { const message = createBaseServiceOptions(); - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; message.deprecated = object.deprecated ?? false; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; @@ -5012,7 +4068,7 @@ export const ServiceOptions = { }; function createBaseMethodOptions(): MethodOptions { - return { deprecated: false, idempotencyLevel: 0, features: undefined, uninterpretedOption: [] }; + return { deprecated: false, idempotencyLevel: 0, uninterpretedOption: [] }; } export const MethodOptions = { @@ -5023,9 +4079,6 @@ export const MethodOptions = { if (message.idempotencyLevel !== 0) { writer.uint32(272).int32(message.idempotencyLevel); } - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(282).fork()).ldelim(); - } for (const v of message.uninterpretedOption) { UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); } @@ -5053,13 +4106,6 @@ export const MethodOptions = { message.idempotencyLevel = reader.int32() as any; continue; - case 35: - if (tag !== 282) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; case 999: if (tag !== 7994) { break; @@ -5082,7 +4128,6 @@ export const MethodOptions = { idempotencyLevel: isSet(object.idempotencyLevel) ? methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel) : 0, - features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, uninterpretedOption: globalThis.Array.isArray(object?.uninterpretedOption) ? object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)) : [], @@ -5097,9 +4142,6 @@ export const MethodOptions = { if (message.idempotencyLevel !== 0) { obj.idempotencyLevel = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); } - if (message.features !== undefined) { - obj.features = FeatureSet.toJSON(message.features); - } if (message.uninterpretedOption?.length) { obj.uninterpretedOption = message.uninterpretedOption.map((e) => UninterpretedOption.toJSON(e)); } @@ -5113,9 +4155,6 @@ export const MethodOptions = { const message = createBaseMethodOptions(); message.deprecated = object.deprecated ?? false; message.idempotencyLevel = object.idempotencyLevel ?? 0; - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; message.uninterpretedOption = object.uninterpretedOption?.map((e) => UninterpretedOption.fromPartial(e)) || []; return message; }, @@ -5354,320 +4393,6 @@ export const UninterpretedOption_NamePart = { }, }; -function createBaseFeatureSet(): FeatureSet { - return { - fieldPresence: 0, - enumType: 0, - repeatedFieldEncoding: 0, - utf8Validation: 0, - messageEncoding: 0, - jsonFormat: 0, - }; -} - -export const FeatureSet = { - encode(message: FeatureSet, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.fieldPresence !== 0) { - writer.uint32(8).int32(message.fieldPresence); - } - if (message.enumType !== 0) { - writer.uint32(16).int32(message.enumType); - } - if (message.repeatedFieldEncoding !== 0) { - writer.uint32(24).int32(message.repeatedFieldEncoding); - } - if (message.utf8Validation !== 0) { - writer.uint32(32).int32(message.utf8Validation); - } - if (message.messageEncoding !== 0) { - writer.uint32(40).int32(message.messageEncoding); - } - if (message.jsonFormat !== 0) { - writer.uint32(48).int32(message.jsonFormat); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): FeatureSet { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFeatureSet(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - - message.fieldPresence = reader.int32() as any; - continue; - case 2: - if (tag !== 16) { - break; - } - - message.enumType = reader.int32() as any; - continue; - case 3: - if (tag !== 24) { - break; - } - - message.repeatedFieldEncoding = reader.int32() as any; - continue; - case 4: - if (tag !== 32) { - break; - } - - message.utf8Validation = reader.int32() as any; - continue; - case 5: - if (tag !== 40) { - break; - } - - message.messageEncoding = reader.int32() as any; - continue; - case 6: - if (tag !== 48) { - break; - } - - message.jsonFormat = reader.int32() as any; - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - - fromJSON(object: any): FeatureSet { - return { - fieldPresence: isSet(object.fieldPresence) ? featureSet_FieldPresenceFromJSON(object.fieldPresence) : 0, - enumType: isSet(object.enumType) ? featureSet_EnumTypeFromJSON(object.enumType) : 0, - repeatedFieldEncoding: isSet(object.repeatedFieldEncoding) - ? featureSet_RepeatedFieldEncodingFromJSON(object.repeatedFieldEncoding) - : 0, - utf8Validation: isSet(object.utf8Validation) ? featureSet_Utf8ValidationFromJSON(object.utf8Validation) : 0, - messageEncoding: isSet(object.messageEncoding) ? featureSet_MessageEncodingFromJSON(object.messageEncoding) : 0, - jsonFormat: isSet(object.jsonFormat) ? featureSet_JsonFormatFromJSON(object.jsonFormat) : 0, - }; - }, - - toJSON(message: FeatureSet): unknown { - const obj: any = {}; - if (message.fieldPresence !== 0) { - obj.fieldPresence = featureSet_FieldPresenceToJSON(message.fieldPresence); - } - if (message.enumType !== 0) { - obj.enumType = featureSet_EnumTypeToJSON(message.enumType); - } - if (message.repeatedFieldEncoding !== 0) { - obj.repeatedFieldEncoding = featureSet_RepeatedFieldEncodingToJSON(message.repeatedFieldEncoding); - } - if (message.utf8Validation !== 0) { - obj.utf8Validation = featureSet_Utf8ValidationToJSON(message.utf8Validation); - } - if (message.messageEncoding !== 0) { - obj.messageEncoding = featureSet_MessageEncodingToJSON(message.messageEncoding); - } - if (message.jsonFormat !== 0) { - obj.jsonFormat = featureSet_JsonFormatToJSON(message.jsonFormat); - } - return obj; - }, - - create, I>>(base?: I): FeatureSet { - return FeatureSet.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): FeatureSet { - const message = createBaseFeatureSet(); - message.fieldPresence = object.fieldPresence ?? 0; - message.enumType = object.enumType ?? 0; - message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 0; - message.utf8Validation = object.utf8Validation ?? 0; - message.messageEncoding = object.messageEncoding ?? 0; - message.jsonFormat = object.jsonFormat ?? 0; - return message; - }, -}; - -function createBaseFeatureSetDefaults(): FeatureSetDefaults { - return { defaults: [], minimumEdition: 0, maximumEdition: 0 }; -} - -export const FeatureSetDefaults = { - encode(message: FeatureSetDefaults, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.defaults) { - FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).ldelim(); - } - if (message.minimumEdition !== 0) { - writer.uint32(32).int32(message.minimumEdition); - } - if (message.maximumEdition !== 0) { - writer.uint32(40).int32(message.maximumEdition); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): FeatureSetDefaults { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFeatureSetDefaults(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - - message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); - continue; - case 4: - if (tag !== 32) { - break; - } - - message.minimumEdition = reader.int32() as any; - continue; - case 5: - if (tag !== 40) { - break; - } - - message.maximumEdition = reader.int32() as any; - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - - fromJSON(object: any): FeatureSetDefaults { - return { - defaults: globalThis.Array.isArray(object?.defaults) - ? object.defaults.map((e: any) => FeatureSetDefaults_FeatureSetEditionDefault.fromJSON(e)) - : [], - minimumEdition: isSet(object.minimumEdition) ? editionFromJSON(object.minimumEdition) : 0, - maximumEdition: isSet(object.maximumEdition) ? editionFromJSON(object.maximumEdition) : 0, - }; - }, - - toJSON(message: FeatureSetDefaults): unknown { - const obj: any = {}; - if (message.defaults?.length) { - obj.defaults = message.defaults.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.toJSON(e)); - } - if (message.minimumEdition !== 0) { - obj.minimumEdition = editionToJSON(message.minimumEdition); - } - if (message.maximumEdition !== 0) { - obj.maximumEdition = editionToJSON(message.maximumEdition); - } - return obj; - }, - - create, I>>(base?: I): FeatureSetDefaults { - return FeatureSetDefaults.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>(object: I): FeatureSetDefaults { - const message = createBaseFeatureSetDefaults(); - message.defaults = object.defaults?.map((e) => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; - message.minimumEdition = object.minimumEdition ?? 0; - message.maximumEdition = object.maximumEdition ?? 0; - return message; - }, -}; - -function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { - return { edition: 0, features: undefined }; -} - -export const FeatureSetDefaults_FeatureSetEditionDefault = { - encode(message: FeatureSetDefaults_FeatureSetEditionDefault, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.edition !== 0) { - writer.uint32(24).int32(message.edition); - } - if (message.features !== undefined) { - FeatureSet.encode(message.features, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 3: - if (tag !== 24) { - break; - } - - message.edition = reader.int32() as any; - continue; - case 2: - if (tag !== 18) { - break; - } - - message.features = FeatureSet.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - - fromJSON(object: any): FeatureSetDefaults_FeatureSetEditionDefault { - return { - edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, - features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, - }; - }, - - toJSON(message: FeatureSetDefaults_FeatureSetEditionDefault): unknown { - const obj: any = {}; - if (message.edition !== 0) { - obj.edition = editionToJSON(message.edition); - } - if (message.features !== undefined) { - obj.features = FeatureSet.toJSON(message.features); - } - return obj; - }, - - create, I>>( - base?: I, - ): FeatureSetDefaults_FeatureSetEditionDefault { - return FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(base ?? ({} as any)); - }, - fromPartial, I>>( - object: I, - ): FeatureSetDefaults_FeatureSetEditionDefault { - const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); - message.edition = object.edition ?? 0; - message.features = (object.features !== undefined && object.features !== null) - ? FeatureSet.fromPartial(object.features) - : undefined; - return message; - }, -}; - function createBaseSourceCodeInfo(): SourceCodeInfo { return { location: [] }; } diff --git a/packages/contracts-clients/nft-launchpad/NftLaunchpad.types.ts b/packages/contracts-clients/nft-launchpad/NftLaunchpad.types.ts index 9f0b37c279..fc46bdc0f2 100644 --- a/packages/contracts-clients/nft-launchpad/NftLaunchpad.types.ts +++ b/packages/contracts-clients/nft-launchpad/NftLaunchpad.types.ts @@ -14,6 +14,7 @@ export interface Config { name: string; nft_code_id: number; owner: Addr; + proposal_single_contract: Addr; } export type ExecuteMsg = { update_config: { @@ -43,6 +44,7 @@ export interface ConfigChanges { name?: string | null; nft_code_id?: number | null; owner?: string | null; + proposal_single_contract?: string | null; } export interface CollectionProject { artwork_desc: string; diff --git a/packages/networks/features.ts b/packages/networks/features.ts index 0a4721375f..537abdfcd2 100644 --- a/packages/networks/features.ts +++ b/packages/networks/features.ts @@ -58,6 +58,7 @@ const zodCosmWasmNFTLaunchpad = z.object({ launchpadEndpoint: z.string(), codeId: z.number(), nftTr721CodeId: z.number(), + daoProposalSingleContractAddress: z.string(), }); export type CosmWasmNFTLaunchpad = z.infer; diff --git a/packages/networks/teritori-localnet/index.ts b/packages/networks/teritori-localnet/index.ts index d6ba71562e..1a3b23b259 100644 --- a/packages/networks/teritori-localnet/index.ts +++ b/packages/networks/teritori-localnet/index.ts @@ -1,10 +1,21 @@ import { teritoriLocalnetCurrencies } from "./currencies"; +import { CosmWasmNFTLaunchpad } from "../features"; import { NetworkFeature, NetworkInfo, NetworkKind } from "../types"; const nameServiceContractAddress = ""; const riotContractAddressGen1 = ""; +const cosmwasmNftLaunchpadFeature: CosmWasmNFTLaunchpad = { + type: NetworkFeature.CosmWasmNFTLaunchpad, + launchpadContractAddress: "", + launchpadEndpoint: "http://localhost:9090", + nftTr721CodeId: 0, + codeId: 0, + defaultMintDenom: "utori", + daoProposalSingleContractAddress: "", +}; + export const teritoriLocalnetNetwork: NetworkInfo = { id: "teritori-localnet", kind: NetworkKind.Cosmos, @@ -23,6 +34,7 @@ export const teritoriLocalnetNetwork: NetworkInfo = { NetworkFeature.RiotP2E, NetworkFeature.NFTMarketplaceLeaderboard, ], + featureObjects: [cosmwasmNftLaunchpadFeature], currencies: teritoriLocalnetCurrencies, txExplorer: "", accountExplorer: "", diff --git a/packages/networks/teritori-testnet/index.ts b/packages/networks/teritori-testnet/index.ts index e2559c7f6e..9cd7d843e0 100644 --- a/packages/networks/teritori-testnet/index.ts +++ b/packages/networks/teritori-testnet/index.ts @@ -37,8 +37,10 @@ const cosmwasmNftLaunchpadFeature: CosmWasmNFTLaunchpad = { "tori1te7ku4de0k4rl8lhyuvpmhygaq7k7vy5zpsjq9y638efxsnx3aaqck2utf", launchpadEndpoint: "https://dapp-backend.testnet.teritori.com", nftTr721CodeId: 60, - codeId: 71, + codeId: 93, defaultMintDenom: "utori", + daoProposalSingleContractAddress: + "tori1kprr6paf06nhwavaduasdeh7cs8z90mwg7w783kluya7aachndkqes2s7x", }; const rakkiFeature: CosmWasmRakki = { diff --git a/packages/screens/Organizations/components/MembershipOrg/MembershipDeployerSteps.tsx b/packages/screens/Organizations/components/MembershipOrg/MembershipDeployerSteps.tsx index 1a4b680cef..2e3ec6bac9 100644 --- a/packages/screens/Organizations/components/MembershipOrg/MembershipDeployerSteps.tsx +++ b/packages/screens/Organizations/components/MembershipOrg/MembershipDeployerSteps.tsx @@ -8,6 +8,7 @@ import { LaunchingOrganizationSection } from "../LaunchingOrganizationSection"; import { ConfigureVotingSection } from "@/components/dao/ConfigureVotingSection"; import { useFeedbacks } from "@/context/FeedbacksProvider"; +import { TeritoriNameServiceClient } from "@/contracts-clients/teritori-name-service/TeritoriNameService.client"; import { nsNameInfoQueryKey } from "@/hooks/useNSNameInfo"; import useSelectedWallet from "@/hooks/useSelectedWallet"; import { @@ -16,6 +17,7 @@ import { mustGetCosmosNetwork, NetworkKind, } from "@/networks"; +import { getKeplrSigningCosmWasmClient } from "@/networks/signer"; import { createDaoMemberBased, CreateDaoMemberBasedParams } from "@/utils/dao"; import { adenaDeployGnoDAO } from "@/utils/gnodao/deploy"; import { getDuration, getPercent } from "@/utils/gnodao/helpers"; @@ -100,8 +102,23 @@ export const MembershipDeployerSteps: React.FC<{ network.cwAdminFactoryContractAddress!; const walletAddress = selectedWallet.address; + const signingCosmWasmClient = + await getKeplrSigningCosmWasmClient(networkId); + + if (!network.nameServiceContractAddress) { + throw new Error("no name service contract address"); + } + + const nameServiceClient = new TeritoriNameServiceClient( + signingCosmWasmClient, + walletAddress, + network.nameServiceContractAddress, + ); + if (!memberSettingsFormData) return false; const params: CreateDaoMemberBasedParams = { + signingCosmWasmClient, + nameServiceClient, networkId, sender: walletAddress, contractAddress: cwAdminFactoryContractAddress, diff --git a/packages/screens/Organizations/components/RolesOrg/RolesDeployerSteps.tsx b/packages/screens/Organizations/components/RolesOrg/RolesDeployerSteps.tsx index bd6b04d754..fa756e7ea4 100644 --- a/packages/screens/Organizations/components/RolesOrg/RolesDeployerSteps.tsx +++ b/packages/screens/Organizations/components/RolesOrg/RolesDeployerSteps.tsx @@ -9,6 +9,7 @@ import { LaunchingOrganizationSection } from "../LaunchingOrganizationSection"; import { ConfigureVotingSection } from "@/components/dao/ConfigureVotingSection"; import { useFeedbacks } from "@/context/FeedbacksProvider"; +import { TeritoriNameServiceClient } from "@/contracts-clients/teritori-name-service/TeritoriNameService.client"; import { nsNameInfoQueryKey } from "@/hooks/useNSNameInfo"; import useSelectedWallet from "@/hooks/useSelectedWallet"; import { @@ -17,6 +18,7 @@ import { mustGetCosmosNetwork, NetworkKind, } from "@/networks"; +import { getKeplrSigningCosmWasmClient } from "@/networks/signer"; import { createDaoMemberBased, CreateDaoMemberBasedParams } from "@/utils/dao"; import { adenaDeployGnoDAO } from "@/utils/gnodao/deploy"; import { getDuration, getPercent } from "@/utils/gnodao/helpers"; @@ -113,8 +115,23 @@ export const RolesDeployerSteps: React.FC<{ network.cwAdminFactoryContractAddress!; const walletAddress = selectedWallet.address; + const signingCosmWasmClient = + await getKeplrSigningCosmWasmClient(networkId); + + if (!network.nameServiceContractAddress) { + throw new Error("no name service contract address"); + } + + const nameServiceClient = new TeritoriNameServiceClient( + signingCosmWasmClient, + walletAddress, + network.nameServiceContractAddress, + ); + if (!memberSettingsFormData) return false; const params: CreateDaoMemberBasedParams = { + signingCosmWasmClient, + nameServiceClient, networkId, sender: walletAddress, contractAddress: cwAdminFactoryContractAddress, diff --git a/packages/scripts/integration-testing/da0da0Test.ts b/packages/scripts/integration-testing/da0da0Test.ts index 4661732771..45821d264a 100644 --- a/packages/scripts/integration-testing/da0da0Test.ts +++ b/packages/scripts/integration-testing/da0da0Test.ts @@ -3,8 +3,7 @@ import fs from "fs/promises"; import { buildCosmos, startCosmosLocalnet } from "./cosmos"; import { teritoriLocalnetNetwork } from "../../networks/teritori-localnet"; - -import { deployDA0DA0 } from "@/scripts/network-setup/deployDA0DA0"; +import { deployDA0DA0 } from "../network-setup/dao-dao/deployDA0DA0"; const main = async () => { program.argument( @@ -23,11 +22,11 @@ const main = async () => { // test cosmwasm - await deployDA0DA0( - { binaryPath: binary, home, signer: admSigner }, - teritoriLocalnetNetwork.id, - "testnet-adm", - ); + await deployDA0DA0({ + opts: { binaryPath: binary, home, signer: admSigner }, + networkId: teritoriLocalnetNetwork.id, + wallet: "testnet-adm", + }); // clean diff --git a/packages/scripts/integration-testing/simpleTest.ts b/packages/scripts/integration-testing/simpleTest.ts index 55115c2726..f2fa02b818 100644 --- a/packages/scripts/integration-testing/simpleTest.ts +++ b/packages/scripts/integration-testing/simpleTest.ts @@ -20,18 +20,12 @@ const main = async () => { throw new Error("adm signer is undefined"); } - // test cosmwasm - await deployTeritoriEcosystem( { binaryPath: binary, home, signer: admSigner }, teritoriLocalnetNetwork.id, "testnet-adm", ); - - // clean - await kill(); - await fs.rm(home, { recursive: true, force: true }); }; diff --git a/packages/scripts/network-setup/deployCwAddressList.ts b/packages/scripts/network-setup/cw-address-list/deployCwAddressList.ts similarity index 75% rename from packages/scripts/network-setup/deployCwAddressList.ts rename to packages/scripts/network-setup/cw-address-list/deployCwAddressList.ts index 0d77f89cbc..4d5d19d0d1 100644 --- a/packages/scripts/network-setup/deployCwAddressList.ts +++ b/packages/scripts/network-setup/cw-address-list/deployCwAddressList.ts @@ -1,7 +1,5 @@ import { bech32 } from "bech32"; -import { program } from "commander"; import { cloneDeep } from "lodash"; -import os from "os"; import path from "path"; import { @@ -16,7 +14,7 @@ import { storeWASM, } from "@/scripts/network-setup/deployLib"; -const deployCwAddressList = async ({ +export const deployCwAddressList = async ({ opts, networkId, wallet, @@ -58,14 +56,14 @@ const deployCwAddressList = async ({ __dirname, "cw_address_list.wasm", ); - network.cwAdminFactoryCodeId = await storeWASM( + network.cwAddressListCodeId = await storeWASM( opts, wallet, network, cwAddressListWasmFilePath, ); - console.log("Instantiating cw address list", network.cwAdminFactoryCodeId); + console.log("Instantiating cw address list", network.cwAddressListCodeId); nftMarketplaceFeature.cwAddressListContractAddress = await instantiateCwAddressList(opts, wallet, walletAddr, network); @@ -83,7 +81,7 @@ const instantiateCwAddressList = async ( adminAddr: string, network: CosmosNetworkInfo, ) => { - const codeId = network.cwAdminFactoryCodeId; + const codeId = network.cwAddressListCodeId; if (!codeId) { throw new Error("CW Address List code ID not found"); } @@ -97,23 +95,3 @@ const instantiateCwAddressList = async ( {}, ); }; - -const main = async () => { - program.argument("", "Network id to deploy to"); - program.argument("", "Wallet to deploy from"); - program.option("--keyring-backend [keyring-backend]", "Keyring backend"); - program.parse(); - const [networkId, wallet] = program.args; - const { keyringBackend } = program.opts(); - - await deployCwAddressList({ - opts: { - home: path.join(os.homedir(), ".teritorid"), - binaryPath: "teritorid", - keyringBackend, - }, - networkId, - wallet, - }); -}; -main(); diff --git a/packages/scripts/network-setup/cw-address-list/deployCwAddressListScript.ts b/packages/scripts/network-setup/cw-address-list/deployCwAddressListScript.ts new file mode 100644 index 0000000000..467bcd5d8d --- /dev/null +++ b/packages/scripts/network-setup/cw-address-list/deployCwAddressListScript.ts @@ -0,0 +1,25 @@ +import { program } from "commander"; +import os from "os"; +import path from "path"; + +import { deployCwAddressList } from "./deployCwAddressList"; + +const main = async () => { + program.argument("", "Network id to deploy to"); + program.argument("", "Wallet to deploy from"); + program.option("--keyring-backend [keyring-backend]", "Keyring backend"); + program.parse(); + const [networkId, wallet] = program.args; + const { keyringBackend } = program.opts(); + + await deployCwAddressList({ + opts: { + home: path.join(os.homedir(), ".teritorid"), + binaryPath: "teritorid", + keyringBackend, + }, + networkId, + wallet, + }); +}; +main(); diff --git a/packages/scripts/network-setup/cw-admin-factory/deployCwAdminFactory.ts b/packages/scripts/network-setup/cw-admin-factory/deployCwAdminFactory.ts new file mode 100644 index 0000000000..f10ebbddef --- /dev/null +++ b/packages/scripts/network-setup/cw-admin-factory/deployCwAdminFactory.ts @@ -0,0 +1,68 @@ +import path from "path"; + +import { CosmosNetworkInfo } from "@/networks"; +import { + instantiateContract, + storeWASM, + initDeploy, +} from "@/scripts/network-setup/deployLib"; + +export const deployCwAdminFactory = async ({ + opts, + networkId, + wallet, +}: { + networkId: string; + wallet: string; + opts: { home: string; binaryPath: string; keyringBackend?: string }; +}) => { + const { network, walletAddr: deployerWalletAddress } = await initDeploy({ + opts, + networkId, + wallet, + }); + + console.log("Storing CW Admin Factory"); + const nftLaunchpadWasmFilePath = path.join( + __dirname, + "../../../artifacts/cw_admin_factory.wasm", + ); + network.cwAdminFactoryCodeId = await storeWASM( + opts, + wallet, + network, + nftLaunchpadWasmFilePath, + ); + + console.log("Instantiating CW Admin Factory", network.cwAdminFactoryCodeId); + network.cwAdminFactoryContractAddress = await instantiateCwAdminFactory( + opts, + wallet, + deployerWalletAddress, + network, + ); + + console.log(JSON.stringify(network, null, 2)); + return network; +}; + +const instantiateCwAdminFactory = async ( + opts: { home: string; binaryPath: string; keyringBackend?: string }, + wallet: string, + adminAddr: string, + network: CosmosNetworkInfo, +) => { + const codeId = network.cwAdminFactoryCodeId; + if (!codeId) { + throw new Error("CW Admin Factory code ID not found"); + } + return await instantiateContract( + opts, + wallet, + network, + codeId, + adminAddr, + "Teritori CW Admin Factory", + {}, + ); +}; diff --git a/packages/scripts/network-setup/cw-admin-factory/deployCwAdminFactoryScript.ts b/packages/scripts/network-setup/cw-admin-factory/deployCwAdminFactoryScript.ts new file mode 100644 index 0000000000..c26971aab3 --- /dev/null +++ b/packages/scripts/network-setup/cw-admin-factory/deployCwAdminFactoryScript.ts @@ -0,0 +1,25 @@ +import { program } from "commander"; +import os from "os"; +import path from "path"; + +import { deployCwAdminFactory } from "./deployCwAdminFactory"; + +const main = async () => { + program.argument("", "Network id to deploy to"); + program.argument("", "Wallet to deploy from"); + program.option("--keyring-backend [keyring-backend]", "Keyring backend"); + program.parse(); + const [networkId, wallet] = program.args; + const { keyringBackend } = program.opts(); + + await deployCwAdminFactory({ + opts: { + home: path.join(os.homedir(), ".teritorid"), + binaryPath: "teritorid", + keyringBackend, + }, + networkId, + wallet, + }); +}; +main(); diff --git a/packages/scripts/network-setup/deployDA0DA0.ts b/packages/scripts/network-setup/dao-dao/deployDA0DA0.ts similarity index 72% rename from packages/scripts/network-setup/deployDA0DA0.ts rename to packages/scripts/network-setup/dao-dao/deployDA0DA0.ts index 074171b1d3..d1897dd409 100644 --- a/packages/scripts/network-setup/deployDA0DA0.ts +++ b/packages/scripts/network-setup/dao-dao/deployDA0DA0.ts @@ -1,7 +1,3 @@ -import axios from "axios"; -import { program } from "commander"; -import fs from "fs"; -import os from "os"; import path from "path"; import { @@ -9,10 +5,9 @@ import { initDeploy, instantiateContract, instantiateNameService, - registerTNSHandle, storeWASM, - testTeritoriEcosystem, -} from "./deployLib"; +} from "../deployLib"; +import { deployRemoteWASM } from "../deployRemoteWASM"; import { CosmosNetworkInfo } from "@/networks"; @@ -22,13 +17,17 @@ import { CosmosNetworkInfo } from "@/networks"; * Store these binaries * And deploy cw_admin_factory contract */ -export const deployDA0DA0 = async ( +export const deployDA0DA0 = async ({ + opts, + networkId, + wallet, +}: { opts: DeployOpts & { keyringBackend?: string; - }, - networkId: string, - wallet: string, -) => { + }; + networkId: string; + wallet: string; +}) => { const cosmWasmCwPlusVersion = "v1.1.0"; const cosmWasmCwPlusBinariesPath = `https://github.com/CosmWasm/cw-plus/releases/download/${cosmWasmCwPlusVersion}`; const cw4GroupWasmFileName = "cw4_group.wasm"; @@ -124,12 +123,6 @@ export const deployDA0DA0 = async ( ); console.log(JSON.stringify(network, null, 2)); - - if (opts.signer) { - await registerTNSHandle(network, opts.signer); - await testTeritoriEcosystem(network); - } - return network; }; @@ -153,42 +146,3 @@ const instantiateCwAdminFactory = async ( {}, ); }; - -const deployRemoteWASM = async ( - opts: DeployOpts, - wallet: string, - network: CosmosNetworkInfo, - url: string, - name: string, -) => { - console.log(`Fetching ${url}`); - const contractsDir = path.join(opts.home, "remote-wasm"); - fs.mkdirSync(contractsDir, { recursive: true }); - const filePath = path.join(contractsDir, name); - const response = await axios.get(url, { responseType: "stream" }); - const fileStream = fs.createWriteStream(filePath); - await response.data.pipe(fileStream); - console.log(`Storing ${filePath}`); - return await storeWASM(opts, wallet, network, filePath); -}; - -const main = async () => { - program.argument("", "Network id to deploy to"); - program.argument("", "Wallet to deploy from"); - program.option("--keyring-backend [keyring-backend]", "Keyring backend"); - program.parse(); - const [networkId, wallet] = program.args; - const { keyringBackend } = program.opts(); - - await deployDA0DA0( - { - home: path.join(os.homedir(), ".teritorid"), - binaryPath: "teritorid", - keyringBackend, - signer: undefined, - }, - networkId, - wallet, - ); -}; -main(); diff --git a/packages/scripts/network-setup/dao-dao/deployDA0DA0Script.ts b/packages/scripts/network-setup/dao-dao/deployDA0DA0Script.ts new file mode 100644 index 0000000000..49e11ed9ce --- /dev/null +++ b/packages/scripts/network-setup/dao-dao/deployDA0DA0Script.ts @@ -0,0 +1,26 @@ +import { program } from "commander"; +import os from "os"; +import path from "path"; + +import { deployDA0DA0 } from "./deployDA0DA0"; + +const main = async () => { + program.argument("", "Network id to deploy to"); + program.argument("", "Wallet to deploy from"); + program.option("--keyring-backend [keyring-backend]", "Keyring backend"); + program.parse(); + const [networkId, wallet] = program.args; + const { keyringBackend } = program.opts(); + + await deployDA0DA0({ + opts: { + home: path.join(os.homedir(), ".teritorid"), + binaryPath: "teritorid", + keyringBackend, + signer: undefined, + }, + networkId, + wallet, + }); +}; +main(); diff --git a/packages/scripts/network-setup/dao-dao/utils.ts b/packages/scripts/network-setup/dao-dao/utils.ts new file mode 100644 index 0000000000..16333bff1e --- /dev/null +++ b/packages/scripts/network-setup/dao-dao/utils.ts @@ -0,0 +1,2 @@ +const daoDaoContractsVersion = "v2.2.0"; +export const daoDaoContractsBinariesPath = `https://github.com/DA0-DA0/dao-contracts/releases/download/${daoDaoContractsVersion}`; diff --git a/packages/scripts/network-setup/deployLib.ts b/packages/scripts/network-setup/deployLib.ts index ee0224f8ee..f3888120ca 100644 --- a/packages/scripts/network-setup/deployLib.ts +++ b/packages/scripts/network-setup/deployLib.ts @@ -6,6 +6,8 @@ import { bech32 } from "bech32"; import _, { cloneDeep } from "lodash"; import path from "path"; +import { deployDA0DA0 } from "./dao-dao/deployDA0DA0"; +import { deployNftLaunchpad } from "./nft-launchpad/deployNftLaunchpad"; import { InstantiateMsg as MarketplaceVaultInstantiateMsg } from "../../contracts-clients/nft-marketplace/NftMarketplace.types"; import { ExecuteMsg as NameServiceExecuteMsg, @@ -132,8 +134,22 @@ export const deployTeritoriEcosystem = async ( network, ); + console.log("Deploying DA0DA0 stuff"); + await deployDA0DA0({ opts, networkId, wallet }); + if (opts.signer) { - await registerTNSHandle(network, opts.signer); + const { signingCosmWasmClient, nameServiceClient } = + await registerTNSHandle(network, opts.signer); + + console.log("Deploying NFT Launchpad"); + await deployNftLaunchpad({ + opts, + networkId, + wallet, + signingCosmWasmClient, + nameServiceClient, + }); + await testTeritoriEcosystem(network); } @@ -160,7 +176,7 @@ const goldenMetadata: Metadata = { validator_operator_address: null, }; -export const registerTNSHandle = async ( +const registerTNSHandle = async ( network: CosmosNetworkInfo, signer: OfflineSigner, ) => { @@ -185,6 +201,8 @@ export const registerTNSHandle = async ( owner: senderAddress, }); console.log("✅ TNS handle registered"); + + return { signingCosmWasmClient: cosmWasmClient, nameServiceClient }; }; export const testTeritoriEcosystem = async (network: CosmosNetworkInfo) => { diff --git a/packages/scripts/network-setup/deployNftLaunchpad.ts b/packages/scripts/network-setup/deployNftLaunchpad.ts deleted file mode 100644 index cad793aeb3..0000000000 --- a/packages/scripts/network-setup/deployNftLaunchpad.ts +++ /dev/null @@ -1,164 +0,0 @@ -import { program } from "commander"; -import { cloneDeep } from "lodash"; -import os from "os"; -import path from "path"; - -import { InstantiateMsg as NftLaunchpadInstantiateMsg } from "@/contracts-clients/nft-launchpad"; -import { - CosmosNetworkInfo, - getNetworkFeature, - NetworkFeature, -} from "@/networks"; -import { CosmWasmNFTLaunchpad } from "@/networks/features"; -import { - DeployOpts, - initDeploy, - instantiateContract, - storeWASM, -} from "@/scripts/network-setup/deployLib"; - -const deployNftLaunchpad = async ({ - opts, - networkId, - wallet: deployerWallet, - launchpadAdmin, -}: { - networkId: string; - wallet: string; - launchpadAdmin: string; - opts: DeployOpts; -}) => { - const { network, walletAddr: deployerAddr } = await initDeploy({ - opts, - networkId, - wallet: deployerWallet, - }); - - const cosmwasmLaunchpadFeature = cloneDeep( - getNetworkFeature(networkId, NetworkFeature.CosmWasmNFTLaunchpad), - ); - if (!cosmwasmLaunchpadFeature) { - console.error(`Cosmwasm Launchpad feature not found on ${networkId}`); - process.exit(1); - } - console.log("Storing nft launchpad"); - const nftLaunchpadWasmFilePath = path.join(__dirname, "nft_launchpad.wasm"); - cosmwasmLaunchpadFeature.codeId = await storeWASM( - opts, - deployerWallet, - network, - nftLaunchpadWasmFilePath, - ); - - console.log("Instantiating nft launchpad", cosmwasmLaunchpadFeature.codeId); - cosmwasmLaunchpadFeature.launchpadContractAddress = - await instantiateNftLaunchpad( - opts, - deployerWallet, - deployerAddr, - launchpadAdmin, - network, - cosmwasmLaunchpadFeature, - ); - network.featureObjects = network.featureObjects?.map((featureObject) => { - if (featureObject.type === NetworkFeature.CosmWasmNFTLaunchpad) { - return cosmwasmLaunchpadFeature; - } else return featureObject; - }); -}; - -const instantiateNftLaunchpad = async ( - opts: DeployOpts, - deployerWallet: string, - deployerAddr: string, - launchpadAdmin: string, - network: CosmosNetworkInfo, - featureObject: CosmWasmNFTLaunchpad, -) => { - const codeId = featureObject.codeId; - if (!codeId) { - console.error("Nft Launchpad code ID not found"); - process.exit(1); - } - let nftCodeId = featureObject.nftTr721CodeId; - if (!nftCodeId) { - nftCodeId = await deployNftTr721({ - opts, - networkId: network.id, - deployerWallet, - }); - } - const instantiateMsg: NftLaunchpadInstantiateMsg = { - config: { - name: "Teritori NFT Launchpad", - owner: deployerAddr, - admin: launchpadAdmin, - nft_code_id: nftCodeId, - }, - }; - return await instantiateContract( - opts, - deployerWallet, - network, - codeId, - deployerAddr, - "Teritori NFT Launchpad", - instantiateMsg, - ); -}; - -const deployNftTr721 = async ({ - opts, - networkId, - deployerWallet, -}: { - networkId: string; - deployerWallet: string; - opts: DeployOpts; -}) => { - const { network } = await initDeploy({ - opts, - networkId, - wallet: deployerWallet, - }); - const cosmwasmLaunchpadFeature = cloneDeep( - getNetworkFeature(networkId, NetworkFeature.CosmWasmNFTLaunchpad), - ); - if (!cosmwasmLaunchpadFeature) { - console.error(`Cosmwasm Launchpad feature not found on ${networkId}`); - process.exit(1); - } - const nftTr721WasmFilePath = path.join(__dirname, "nft_tr721.wasm"); - cosmwasmLaunchpadFeature.nftTr721CodeId = await storeWASM( - opts, - deployerWallet, - network, - nftTr721WasmFilePath, - ); - return cosmwasmLaunchpadFeature.nftTr721CodeId; -}; - -const main = async () => { - program.argument("", "Network id to deploy to"); - program.argument("", "Wallet to deploy from"); - program.argument( - "", - "The DAO wallet adress to make admin things", - ); - program.option("--keyring-backend [keyring-backend]", "Keyring backend"); - program.parse(); - const [networkId, wallet, launchpadAdmin] = program.args; - const { keyringBackend } = program.opts(); - - await deployNftLaunchpad({ - opts: { - home: path.join(os.homedir(), ".teritorid"), - binaryPath: "teritorid", - keyringBackend, - }, - networkId, - wallet, - launchpadAdmin, - }); -}; -main(); diff --git a/packages/scripts/network-setup/deployRemoteWASM.ts b/packages/scripts/network-setup/deployRemoteWASM.ts new file mode 100644 index 0000000000..a0e8b5089c --- /dev/null +++ b/packages/scripts/network-setup/deployRemoteWASM.ts @@ -0,0 +1,25 @@ +import axios from "axios"; +import fs from "fs"; +import path from "path"; + +import { DeployOpts, storeWASM } from "./deployLib"; + +import { CosmosNetworkInfo } from "@/networks"; + +export const deployRemoteWASM = async ( + opts: DeployOpts, + wallet: string, + network: CosmosNetworkInfo, + url: string, + name: string, +) => { + console.log(`Fetching ${url}`); + const contractsDir = path.join(opts.home, "remote-wasm"); + fs.mkdirSync(contractsDir, { recursive: true }); + const filePath = path.join(contractsDir, name); + const response = await axios.get(url, { responseType: "stream" }); + const fileStream = fs.createWriteStream(filePath); + await response.data.pipe(fileStream); + console.log(`Storing ${filePath}`); + return await storeWASM(opts, wallet, network, filePath); +}; diff --git a/packages/scripts/network-setup/nft-launchpad/deployNftLaunchpad.ts b/packages/scripts/network-setup/nft-launchpad/deployNftLaunchpad.ts new file mode 100644 index 0000000000..d6811165fa --- /dev/null +++ b/packages/scripts/network-setup/nft-launchpad/deployNftLaunchpad.ts @@ -0,0 +1,283 @@ +import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; +import { cloneDeep } from "lodash"; +import path from "path"; + +import { deployCwAdminFactory } from "../cw-admin-factory/deployCwAdminFactory"; +import { deployDA0DA0 } from "../dao-dao/deployDA0DA0"; +import { + DeployOpts, + initDeploy, + instantiateContract, + storeWASM, +} from "../deployLib"; + +import { DaoCoreQueryClient } from "@/contracts-clients/dao-core/DaoCore.client"; +import { InstantiateMsg as NftLaunchpadInstantiateMsg } from "@/contracts-clients/nft-launchpad/NftLaunchpad.types"; +import { TeritoriNameServiceClient } from "@/contracts-clients/teritori-name-service/TeritoriNameService.client"; +import { + CosmosNetworkInfo, + getNetworkFeature, + NetworkFeature, +} from "@/networks"; +import { CosmWasmNFTLaunchpad } from "@/networks/features"; +import { createDaoMemberBased, CreateDaoMemberBasedParams } from "@/utils/dao"; +import { getPercent, getDuration } from "@/utils/gnodao/helpers"; + +/** + * Store nft-launchpad binaries + * Deploy nft-tr721 + * Deploy and instantiate cw-admin-factory + * Deploy and instantiate DAODA0 stuff (See deployDA0DA0.ts) + * Create the Launchpad Admin DAO + * Deploy and instantiate DAO Proposal Single module from https://github.com/DA0-DA0/dao-contracts (We consider using the v2.2.0) + * Deploy and instantiate nft-launchpad + */ +export const deployNftLaunchpad = async ({ + signingCosmWasmClient, + nameServiceClient, + opts, + networkId, + wallet, +}: { + signingCosmWasmClient: SigningCosmWasmClient; + nameServiceClient: TeritoriNameServiceClient; + networkId: string; + wallet: string; + opts: DeployOpts; +}) => { + const { network, walletAddr: deployerWalletAddress } = await initDeploy({ + opts, + networkId, + wallet, + }); + + // Getting the feature + const cosmwasmLaunchpadFeature = cloneDeep( + getNetworkFeature(networkId, NetworkFeature.CosmWasmNFTLaunchpad), + ); + if (!cosmwasmLaunchpadFeature) { + console.error(`Cosmwasm Launchpad feature not found on ${networkId}`); + process.exit(1); + } + + // Optimizing contract and getting WASM binaries + console.log("Storing nft launchpad"); + const nftLaunchpadWasmFilePath = path.join( + __dirname, + "../../../../artifacts/nft_launchpad.wasm", + ); + cosmwasmLaunchpadFeature.codeId = await storeWASM( + opts, + wallet, + network, + nftLaunchpadWasmFilePath, + ); + + // Next steps + console.log("Instantiating nft launchpad", cosmwasmLaunchpadFeature.codeId); + const launchpadContractAddress = await instantiateNftLaunchpad({ + signingCosmWasmClient, + nameServiceClient, + opts, + wallet, + deployerWalletAddress, + network, + featureObject: cosmwasmLaunchpadFeature, + }); + if (launchpadContractAddress) + cosmwasmLaunchpadFeature.launchpadContractAddress = + launchpadContractAddress; + + // Updating the network with the updated feature + network.featureObjects = network.featureObjects?.map((featureObject) => { + if (featureObject.type === NetworkFeature.CosmWasmNFTLaunchpad) { + return cosmwasmLaunchpadFeature; + } else return featureObject; + }); + + console.log(JSON.stringify(network, null, 2)); + return network; +}; + +const instantiateNftLaunchpad = async ({ + signingCosmWasmClient, + nameServiceClient, + opts, + wallet, + deployerWalletAddress, + network, + featureObject, +}: { + signingCosmWasmClient: SigningCosmWasmClient; + nameServiceClient: TeritoriNameServiceClient; + opts: DeployOpts; + wallet: string; + deployerWalletAddress: string; + network: CosmosNetworkInfo; + featureObject: CosmWasmNFTLaunchpad; +}) => { + const codeId = featureObject.codeId; + if (!codeId) { + console.error("Nft Launchpad code ID not found"); + process.exit(1); + } + console.log("Nft Launchpad code ID found:", codeId); + + // NFT TR721 + let nftCodeId = featureObject.nftTr721CodeId; + if (!nftCodeId) { + console.error("No NFT TR721 code ID found. Deploying NFT TR721 ..."); + nftCodeId = await deployNftTr721({ + opts, + networkId: network.id, + wallet, + }); + } + console.log("NFT TR721 deployed:", nftCodeId); + + // CW ADMIN FACTORY + if (!network.cwAdminFactoryContractAddress) { + console.error( + "No CW ADMIN FACTORY contract found. Instantiating CW ADMIN FACTORY ...", + ); + network = await deployCwAdminFactory({ + opts, + networkId: network.id, + wallet, + }); + } + console.log( + "CW ADMIN FACTORY deployed:", + network.cwAdminFactoryContractAddress, + ); + + // DA0DA0 + if ( + !network.daoCoreCodeId || + !network.daoPreProposeSingleCodeId || + !network.daoProposalSingleCodeId || + !network.cw4GroupCodeId || + !network.daoVotingCw4CodeId + ) { + console.error("No DA0DA0 stuff found. Deploying DA0DA0 stuff ..."); + network = await deployDA0DA0({ + opts, + networkId: network.id, + wallet, + }); + } + console.log("DA0DA0 stuff deployed"); + + console.log("Creating the Launchpad Admin DAO"); + const params: CreateDaoMemberBasedParams = { + signingCosmWasmClient, + nameServiceClient, + networkId: network.id, + sender: deployerWalletAddress, + contractAddress: network.cwAdminFactoryContractAddress!, + daoCoreCodeId: network.daoCoreCodeId!, + daoPreProposeSingleCodeId: network.daoPreProposeSingleCodeId!, + daoProposalSingleCodeId: network.daoProposalSingleCodeId!, + cw4GroupCodeId: network.cw4GroupCodeId!, + daoVotingCw4CodeId: network.daoVotingCw4CodeId!, + name: "Launchpad Admin", + description: "The DAO who reviews applied collections", + tns: "dao-" + randomTnsName(), + imageUrl: "", + members: [ + { + addr: deployerWalletAddress, + weight: 1, + }, + ], + quorum: getPercent(50), + threshold: getPercent(15), + maxVotingPeriod: getDuration("1", "0", "0"), + }; + + const { daoAddress, executeResult } = await createDaoMemberBased( + params, + "auto", + ); + if (executeResult) { + console.log("Launchpad Admin DAO created: " + daoAddress); + } else { + console.error( + "Failed to create Launchpad Admin DAO.\nNFT Launchpad contract instantiation aborted.", + ); + return null; + } + + // dao-proposal-single + const daoCoreClient = new DaoCoreQueryClient( + signingCosmWasmClient, + daoAddress, + ); + const daoProposalSingleModule = ( + await daoCoreClient.activeProposalModules({}) + )[0]; + const daoProposalSingleContractAddress = daoProposalSingleModule.address; + console.log( + "DAO Proposal Single contract used:", + daoProposalSingleContractAddress, + ); + + const instantiateMsg: NftLaunchpadInstantiateMsg = { + config: { + name: "Teritori NFT Launchpad", + owner: deployerWalletAddress, + admin: daoAddress, + nft_code_id: nftCodeId, + proposal_single_contract: daoProposalSingleContractAddress, + }, + }; + return await instantiateContract( + opts, + deployerWalletAddress, + network, + codeId, + deployerWalletAddress, + "Teritori NFT Launchpad", + instantiateMsg, + ); +}; + +const deployNftTr721 = async ({ + opts, + networkId, + wallet, +}: { + networkId: string; + wallet: string; + opts: DeployOpts; +}) => { + const { network, walletAddr: deployerWalletAddress } = await initDeploy({ + opts, + networkId, + wallet, + }); + const cosmwasmLaunchpadFeature = cloneDeep( + getNetworkFeature(networkId, NetworkFeature.CosmWasmNFTLaunchpad), + ); + if (!cosmwasmLaunchpadFeature) { + console.error(`Cosmwasm Launchpad feature not found on ${networkId}`); + process.exit(1); + } + const nftTr721WasmFilePath = path.join(__dirname, "nft_tr721.wasm"); + cosmwasmLaunchpadFeature.nftTr721CodeId = await storeWASM( + opts, + deployerWalletAddress, + network, + nftTr721WasmFilePath, + ); + return cosmwasmLaunchpadFeature.nftTr721CodeId; +}; + +const randomTnsName = () => { + const chars = "abcdefghijklmnopqrstuvwxyz0123456789"; + let result = ""; + for (let i = 0; i < 8; i++) { + result += chars.charAt(Math.floor(Math.random() * chars.length)); + } + return result; +}; diff --git a/packages/scripts/network-setup/nft-launchpad/deployNftLaunchpadScript.ts b/packages/scripts/network-setup/nft-launchpad/deployNftLaunchpadScript.ts new file mode 100644 index 0000000000..0323bb4dcf --- /dev/null +++ b/packages/scripts/network-setup/nft-launchpad/deployNftLaunchpadScript.ts @@ -0,0 +1,96 @@ +import { Secp256k1HdWallet } from "@cosmjs/amino"; +import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate"; +import child_process from "child_process"; +import { program } from "commander"; +import os from "os"; +import path from "path"; + +import { deployNftLaunchpad } from "./deployNftLaunchpad"; + +import { TeritoriNameServiceClient } from "@/contracts-clients/teritori-name-service/TeritoriNameService.client"; +import { cosmosNetworkGasPrice, getCosmosNetwork } from "@/networks"; +import { zodTryParseJSON } from "@/utils/sanitize"; +import { ZodKeyringList } from "@/utils/types/teritorid"; + +const main = async () => { + program.argument("", "Network id to deploy to"); + program.argument("", "Wallet to deploy from"); + program.option("", "The wallet mnemonic"); + program.option("--keyring-backend [keyring-backend]", "Keyring backend"); + program.parse(); + + const [networkId, walletName, mnemonic] = program.args; + const { keyringBackend } = program.opts(); + + try { + // Getting Cosmos network + const network = getCosmosNetwork(networkId); + if (!network) { + throw new Error(`Cosmos network ${networkId} not found`); + } + if (!network.nameServiceContractAddress) { + throw new Error("Name service contract address not found"); + } + + // Getting signer from mnemonic + const signer = await Secp256k1HdWallet.fromMnemonic(mnemonic, { + prefix: network.addressPrefix, + }); + console.log("Restored signer:", signer); + + // Getting deployer wallet address from signer accounts + const signerAddress = (await signer.getAccounts())[0].address; + console.log("Signer wallet address:", signerAddress); + + // (To facilitate the script troubleshooting, we control now if the given mnemonic corresponds to the wallet-name) + // Checking if wallet-name exists in backend keyring + const keyringCommand = `teritorid keys list --keyring-backend ${keyringBackend} --output json`; + const keyringListJSON = child_process + .execSync(keyringCommand, { + encoding: "utf-8", + }) + .trim(); + const keyringList = zodTryParseJSON(ZodKeyringList, keyringListJSON); + if (!keyringList) { + throw new Error("Failed to parse keyring list"); + } + // Searching for the wallet with the walletName and check the associated address + const wallet = keyringList.find((entry) => entry.name === walletName); + if (wallet && wallet.address === signerAddress) { + console.log(`Mnemonic corresponds to the wallet name ${walletName}`); + } else { + throw new Error( + `Mnemonic does not correspond to the wallet name ${walletName}`, + ); + } + + // Getting CW signing client + const signingCosmWasmClient = await SigningCosmWasmClient.connectWithSigner( + network.rpcEndpoint, + signer, + { gasPrice: cosmosNetworkGasPrice(network, "average") }, + ); + const nameServiceClient = new TeritoriNameServiceClient( + signingCosmWasmClient, + signerAddress, + network.nameServiceContractAddress, + ); + + // Deploying CW NFT Launchpad stuff + await deployNftLaunchpad({ + signingCosmWasmClient, + nameServiceClient, + opts: { + home: path.join(os.homedir(), ".teritorid"), + binaryPath: "teritorid", + keyringBackend, + }, + networkId, + wallet: walletName, + }); + } catch (e) { + console.error(e); + process.exit(1); + } +}; +main(); diff --git a/packages/utils/dao.ts b/packages/utils/dao.ts index 456f6c5211..a920b20f8b 100644 --- a/packages/utils/dao.ts +++ b/packages/utils/dao.ts @@ -5,9 +5,12 @@ import { import { Coin, StdFee } from "@cosmjs/stargate"; import { Buffer } from "buffer"; +import { InstantiateMsg as DaoCoreInstantiateMsg } from "@/contracts-clients/dao-core/DaoCore.types"; +import { InstantiateMsg as PreProposeSingleInstantiateMsg } from "@/contracts-clients/dao-pre-propose-single/DaoPreProposeSingle.types"; +import { InstantiateMsg as ProposalSingleInstantiateMsg } from "@/contracts-clients/dao-proposal-single/DaoProposalSingle.types"; +import { InstantiateMsg as VotingCw4InstantiateMsg } from "@/contracts-clients/dao-voting-cw4/DaoVotingCw4.types"; import { TeritoriNameServiceClient } from "@/contracts-clients/teritori-name-service/TeritoriNameService.client"; import { getStakingCurrency, mustGetCosmosNetwork } from "@/networks"; -import { getKeplrSigningCosmWasmClient } from "@/networks/signer"; interface TokenHolder { address: string; @@ -19,6 +22,8 @@ interface DaoMember { } export interface CreateDaoMemberBasedParams { + signingCosmWasmClient: SigningCosmWasmClient; + nameServiceClient: TeritoriNameServiceClient; networkId: string; sender: string; contractAddress: string; @@ -187,6 +192,8 @@ export const createDaoTokenBased = async ( export const createDaoMemberBased = async ( { + signingCosmWasmClient, + nameServiceClient, sender, networkId, contractAddress, @@ -211,12 +218,12 @@ export const createDaoMemberBased = async ( ) => { await onStepChange?.(0); - const dao_pre_propose_single_msg = { + const dao_pre_propose_single_msg: PreProposeSingleInstantiateMsg = { deposit_info: null, extension: {}, open_proposal_submission: false, }; - const dao_proposal_single_msg = { + const dao_proposal_single_msg: ProposalSingleInstantiateMsg = { threshold: { threshold_quorum: { quorum: { percent: quorum }, @@ -256,7 +263,7 @@ export const createDaoMemberBased = async ( }, ]; - const dao_voting_cw4_msg = { + const dao_voting_cw4_msg: VotingCw4InstantiateMsg = { cw4_group_code_id: cw4GroupCodeId, initial_members: members, }; @@ -268,7 +275,7 @@ export const createDaoMemberBased = async ( msg: Buffer.from(JSON.stringify(dao_voting_cw4_msg)).toString("base64"), }; - const dao_core_instantiate_msg = { + const dao_core_instantiate_msg: DaoCoreInstantiateMsg = { admin: null, automatically_add_cw20s: true, automatically_add_cw721s: true, @@ -278,6 +285,7 @@ export const createDaoMemberBased = async ( proposal_modules_instantiate_info, voting_module_instantiate_info, }; + const instantiate_msg = Buffer.from( JSON.stringify(dao_core_instantiate_msg), ).toString("base64"); @@ -288,13 +296,6 @@ export const createDaoMemberBased = async ( throw new Error("no name service contract address"); } - const client = await getKeplrSigningCosmWasmClient(networkId); - - const nameServiceClient = new TeritoriNameServiceClient( - client, - sender, - network.nameServiceContractAddress, - ); const tokenId = (tns + network.nameServiceTLD).toLowerCase(); const amount = await nameServiceClient.mintPrice({ tokenId, @@ -316,7 +317,7 @@ export const createDaoMemberBased = async ( amount && denom ? [{ denom, amount }] : [], ); - const executeResult = await client.execute( + const executeResult = await signingCosmWasmClient.execute( sender, contractAddress, { diff --git a/packages/utils/types/teritorid.ts b/packages/utils/types/teritorid.ts new file mode 100644 index 0000000000..e884f88dba --- /dev/null +++ b/packages/utils/types/teritorid.ts @@ -0,0 +1,11 @@ +import { z } from "zod"; + +export const ZodKeyringList = z.array( + z.object({ + name: z.string(), + type: z.string(), + address: z.string(), + pubkey: z.string(), + mnemonic: z.string().optional(), + }), +); diff --git a/rust/cw-contracts/nft-launchpad/Cargo.toml b/rust/cw-contracts/nft-launchpad/Cargo.toml index 20a870ba73..b2946e5877 100644 --- a/rust/cw-contracts/nft-launchpad/Cargo.toml +++ b/rust/cw-contracts/nft-launchpad/Cargo.toml @@ -21,6 +21,8 @@ serde = { version = "1.0.197", features = ["derive"] } sylvia = "0.9.3" thiserror = "1.0.57" nft-tr721 = { workspace = true, features = ["library"] } +dao-proposal-single = { version = "2.6.0", features = ["library"] } +dao-voting = "2.6.0" [dev-dependencies] sylvia = { version = "0.9.3", features = ["mt"] } diff --git a/rust/cw-contracts/nft-launchpad/config-mainnet.json b/rust/cw-contracts/nft-launchpad/config-mainnet.json index 0e2505c3d8..9c331db194 100644 --- a/rust/cw-contracts/nft-launchpad/config-mainnet.json +++ b/rust/cw-contracts/nft-launchpad/config-mainnet.json @@ -4,6 +4,7 @@ "supported_networks": ["teritori"], "owner": "", "deployer": "", - "nft_code_id": 0 + "nft_code_id": 0, + "proposal_single_contract": "" } } diff --git a/rust/cw-contracts/nft-launchpad/config.json b/rust/cw-contracts/nft-launchpad/config.json index affee6a7f6..6b7fa4c880 100644 --- a/rust/cw-contracts/nft-launchpad/config.json +++ b/rust/cw-contracts/nft-launchpad/config.json @@ -4,6 +4,7 @@ "supported_networks": ["teritori-testnet"], "owner": "tori1llmym9upcpwnz7qte856ghlp5437ezz2gg7z0q", "admin": "tori1kjvyqf4mttwrhfuq5gfj9xgxx9jdt92xnxzf770x853567ymx8cscrnw05", - "nft_code_id": 60 + "nft_code_id": 60, + "proposal_single_contract": "tori1kprr6paf06nhwavaduasdeh7cs8z90mwg7w783kluya7aachndkqes2s7x" } } diff --git a/rust/cw-contracts/nft-launchpad/schema/nft-launchpad.json b/rust/cw-contracts/nft-launchpad/schema/nft-launchpad.json index 22a25df230..c936aab9c3 100644 --- a/rust/cw-contracts/nft-launchpad/schema/nft-launchpad.json +++ b/rust/cw-contracts/nft-launchpad/schema/nft-launchpad.json @@ -25,7 +25,8 @@ "admin", "name", "nft_code_id", - "owner" + "owner", + "proposal_single_contract" ], "properties": { "admin": { @@ -41,6 +42,9 @@ }, "owner": { "$ref": "#/definitions/Addr" + }, + "proposal_single_contract": { + "$ref": "#/definitions/Addr" } }, "additionalProperties": false @@ -335,6 +339,12 @@ "string", "null" ] + }, + "proposal_single_contract": { + "type": [ + "string", + "null" + ] } }, "additionalProperties": false @@ -732,7 +742,8 @@ "admin", "name", "nft_code_id", - "owner" + "owner", + "proposal_single_contract" ], "properties": { "admin": { @@ -748,6 +759,9 @@ }, "owner": { "$ref": "#/definitions/Addr" + }, + "proposal_single_contract": { + "$ref": "#/definitions/Addr" } }, "additionalProperties": false, diff --git a/rust/cw-contracts/nft-launchpad/schema/raw/execute.json b/rust/cw-contracts/nft-launchpad/schema/raw/execute.json index 80935c8a3e..647225dc77 100644 --- a/rust/cw-contracts/nft-launchpad/schema/raw/execute.json +++ b/rust/cw-contracts/nft-launchpad/schema/raw/execute.json @@ -286,6 +286,12 @@ "string", "null" ] + }, + "proposal_single_contract": { + "type": [ + "string", + "null" + ] } }, "additionalProperties": false diff --git a/rust/cw-contracts/nft-launchpad/schema/raw/instantiate.json b/rust/cw-contracts/nft-launchpad/schema/raw/instantiate.json index 33c4480887..c394bf568b 100644 --- a/rust/cw-contracts/nft-launchpad/schema/raw/instantiate.json +++ b/rust/cw-contracts/nft-launchpad/schema/raw/instantiate.json @@ -21,7 +21,8 @@ "admin", "name", "nft_code_id", - "owner" + "owner", + "proposal_single_contract" ], "properties": { "admin": { @@ -37,6 +38,9 @@ }, "owner": { "$ref": "#/definitions/Addr" + }, + "proposal_single_contract": { + "$ref": "#/definitions/Addr" } }, "additionalProperties": false diff --git a/rust/cw-contracts/nft-launchpad/schema/raw/response_to_get_config.json b/rust/cw-contracts/nft-launchpad/schema/raw/response_to_get_config.json index f58adb6046..20672a2e9f 100644 --- a/rust/cw-contracts/nft-launchpad/schema/raw/response_to_get_config.json +++ b/rust/cw-contracts/nft-launchpad/schema/raw/response_to_get_config.json @@ -6,7 +6,8 @@ "admin", "name", "nft_code_id", - "owner" + "owner", + "proposal_single_contract" ], "properties": { "admin": { @@ -22,6 +23,9 @@ }, "owner": { "$ref": "#/definitions/Addr" + }, + "proposal_single_contract": { + "$ref": "#/definitions/Addr" } }, "additionalProperties": false, diff --git a/rust/cw-contracts/nft-launchpad/src/contract.rs b/rust/cw-contracts/nft-launchpad/src/contract.rs index d993eb1c23..722bb375b8 100644 --- a/rust/cw-contracts/nft-launchpad/src/contract.rs +++ b/rust/cw-contracts/nft-launchpad/src/contract.rs @@ -1,20 +1,36 @@ use cosmwasm_schema::cw_serde; -use cosmwasm_std::{attr, to_json_binary, Addr, Reply, Response, StdResult, SubMsg, WasmMsg}; +use cosmwasm_std::{attr, to_json_binary, from_json, Addr, Reply, Response, StdResult, SubMsg, WasmMsg}; use cw_storage_plus::{Item, Map}; -use cw_utils::parse_reply_instantiate_data; +use cw_utils::{parse_reply_execute_data, parse_reply_instantiate_data}; use sylvia::{ contract, entry_points, types::{ExecCtx, InstantiateCtx, QueryCtx, ReplyCtx}, }; use crate::error::ContractError; - use nft_tr721::{ contract::sv::InstantiateMsg as Tr721InstantiateMsg, contract::{MintInfo as Tr721MintInfo, MintPeriod as Tr721MintPeriod}, }; +use dao_proposal_single::msg::ExecuteMsg as DaoExecuteMsg; +use dao_voting::proposal::SingleChoiceProposeMsg; + const INSTANTIATE_REPLY_ID: u64 = 1u64; +const EXECUTE_REPLY_ID: u64 = 2u64; + + +#[derive(serde::Serialize)] +pub enum ExecuteMsg { + DeployCollection { + collection_id: String + }, +} + +#[derive(serde::Deserialize)] +pub struct MsgExecuteProposalResponseData { + proposal_id: String +} // Contract states ------------------------------------------------------ pub struct NftLaunchpad { @@ -62,6 +78,10 @@ impl NftLaunchpad { } // Save new config + if let Some(name) = changes.name { + config.name = name.clone(); + attributes.push(attr("new_name", name.to_string())) + } if let Some(nft_code_id) = changes.nft_code_id { config.nft_code_id = nft_code_id; attributes.push(attr("new_nft_code_id", nft_code_id.to_string())) @@ -74,6 +94,10 @@ impl NftLaunchpad { config.owner = ctx.deps.api.addr_validate(&owner)?; attributes.push(attr("new_owner", owner)) } + if let Some(proposal_single_contract) = changes.proposal_single_contract { + config.proposal_single_contract = ctx.deps.api.addr_validate(&proposal_single_contract)?; + attributes.push(attr("new_name", proposal_single_contract.to_string())) + } self.config.save(ctx.deps.storage, &config)?; Ok(Response::new().add_attributes(attributes)) @@ -133,6 +157,8 @@ impl NftLaunchpad { merkle_root: String, ) -> Result { let storage = ctx.deps.storage; + let config = self.config.load(storage)?; + let proposal_single_contract = config.proposal_single_contract; let mut collection = self .collections @@ -153,10 +179,35 @@ impl NftLaunchpad { collection.metadatas_merkle_root = Some(merkle_root.clone()); // Update collection - self.collections.save(storage, collection_id, &collection)?; + self.collections.save(storage, collection_id.clone(), &collection)?; + + // Create the deploy_collection proposal message + let deploy_collection_msg = cosmwasm_std::CosmosMsg::Wasm(WasmMsg::Execute { + contract_addr: ctx.env.contract.address.to_string(), + msg: to_json_binary(&ExecuteMsg::DeployCollection {collection_id: collection_id.clone()})?, + funds: vec![], + }); + let single_choice_propose_msg = SingleChoiceProposeMsg { + title: format!("Propose to deploy collection {}", collection_id), + description: format!( + "Requesting approval to deploy the collection {} with ID {}", + collection.name, collection_id + ), + msgs: vec![deploy_collection_msg], + proposer: None, + vote: None, + }; + let propose_execute_msg = WasmMsg::Execute { + contract_addr: proposal_single_contract.to_string(), + msg: to_json_binary(&DaoExecuteMsg::Propose(single_choice_propose_msg))?, + funds: vec![], + }; + + let submessage = SubMsg::reply_on_success(propose_execute_msg, EXECUTE_REPLY_ID); Ok(Response::new() - .add_attribute("action", "update_merkle_root") + .add_submessage(submessage) + .add_attribute("action", "merkle_root_updated") .add_attribute("merkle_root", merkle_root)) } @@ -244,6 +295,29 @@ impl NftLaunchpad { let msg_id = msg.id; let storage = ctx.deps.storage; + // dao single choice propose execute submessage + if msg_id == EXECUTE_REPLY_ID { + let resp = parse_reply_execute_data(msg.clone())?; + + if let Some(data) = resp.data { + + // TODO: If proposal_id not available in data, use dao_proposal_single hooks + + let parsed: StdResult = from_json(data.as_slice()); + match parsed { + Ok(parsed_data) => { + let proposal_id = parsed_data.proposal_id; + + return Ok(Response::new() + .add_attribute("action", "collection_proposal_created") + .add_attribute("proposal_id", proposal_id)); + } + Err(_) => return Err(ContractError::ParseProposalIdFailed), + } + } + } + + // tr771 instantiate submessage if msg_id == INSTANTIATE_REPLY_ID { let resp = parse_reply_instantiate_data(msg).unwrap(); let deployed_addr = resp.contract_address; @@ -274,6 +348,7 @@ pub struct Config { pub nft_code_id: u64, pub admin: Addr, pub owner: Addr, + pub proposal_single_contract: Addr, } #[cw_serde] @@ -282,6 +357,7 @@ pub struct ConfigChanges { pub nft_code_id: Option, pub admin: Option, pub owner: Option, + pub proposal_single_contract: Option, } #[cw_serde] diff --git a/rust/cw-contracts/nft-launchpad/src/error.rs b/rust/cw-contracts/nft-launchpad/src/error.rs index e2a19ed93b..b1bf051d3f 100644 --- a/rust/cw-contracts/nft-launchpad/src/error.rs +++ b/rust/cw-contracts/nft-launchpad/src/error.rs @@ -43,6 +43,9 @@ pub enum ContractError { #[error("Already deployed.")] AlreadyDeployed, + #[error("Failed to parse proposal ID.")] + ParseProposalIdFailed, + #[error("Unable to parse reply.")] ParseReplyError(#[from] ParseReplyError), diff --git a/rust/cw-contracts/nft-launchpad/src/multitest.rs b/rust/cw-contracts/nft-launchpad/src/multitest.rs index ad0b550c3e..7a126ecd96 100644 --- a/rust/cw-contracts/nft-launchpad/src/multitest.rs +++ b/rust/cw-contracts/nft-launchpad/src/multitest.rs @@ -77,6 +77,8 @@ fn instantiate() { // Deploy NFT TR721 for sylvia contract let nft_contract = NftTr721CodeId::store_code(&app); let deployed_nft_code_id = nft_contract.code_id(); + // DAO Proposal Single module + let proposal_single_contract = "proposal_single_contract"; // Instantiate let config = Config { @@ -84,6 +86,7 @@ fn instantiate() { nft_code_id: deployed_nft_code_id, admin: Addr::unchecked("admin"), owner: Addr::unchecked(sender), + proposal_single_contract: Addr::unchecked(proposal_single_contract), }; let contract = code_id.instantiate(config).call(sender).unwrap(); @@ -105,6 +108,9 @@ fn full_flow() { let nft_contract = NftTr721CodeId::store_code(&app); let deployed_nft_code_id = nft_contract.code_id(); + // DAO Proposal Single module + let proposal_single_contract = "proposal_single_contract"; + // Instantiate launchpad --------------------------------------------------------- let contract = LaunchpadCodeId::store_code(&app) .instantiate(Config { @@ -112,6 +118,7 @@ fn full_flow() { nft_code_id: deployed_nft_code_id, admin: Addr::unchecked("admin"), owner: Addr::unchecked(sender), + proposal_single_contract: Addr::unchecked(proposal_single_contract), }) .call(sender) .unwrap(); @@ -186,6 +193,7 @@ fn full_flow() { nft_code_id: Some(deployed_nft_code_id), admin: Some(sender.to_string()), owner: Some(sender.to_string()), + proposal_single_contract: Some(proposal_single_contract.to_string()), }) .call("wrong_owner") .unwrap_err(); @@ -200,6 +208,7 @@ fn full_flow() { nft_code_id: Some(deployed_nft_code_id), admin: Some("deployer".to_string()), owner: Some(sender.to_string()), + proposal_single_contract: Some(proposal_single_contract.to_string()), }) .call(sender) .unwrap(); @@ -219,6 +228,7 @@ fn full_flow() { nft_code_id: Some(deployed_nft_code_id), admin: Some(sender.to_string()), owner: Some(sender.to_string()), + proposal_single_contract: Some(proposal_single_contract.to_string()), }) .call(sender) .unwrap(); @@ -274,6 +284,7 @@ fn full_flow() { nft_code_id: Some(deployed_nft_code_id), admin: Some(sender.to_string()), owner: Some(sender.to_string()), + proposal_single_contract: Some(proposal_single_contract.to_string()), }) .call(sender) .unwrap();