|
47 | 47 | DefaultTestValue: "20stake", |
48 | 48 | ValueLoop: "sdk.NewCoins(sdk.NewInt64Coin(`token`, int64(i%1+100)), sdk.NewInt64Coin(`stake`, int64(i%2+100)))", |
49 | 49 | ProtoType: func(_, name string, index int) string { |
50 | | - return fmt.Sprintf("repeated cosmos.base.v1beta1.Coin %s = %d [(gogoproto.nullable) = false]", |
| 50 | + return fmt.Sprintf(`repeated cosmos.base.v1beta1.Coin %s = %d [(gogoproto.nullable) = false]`, |
51 | 51 | name, index) |
52 | 52 | }, |
53 | 53 | GenesisArgs: func(multiformatname.Name, int) string { return "" }, |
|
67 | 67 | ) |
68 | 68 | }, |
69 | 69 | } |
| 70 | + |
| 71 | + // DataDecCoin decimal coin data type definition. |
| 72 | + DataDecCoin = DataType{ |
| 73 | + DataType: func(string) string { return "sdk.DecCoin" }, |
| 74 | + CollectionsKeyValueName: func(string) string { return collectionValueComment }, |
| 75 | + DefaultTestValue: "100001token", |
| 76 | + ValueLoop: "sdk.NewInt64DecCoin(`token`, int64(i+100))", |
| 77 | + ProtoType: func(_, name string, index int) string { |
| 78 | + return fmt.Sprintf("cosmos.base.v1beta1.DecCoin %s = %d [(gogoproto.nullable) = false]", |
| 79 | + name, index) |
| 80 | + }, |
| 81 | + GenesisArgs: func(multiformatname.Name, int) string { return "" }, |
| 82 | + CLIArgs: func(name multiformatname.Name, _, prefix string, argIndex int) string { |
| 83 | + return fmt.Sprintf(`%s%s, err := sdk.ParseDecCoins(args[%d]) |
| 84 | + if err != nil { |
| 85 | + return err |
| 86 | + }`, prefix, name.UpperCamel, argIndex) |
| 87 | + }, |
| 88 | + GoCLIImports: []GoImport{{Name: "github.com/cosmos/cosmos-sdk/types", Alias: "sdk"}}, |
| 89 | + ProtoImports: []string{"gogoproto/gogo.proto", "cosmos/base/v1beta1/coin.proto"}, |
| 90 | + NonIndex: true, |
| 91 | + ToProtoField: func(_, name string, index int) *proto.NormalField { |
| 92 | + option := protoutil.NewOption("gogoproto.nullable", "false", protoutil.Custom()) |
| 93 | + return protoutil.NewField( |
| 94 | + name, "cosmos.base.v1beta1.DecCoin", index, protoutil.WithFieldOptions(option), |
| 95 | + ) |
| 96 | + }, |
| 97 | + } |
| 98 | + |
| 99 | + // DataDecCoinSlice is a decimal coin array data type definition. |
| 100 | + DataDecCoinSlice = DataType{ |
| 101 | + DataType: func(string) string { return "sdk.DecCoins" }, |
| 102 | + CollectionsKeyValueName: func(string) string { return collectionValueComment }, |
| 103 | + DefaultTestValue: "20000002stake", |
| 104 | + ValueLoop: "sdk.NewDecCoins(sdk.NewInt64DecCoin(`token`, int64(i%1+100)), sdk.NewInt64DecCoin(`stake`, int64(i%2+100)))", |
| 105 | + ProtoType: func(_, name string, index int) string { |
| 106 | + return fmt.Sprintf(`repeated cosmos.base.v1beta1.DecCoin %s = %d [(gogoproto.nullable) = false]`, |
| 107 | + name, index) |
| 108 | + }, |
| 109 | + GenesisArgs: func(multiformatname.Name, int) string { return "" }, |
| 110 | + CLIArgs: func(name multiformatname.Name, _, prefix string, argIndex int) string { |
| 111 | + return fmt.Sprintf(`%s%s, err := sdk.ParseDecCoins(args[%d]) |
| 112 | + if err != nil { |
| 113 | + return err |
| 114 | + }`, prefix, name.UpperCamel, argIndex) |
| 115 | + }, |
| 116 | + GoCLIImports: []GoImport{{Name: "github.com/cosmos/cosmos-sdk/types", Alias: "sdk"}}, |
| 117 | + ProtoImports: []string{"gogoproto/gogo.proto", "cosmos/base/v1beta1/coin.proto"}, |
| 118 | + NonIndex: true, |
| 119 | + ToProtoField: func(_, name string, index int) *proto.NormalField { |
| 120 | + optionNullable := protoutil.NewOption("gogoproto.nullable", "false", protoutil.Custom()) |
| 121 | + optionCast := protoutil.NewOption("gogoproto.castrepeated", "github.com/cosmos/cosmos-sdk/types.DecCoins", protoutil.Custom()) |
| 122 | + return protoutil.NewField(name, "cosmos.base.v1beta1.DecCoin", index, |
| 123 | + protoutil.WithFieldOptions(optionNullable), |
| 124 | + protoutil.WithFieldOptions(optionCast), |
| 125 | + protoutil.Repeated(), |
| 126 | + ) |
| 127 | + }, |
| 128 | + } |
70 | 129 | ) |
0 commit comments