diff --git a/gen/generator.go b/gen/generator.go index a0c8cc5..5ebc11d 100644 --- a/gen/generator.go +++ b/gen/generator.go @@ -681,7 +681,7 @@ func (g *Generator) dataToString(prefix string, data did.Data) string { if strings.HasPrefix(r.typ, "*") { tag += ",omitempty" // optional value. } - record += fmt.Sprintf("\t%-*s %-*s `ic:\"%s\"`\n", sizeName, r.name, sizeType, r.typ, tag) + record += fmt.Sprintf("\t%-*s %-*s `ic:\"%s\" json:\"%s\"`\n", sizeName, r.name, sizeType, r.typ, tag, tag) } return fmt.Sprintf("struct {\n%s}", record) case did.Variant: diff --git a/ic/assetstorage/agent.go b/ic/assetstorage/agent.go index 1549bae..0decda2 100755 --- a/ic/assetstorage/agent.go +++ b/ic/assetstorage/agent.go @@ -56,12 +56,12 @@ func (a Agent) Authorize(arg0 principal.Principal) error { // CertifiedTree calls the "certified_tree" method on the "assetstorage" canister. func (a Agent) CertifiedTree(arg0 struct { }) (*struct { - Certificate []byte `ic:"certificate"` - Tree []byte `ic:"tree"` + Certificate []byte `ic:"certificate" json:"certificate"` + Tree []byte `ic:"tree" json:"tree"` }, error) { var r0 struct { - Certificate []byte `ic:"certificate"` - Tree []byte `ic:"tree"` + Certificate []byte `ic:"certificate" json:"certificate"` + Tree []byte `ic:"tree" json:"tree"` } if err := a.a.Query( a.canisterId, @@ -143,10 +143,10 @@ func (a Agent) CreateAsset(arg0 CreateAssetArguments) error { // CreateBatch calls the "create_batch" method on the "assetstorage" canister. func (a Agent) CreateBatch(arg0 struct { }) (*struct { - BatchId BatchId `ic:"batch_id"` + BatchId BatchId `ic:"batch_id" json:"batch_id"` }, error) { var r0 struct { - BatchId BatchId `ic:"batch_id"` + BatchId BatchId `ic:"batch_id" json:"batch_id"` } if err := a.a.Call( a.canisterId, @@ -161,13 +161,13 @@ func (a Agent) CreateBatch(arg0 struct { // CreateChunk calls the "create_chunk" method on the "assetstorage" canister. func (a Agent) CreateChunk(arg0 struct { - BatchId BatchId `ic:"batch_id"` - Content []byte `ic:"content"` + BatchId BatchId `ic:"batch_id" json:"batch_id"` + Content []byte `ic:"content" json:"content"` }) (*struct { - ChunkId ChunkId `ic:"chunk_id"` + ChunkId ChunkId `ic:"chunk_id" json:"chunk_id"` }, error) { var r0 struct { - ChunkId ChunkId `ic:"chunk_id"` + ChunkId ChunkId `ic:"chunk_id" json:"chunk_id"` } if err := a.a.Call( a.canisterId, @@ -221,21 +221,21 @@ func (a Agent) DeleteBatch(arg0 DeleteBatchArguments) error { // Get calls the "get" method on the "assetstorage" canister. func (a Agent) Get(arg0 struct { - Key Key `ic:"key"` - AcceptEncodings []string `ic:"accept_encodings"` + Key Key `ic:"key" json:"key"` + AcceptEncodings []string `ic:"accept_encodings" json:"accept_encodings"` }) (*struct { - Content []byte `ic:"content"` - ContentType string `ic:"content_type"` - ContentEncoding string `ic:"content_encoding"` - Sha256 *[]byte `ic:"sha256,omitempty"` - TotalLength idl.Nat `ic:"total_length"` + Content []byte `ic:"content" json:"content"` + ContentType string `ic:"content_type" json:"content_type"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` + TotalLength idl.Nat `ic:"total_length" json:"total_length"` }, error) { var r0 struct { - Content []byte `ic:"content"` - ContentType string `ic:"content_type"` - ContentEncoding string `ic:"content_encoding"` - Sha256 *[]byte `ic:"sha256,omitempty"` - TotalLength idl.Nat `ic:"total_length"` + Content []byte `ic:"content" json:"content"` + ContentType string `ic:"content_type" json:"content_type"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` + TotalLength idl.Nat `ic:"total_length" json:"total_length"` } if err := a.a.Query( a.canisterId, @@ -250,16 +250,16 @@ func (a Agent) Get(arg0 struct { // GetAssetProperties calls the "get_asset_properties" method on the "assetstorage" canister. func (a Agent) GetAssetProperties(key Key) (*struct { - MaxAge *uint64 `ic:"max_age,omitempty"` - Headers *[]HeaderField `ic:"headers,omitempty"` - AllowRawAccess *bool `ic:"allow_raw_access,omitempty"` - IsAliased *bool `ic:"is_aliased,omitempty"` + MaxAge *uint64 `ic:"max_age,omitempty" json:"max_age,omitempty"` + Headers *[]HeaderField `ic:"headers,omitempty" json:"headers,omitempty"` + AllowRawAccess *bool `ic:"allow_raw_access,omitempty" json:"allow_raw_access,omitempty"` + IsAliased *bool `ic:"is_aliased,omitempty" json:"is_aliased,omitempty"` }, error) { var r0 struct { - MaxAge *uint64 `ic:"max_age,omitempty"` - Headers *[]HeaderField `ic:"headers,omitempty"` - AllowRawAccess *bool `ic:"allow_raw_access,omitempty"` - IsAliased *bool `ic:"is_aliased,omitempty"` + MaxAge *uint64 `ic:"max_age,omitempty" json:"max_age,omitempty"` + Headers *[]HeaderField `ic:"headers,omitempty" json:"headers,omitempty"` + AllowRawAccess *bool `ic:"allow_raw_access,omitempty" json:"allow_raw_access,omitempty"` + IsAliased *bool `ic:"is_aliased,omitempty" json:"is_aliased,omitempty"` } if err := a.a.Query( a.canisterId, @@ -274,15 +274,15 @@ func (a Agent) GetAssetProperties(key Key) (*struct { // GetChunk calls the "get_chunk" method on the "assetstorage" canister. func (a Agent) GetChunk(arg0 struct { - Key Key `ic:"key"` - ContentEncoding string `ic:"content_encoding"` - Index idl.Nat `ic:"index"` - Sha256 *[]byte `ic:"sha256,omitempty"` + Key Key `ic:"key" json:"key"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Index idl.Nat `ic:"index" json:"index"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` }) (*struct { - Content []byte `ic:"content"` + Content []byte `ic:"content" json:"content"` }, error) { var r0 struct { - Content []byte `ic:"content"` + Content []byte `ic:"content" json:"content"` } if err := a.a.Query( a.canisterId, @@ -339,24 +339,24 @@ func (a Agent) HttpRequestStreamingCallback(token StreamingCallbackToken) (**Str // List calls the "list" method on the "assetstorage" canister. func (a Agent) List(arg0 struct { }) (*[]struct { - Key Key `ic:"key"` - ContentType string `ic:"content_type"` + Key Key `ic:"key" json:"key"` + ContentType string `ic:"content_type" json:"content_type"` Encodings []struct { - ContentEncoding string `ic:"content_encoding"` - Sha256 *[]byte `ic:"sha256,omitempty"` - Length idl.Nat `ic:"length"` - Modified Time `ic:"modified"` - } `ic:"encodings"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` + Length idl.Nat `ic:"length" json:"length"` + Modified Time `ic:"modified" json:"modified"` + } `ic:"encodings" json:"encodings"` }, error) { var r0 []struct { - Key Key `ic:"key"` - ContentType string `ic:"content_type"` + Key Key `ic:"key" json:"key"` + ContentType string `ic:"content_type" json:"content_type"` Encodings []struct { - ContentEncoding string `ic:"content_encoding"` - Sha256 *[]byte `ic:"sha256,omitempty"` - Length idl.Nat `ic:"length"` - Modified Time `ic:"modified"` - } `ic:"encodings"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` + Length idl.Nat `ic:"length" json:"length"` + Modified Time `ic:"modified" json:"modified"` + } `ic:"encodings" json:"encodings"` } if err := a.a.Query( a.canisterId, @@ -451,11 +451,11 @@ func (a Agent) SetAssetProperties(arg0 SetAssetPropertiesArguments) error { // Store calls the "store" method on the "assetstorage" canister. func (a Agent) Store(arg0 struct { - Key Key `ic:"key"` - ContentType string `ic:"content_type"` - ContentEncoding string `ic:"content_encoding"` - Content []byte `ic:"content"` - Sha256 *[]byte `ic:"sha256,omitempty"` + Key Key `ic:"key" json:"key"` + ContentType string `ic:"content_type" json:"content_type"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Content []byte `ic:"content" json:"content"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` }) error { if err := a.a.Call( a.canisterId, @@ -567,66 +567,66 @@ type ClearArguments struct { } type CommitBatchArguments struct { - BatchId BatchId `ic:"batch_id"` - Operations []BatchOperationKind `ic:"operations"` + BatchId BatchId `ic:"batch_id" json:"batch_id"` + Operations []BatchOperationKind `ic:"operations" json:"operations"` } type CommitProposedBatchArguments struct { - BatchId BatchId `ic:"batch_id"` - Evidence []byte `ic:"evidence"` + BatchId BatchId `ic:"batch_id" json:"batch_id"` + Evidence []byte `ic:"evidence" json:"evidence"` } type ComputeEvidenceArguments struct { - BatchId BatchId `ic:"batch_id"` - MaxIterations *uint16 `ic:"max_iterations,omitempty"` + BatchId BatchId `ic:"batch_id" json:"batch_id"` + MaxIterations *uint16 `ic:"max_iterations,omitempty" json:"max_iterations,omitempty"` } type CreateAssetArguments struct { - Key Key `ic:"key"` - ContentType string `ic:"content_type"` - MaxAge *uint64 `ic:"max_age,omitempty"` - Headers *[]HeaderField `ic:"headers,omitempty"` - EnableAliasing *bool `ic:"enable_aliasing,omitempty"` - AllowRawAccess *bool `ic:"allow_raw_access,omitempty"` + Key Key `ic:"key" json:"key"` + ContentType string `ic:"content_type" json:"content_type"` + MaxAge *uint64 `ic:"max_age,omitempty" json:"max_age,omitempty"` + Headers *[]HeaderField `ic:"headers,omitempty" json:"headers,omitempty"` + EnableAliasing *bool `ic:"enable_aliasing,omitempty" json:"enable_aliasing,omitempty"` + AllowRawAccess *bool `ic:"allow_raw_access,omitempty" json:"allow_raw_access,omitempty"` } type DeleteAssetArguments struct { - Key Key `ic:"key"` + Key Key `ic:"key" json:"key"` } type DeleteBatchArguments struct { - BatchId BatchId `ic:"batch_id"` + BatchId BatchId `ic:"batch_id" json:"batch_id"` } type GrantPermission struct { - ToPrincipal principal.Principal `ic:"to_principal"` - Permission Permission `ic:"permission"` + ToPrincipal principal.Principal `ic:"to_principal" json:"to_principal"` + Permission Permission `ic:"permission" json:"permission"` } type HeaderField struct { - Field0 string `ic:"0"` - Field1 string `ic:"1"` + Field0 string `ic:"0" json:"0"` + Field1 string `ic:"1" json:"1"` } type HttpRequest struct { - Method string `ic:"method"` - Url string `ic:"url"` - Headers []HeaderField `ic:"headers"` - Body []byte `ic:"body"` - CertificateVersion *uint16 `ic:"certificate_version,omitempty"` + Method string `ic:"method" json:"method"` + Url string `ic:"url" json:"url"` + Headers []HeaderField `ic:"headers" json:"headers"` + Body []byte `ic:"body" json:"body"` + CertificateVersion *uint16 `ic:"certificate_version,omitempty" json:"certificate_version,omitempty"` } type HttpResponse struct { - StatusCode uint16 `ic:"status_code"` - Headers []HeaderField `ic:"headers"` - Body []byte `ic:"body"` - StreamingStrategy *StreamingStrategy `ic:"streaming_strategy,omitempty"` + StatusCode uint16 `ic:"status_code" json:"status_code"` + Headers []HeaderField `ic:"headers" json:"headers"` + Body []byte `ic:"body" json:"body"` + StreamingStrategy *StreamingStrategy `ic:"streaming_strategy,omitempty" json:"streaming_strategy,omitempty"` } type Key = string type ListPermitted struct { - Permission Permission `ic:"permission"` + Permission Permission `ic:"permission" json:"permission"` } type Permission struct { @@ -636,50 +636,50 @@ type Permission struct { } type RevokePermission struct { - OfPrincipal principal.Principal `ic:"of_principal"` - Permission Permission `ic:"permission"` + OfPrincipal principal.Principal `ic:"of_principal" json:"of_principal"` + Permission Permission `ic:"permission" json:"permission"` } type SetAssetContentArguments struct { - Key Key `ic:"key"` - ContentEncoding string `ic:"content_encoding"` - ChunkIds []ChunkId `ic:"chunk_ids"` - Sha256 *[]byte `ic:"sha256,omitempty"` + Key Key `ic:"key" json:"key"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + ChunkIds []ChunkId `ic:"chunk_ids" json:"chunk_ids"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` } type SetAssetPropertiesArguments struct { - Key Key `ic:"key"` - MaxAge **uint64 `ic:"max_age,omitempty"` - Headers **[]HeaderField `ic:"headers,omitempty"` - AllowRawAccess **bool `ic:"allow_raw_access,omitempty"` - IsAliased **bool `ic:"is_aliased,omitempty"` + Key Key `ic:"key" json:"key"` + MaxAge **uint64 `ic:"max_age,omitempty" json:"max_age,omitempty"` + Headers **[]HeaderField `ic:"headers,omitempty" json:"headers,omitempty"` + AllowRawAccess **bool `ic:"allow_raw_access,omitempty" json:"allow_raw_access,omitempty"` + IsAliased **bool `ic:"is_aliased,omitempty" json:"is_aliased,omitempty"` } type StreamingCallbackHttpResponse struct { - Body []byte `ic:"body"` - Token *StreamingCallbackToken `ic:"token,omitempty"` + Body []byte `ic:"body" json:"body"` + Token *StreamingCallbackToken `ic:"token,omitempty" json:"token,omitempty"` } type StreamingCallbackToken struct { - Key Key `ic:"key"` - ContentEncoding string `ic:"content_encoding"` - Index idl.Nat `ic:"index"` - Sha256 *[]byte `ic:"sha256,omitempty"` + Key Key `ic:"key" json:"key"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Index idl.Nat `ic:"index" json:"index"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` } type StreamingStrategy struct { Callback *struct { Callback struct { /* NOT SUPPORTED */ - } `ic:"callback"` - Token StreamingCallbackToken `ic:"token"` + } `ic:"callback" json:"callback"` + Token StreamingCallbackToken `ic:"token" json:"token"` } `ic:"Callback,variant"` } type Time = idl.Int type UnsetAssetContentArguments struct { - Key Key `ic:"key"` - ContentEncoding string `ic:"content_encoding"` + Key Key `ic:"key" json:"key"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` } type ValidationResult struct { diff --git a/ic/assetstorage/agent_test.go b/ic/assetstorage/agent_test.go index 2df10e7..27f015c 100755 --- a/ic/assetstorage/agent_test.go +++ b/ic/assetstorage/agent_test.go @@ -65,8 +65,8 @@ func Test_CertifiedTree(t *testing.T) { })}, Handler: func(request mock.Request) ([]any, error) { return []any{struct { - Certificate []byte `ic:"certificate"` - Tree []byte `ic:"tree"` + Certificate []byte `ic:"certificate" json:"certificate"` + Tree []byte `ic:"tree" json:"tree"` }{ *new([]byte), *new([]byte), @@ -230,7 +230,7 @@ func Test_CreateBatch(t *testing.T) { })}, Handler: func(request mock.Request) ([]any, error) { return []any{struct { - BatchId assetstorage.BatchId `ic:"batch_id"` + BatchId assetstorage.BatchId `ic:"batch_id" json:"batch_id"` }{ idl.NewNat(uint(0)), }}, nil @@ -255,12 +255,12 @@ func Test_CreateChunk(t *testing.T) { { Name: "create_chunk", Arguments: []any{new(struct { - BatchId assetstorage.BatchId `ic:"batch_id"` - Content []byte `ic:"content"` + BatchId assetstorage.BatchId `ic:"batch_id" json:"batch_id"` + Content []byte `ic:"content" json:"content"` })}, Handler: func(request mock.Request) ([]any, error) { return []any{struct { - ChunkId assetstorage.ChunkId `ic:"chunk_id"` + ChunkId assetstorage.ChunkId `ic:"chunk_id" json:"chunk_id"` }{ idl.NewNat(uint(0)), }}, nil @@ -272,8 +272,8 @@ func Test_CreateChunk(t *testing.T) { } var a0 = struct { - BatchId assetstorage.BatchId `ic:"batch_id"` - Content []byte `ic:"content"` + BatchId assetstorage.BatchId `ic:"batch_id" json:"batch_id"` + Content []byte `ic:"content" json:"content"` }{ idl.NewNat(uint(0)), *new([]byte), @@ -360,16 +360,16 @@ func Test_Get(t *testing.T) { { Name: "get", Arguments: []any{new(struct { - Key assetstorage.Key `ic:"key"` - AcceptEncodings []string `ic:"accept_encodings"` + Key assetstorage.Key `ic:"key" json:"key"` + AcceptEncodings []string `ic:"accept_encodings" json:"accept_encodings"` })}, Handler: func(request mock.Request) ([]any, error) { return []any{struct { - Content []byte `ic:"content"` - ContentType string `ic:"content_type"` - ContentEncoding string `ic:"content_encoding"` - Sha256 *[]byte `ic:"sha256,omitempty"` - TotalLength idl.Nat `ic:"total_length"` + Content []byte `ic:"content" json:"content"` + ContentType string `ic:"content_type" json:"content_type"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` + TotalLength idl.Nat `ic:"total_length" json:"total_length"` }{ *new([]byte), *new(string), @@ -385,8 +385,8 @@ func Test_Get(t *testing.T) { } var a0 = struct { - Key assetstorage.Key `ic:"key"` - AcceptEncodings []string `ic:"accept_encodings"` + Key assetstorage.Key `ic:"key" json:"key"` + AcceptEncodings []string `ic:"accept_encodings" json:"accept_encodings"` }{ *new(string), []string{*new(string)}, @@ -405,10 +405,10 @@ func Test_GetAssetProperties(t *testing.T) { Arguments: []any{new(assetstorage.Key)}, Handler: func(request mock.Request) ([]any, error) { return []any{struct { - MaxAge *uint64 `ic:"max_age,omitempty"` - Headers *[]assetstorage.HeaderField `ic:"headers,omitempty"` - AllowRawAccess *bool `ic:"allow_raw_access,omitempty"` - IsAliased *bool `ic:"is_aliased,omitempty"` + MaxAge *uint64 `ic:"max_age,omitempty" json:"max_age,omitempty"` + Headers *[]assetstorage.HeaderField `ic:"headers,omitempty" json:"headers,omitempty"` + AllowRawAccess *bool `ic:"allow_raw_access,omitempty" json:"allow_raw_access,omitempty"` + IsAliased *bool `ic:"is_aliased,omitempty" json:"is_aliased,omitempty"` }{ *new(*uint64), *new(*[]assetstorage.HeaderField), @@ -435,14 +435,14 @@ func Test_GetChunk(t *testing.T) { { Name: "get_chunk", Arguments: []any{new(struct { - Key assetstorage.Key `ic:"key"` - ContentEncoding string `ic:"content_encoding"` - Index idl.Nat `ic:"index"` - Sha256 *[]byte `ic:"sha256,omitempty"` + Key assetstorage.Key `ic:"key" json:"key"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Index idl.Nat `ic:"index" json:"index"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` })}, Handler: func(request mock.Request) ([]any, error) { return []any{struct { - Content []byte `ic:"content"` + Content []byte `ic:"content" json:"content"` }{ *new([]byte), }}, nil @@ -454,10 +454,10 @@ func Test_GetChunk(t *testing.T) { } var a0 = struct { - Key assetstorage.Key `ic:"key"` - ContentEncoding string `ic:"content_encoding"` - Index idl.Nat `ic:"index"` - Sha256 *[]byte `ic:"sha256,omitempty"` + Key assetstorage.Key `ic:"key" json:"key"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Index idl.Nat `ic:"index" json:"index"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` }{ *new(string), *new(string), @@ -572,24 +572,24 @@ func Test_List(t *testing.T) { })}, Handler: func(request mock.Request) ([]any, error) { return []any{[]struct { - Key assetstorage.Key `ic:"key"` - ContentType string `ic:"content_type"` + Key assetstorage.Key `ic:"key" json:"key"` + ContentType string `ic:"content_type" json:"content_type"` Encodings []struct { - ContentEncoding string `ic:"content_encoding"` - Sha256 *[]byte `ic:"sha256,omitempty"` - Length idl.Nat `ic:"length"` - Modified assetstorage.Time `ic:"modified"` - } `ic:"encodings"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` + Length idl.Nat `ic:"length" json:"length"` + Modified assetstorage.Time `ic:"modified" json:"modified"` + } `ic:"encodings" json:"encodings"` }{ { *new(string), *new(string), []struct { - ContentEncoding string `ic:"content_encoding"` - Sha256 *[]byte `ic:"sha256,omitempty"` - Length idl.Nat `ic:"length"` - Modified assetstorage.Time `ic:"modified"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` + Length idl.Nat `ic:"length" json:"length"` + Modified assetstorage.Time `ic:"modified" json:"modified"` }{ { @@ -783,11 +783,11 @@ func Test_Store(t *testing.T) { { Name: "store", Arguments: []any{new(struct { - Key assetstorage.Key `ic:"key"` - ContentType string `ic:"content_type"` - ContentEncoding string `ic:"content_encoding"` - Content []byte `ic:"content"` - Sha256 *[]byte `ic:"sha256,omitempty"` + Key assetstorage.Key `ic:"key" json:"key"` + ContentType string `ic:"content_type" json:"content_type"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Content []byte `ic:"content" json:"content"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` })}, Handler: func(request mock.Request) ([]any, error) { return []any{}, nil @@ -799,11 +799,11 @@ func Test_Store(t *testing.T) { } var a0 = struct { - Key assetstorage.Key `ic:"key"` - ContentType string `ic:"content_type"` - ContentEncoding string `ic:"content_encoding"` - Content []byte `ic:"content"` - Sha256 *[]byte `ic:"sha256,omitempty"` + Key assetstorage.Key `ic:"key" json:"key"` + ContentType string `ic:"content_type" json:"content_type"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Content []byte `ic:"content" json:"content"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` }{ *new(string), *new(string), diff --git a/ic/cmc/agent.go b/ic/cmc/agent.go index 7c1aba4..10e096b 100755 --- a/ic/cmc/agent.go +++ b/ic/cmc/agent.go @@ -9,7 +9,7 @@ import ( ) type AccountIdentifier struct { - Bytes []byte `ic:"bytes"` + Bytes []byte `ic:"bytes" json:"bytes"` } // Agent is a client for the "cmc" canister. @@ -91,11 +91,11 @@ type BlockIndex = uint64 type Cycles = idl.Nat type CyclesCanisterInitPayload struct { - LedgerCanisterId *principal.Principal `ic:"ledger_canister_id,omitempty"` - GovernanceCanisterId *principal.Principal `ic:"governance_canister_id,omitempty"` - MintingAccountId *AccountIdentifier `ic:"minting_account_id,omitempty"` - LastPurgedNotification *uint64 `ic:"last_purged_notification,omitempty"` - ExchangeRateCanister *ExchangeRateCanister `ic:"exchange_rate_canister,omitempty"` + LedgerCanisterId *principal.Principal `ic:"ledger_canister_id,omitempty" json:"ledger_canister_id,omitempty"` + GovernanceCanisterId *principal.Principal `ic:"governance_canister_id,omitempty" json:"governance_canister_id,omitempty"` + MintingAccountId *AccountIdentifier `ic:"minting_account_id,omitempty" json:"minting_account_id,omitempty"` + LastPurgedNotification *uint64 `ic:"last_purged_notification,omitempty" json:"last_purged_notification,omitempty"` + ExchangeRateCanister *ExchangeRateCanister `ic:"exchange_rate_canister,omitempty" json:"exchange_rate_canister,omitempty"` } type ExchangeRateCanister struct { @@ -104,20 +104,20 @@ type ExchangeRateCanister struct { } type IcpXdrConversionRate struct { - TimestampSeconds uint64 `ic:"timestamp_seconds"` - XdrPermyriadPerIcp uint64 `ic:"xdr_permyriad_per_icp"` + TimestampSeconds uint64 `ic:"timestamp_seconds" json:"timestamp_seconds"` + XdrPermyriadPerIcp uint64 `ic:"xdr_permyriad_per_icp" json:"xdr_permyriad_per_icp"` } type IcpXdrConversionRateResponse struct { - Data IcpXdrConversionRate `ic:"data"` - HashTree []byte `ic:"hash_tree"` - Certificate []byte `ic:"certificate"` + Data IcpXdrConversionRate `ic:"data" json:"data"` + HashTree []byte `ic:"hash_tree" json:"hash_tree"` + Certificate []byte `ic:"certificate" json:"certificate"` } type NotifyCreateCanisterArg struct { - BlockIndex BlockIndex `ic:"block_index"` - Controller principal.Principal `ic:"controller"` - SubnetType *string `ic:"subnet_type,omitempty"` + BlockIndex BlockIndex `ic:"block_index" json:"block_index"` + Controller principal.Principal `ic:"controller" json:"controller"` + SubnetType *string `ic:"subnet_type,omitempty" json:"subnet_type,omitempty"` } type NotifyCreateCanisterResult struct { @@ -127,21 +127,21 @@ type NotifyCreateCanisterResult struct { type NotifyError struct { Refunded *struct { - Reason string `ic:"reason"` - BlockIndex *BlockIndex `ic:"block_index,omitempty"` + Reason string `ic:"reason" json:"reason"` + BlockIndex *BlockIndex `ic:"block_index,omitempty" json:"block_index,omitempty"` } `ic:"Refunded,variant"` Processing *idl.Null `ic:"Processing,variant"` TransactionTooOld *BlockIndex `ic:"TransactionTooOld,variant"` InvalidTransaction *string `ic:"InvalidTransaction,variant"` Other *struct { - ErrorCode uint64 `ic:"error_code"` - ErrorMessage string `ic:"error_message"` + ErrorCode uint64 `ic:"error_code" json:"error_code"` + ErrorMessage string `ic:"error_message" json:"error_message"` } `ic:"Other,variant"` } type NotifyTopUpArg struct { - BlockIndex BlockIndex `ic:"block_index"` - CanisterId principal.Principal `ic:"canister_id"` + BlockIndex BlockIndex `ic:"block_index" json:"block_index"` + CanisterId principal.Principal `ic:"canister_id" json:"canister_id"` } type NotifyTopUpResult struct { @@ -151,7 +151,7 @@ type NotifyTopUpResult struct { type SubnetTypesToSubnetsResponse struct { Data []struct { - Field0 string `ic:"0"` - Field1 []principal.Principal `ic:"1"` - } `ic:"data"` + Field0 string `ic:"0" json:"0"` + Field1 []principal.Principal `ic:"1" json:"1"` + } `ic:"data" json:"data"` } diff --git a/ic/cmc/agent_test.go b/ic/cmc/agent_test.go index 326852e..44ec35f 100755 --- a/ic/cmc/agent_test.go +++ b/ic/cmc/agent_test.go @@ -50,8 +50,8 @@ func Test_GetSubnetTypesToSubnets(t *testing.T) { Handler: func(request mock.Request) ([]any, error) { return []any{cmc.SubnetTypesToSubnetsResponse{ []struct { - Field0 string `ic:"0"` - Field1 []principal.Principal `ic:"1"` + Field0 string `ic:"0" json:"0"` + Field1 []principal.Principal `ic:"1" json:"1"` }{ { diff --git a/ic/icparchive/agent.go b/ic/icparchive/agent.go index e5cb33e..bd450f8 100755 --- a/ic/icparchive/agent.go +++ b/ic/icparchive/agent.go @@ -43,30 +43,30 @@ func (a Agent) GetBlocks(arg0 GetBlocksArgs) (*GetBlocksResult, error) { } type Block struct { - ParentHash *[]byte `ic:"parent_hash,omitempty"` - Transaction Transaction `ic:"transaction"` - Timestamp Timestamp `ic:"timestamp"` + ParentHash *[]byte `ic:"parent_hash,omitempty" json:"parent_hash,omitempty"` + Transaction Transaction `ic:"transaction" json:"transaction"` + Timestamp Timestamp `ic:"timestamp" json:"timestamp"` } type BlockIndex = uint64 type BlockRange struct { - Blocks []Block `ic:"blocks"` + Blocks []Block `ic:"blocks" json:"blocks"` } type GetBlocksArgs struct { - Start BlockIndex `ic:"start"` - Length uint64 `ic:"length"` + Start BlockIndex `ic:"start" json:"start"` + Length uint64 `ic:"length" json:"length"` } type GetBlocksError struct { BadFirstBlockIndex *struct { - RequestedIndex BlockIndex `ic:"requested_index"` - FirstValidIndex BlockIndex `ic:"first_valid_index"` + RequestedIndex BlockIndex `ic:"requested_index" json:"requested_index"` + FirstValidIndex BlockIndex `ic:"first_valid_index" json:"first_valid_index"` } `ic:"BadFirstBlockIndex,variant"` Other *struct { - ErrorCode uint64 `ic:"error_code"` - ErrorMessage string `ic:"error_message"` + ErrorCode uint64 `ic:"error_code" json:"error_code"` + ErrorMessage string `ic:"error_message" json:"error_message"` } `ic:"Other,variant"` } @@ -79,46 +79,46 @@ type Memo = uint64 type Operation struct { Mint *struct { - To AccountIdentifier `ic:"to"` - Amount Tokens `ic:"amount"` + To AccountIdentifier `ic:"to" json:"to"` + Amount Tokens `ic:"amount" json:"amount"` } `ic:"Mint,variant"` Burn *struct { - From AccountIdentifier `ic:"from"` - Amount Tokens `ic:"amount"` + From AccountIdentifier `ic:"from" json:"from"` + Amount Tokens `ic:"amount" json:"amount"` } `ic:"Burn,variant"` Transfer *struct { - From AccountIdentifier `ic:"from"` - To AccountIdentifier `ic:"to"` - Amount Tokens `ic:"amount"` - Fee Tokens `ic:"fee"` + From AccountIdentifier `ic:"from" json:"from"` + To AccountIdentifier `ic:"to" json:"to"` + Amount Tokens `ic:"amount" json:"amount"` + Fee Tokens `ic:"fee" json:"fee"` } `ic:"Transfer,variant"` Approve *struct { - From AccountIdentifier `ic:"from"` - Spender AccountIdentifier `ic:"spender"` - AllowanceE8s idl.Int `ic:"allowance_e8s"` - Fee Tokens `ic:"fee"` - ExpiresAt *Timestamp `ic:"expires_at,omitempty"` + From AccountIdentifier `ic:"from" json:"from"` + Spender AccountIdentifier `ic:"spender" json:"spender"` + AllowanceE8s idl.Int `ic:"allowance_e8s" json:"allowance_e8s"` + Fee Tokens `ic:"fee" json:"fee"` + ExpiresAt *Timestamp `ic:"expires_at,omitempty" json:"expires_at,omitempty"` } `ic:"Approve,variant"` TransferFrom *struct { - From AccountIdentifier `ic:"from"` - To AccountIdentifier `ic:"to"` - Spender AccountIdentifier `ic:"spender"` - Amount Tokens `ic:"amount"` - Fee Tokens `ic:"fee"` + From AccountIdentifier `ic:"from" json:"from"` + To AccountIdentifier `ic:"to" json:"to"` + Spender AccountIdentifier `ic:"spender" json:"spender"` + Amount Tokens `ic:"amount" json:"amount"` + Fee Tokens `ic:"fee" json:"fee"` } `ic:"TransferFrom,variant"` } type Timestamp struct { - TimestampNanos uint64 `ic:"timestamp_nanos"` + TimestampNanos uint64 `ic:"timestamp_nanos" json:"timestamp_nanos"` } type Tokens struct { - E8s uint64 `ic:"e8s"` + E8s uint64 `ic:"e8s" json:"e8s"` } type Transaction struct { - Memo Memo `ic:"memo"` - Icrc1Memo *[]byte `ic:"icrc1_memo,omitempty"` - Operation *Operation `ic:"operation,omitempty"` - CreatedAtTime Timestamp `ic:"created_at_time"` + Memo Memo `ic:"memo" json:"memo"` + Icrc1Memo *[]byte `ic:"icrc1_memo,omitempty" json:"icrc1_memo,omitempty"` + Operation *Operation `ic:"operation,omitempty" json:"operation,omitempty"` + CreatedAtTime Timestamp `ic:"created_at_time" json:"created_at_time"` } diff --git a/ic/icpledger/agent.go b/ic/icpledger/agent.go index 5901cd9..077f2de 100755 --- a/ic/icpledger/agent.go +++ b/ic/icpledger/agent.go @@ -9,7 +9,7 @@ import ( ) type AccountBalanceArgs struct { - Account AccountIdentifier `ic:"account"` + Account AccountIdentifier `ic:"account" json:"account"` } type AccountIdentifier = []byte @@ -62,10 +62,10 @@ func (a Agent) Archives() (*Archives, error) { // Decimals calls the "decimals" method on the "icpledger" canister. func (a Agent) Decimals() (*struct { - Decimals uint32 `ic:"decimals"` + Decimals uint32 `ic:"decimals" json:"decimals"` }, error) { var r0 struct { - Decimals uint32 `ic:"decimals"` + Decimals uint32 `ic:"decimals" json:"decimals"` } if err := a.a.Query( a.canisterId, @@ -80,10 +80,10 @@ func (a Agent) Decimals() (*struct { // Name calls the "name" method on the "icpledger" canister. func (a Agent) Name() (*struct { - Name string `ic:"name"` + Name string `ic:"name" json:"name"` }, error) { var r0 struct { - Name string `ic:"name"` + Name string `ic:"name" json:"name"` } if err := a.a.Query( a.canisterId, @@ -112,10 +112,10 @@ func (a Agent) QueryBlocks(arg0 GetBlocksArgs) (*QueryBlocksResponse, error) { // Symbol calls the "symbol" method on the "icpledger" canister. func (a Agent) Symbol() (*struct { - Symbol string `ic:"symbol"` + Symbol string `ic:"symbol" json:"symbol"` }, error) { var r0 struct { - Symbol string `ic:"symbol"` + Symbol string `ic:"symbol" json:"symbol"` } if err := a.a.Query( a.canisterId, @@ -157,71 +157,71 @@ func (a Agent) TransferFee(arg0 TransferFeeArg) (*TransferFee, error) { } type Archive struct { - CanisterId principal.Principal `ic:"canister_id"` + CanisterId principal.Principal `ic:"canister_id" json:"canister_id"` } type Archives struct { - Archives []Archive `ic:"archives"` + Archives []Archive `ic:"archives" json:"archives"` } type Block struct { - ParentHash *[]byte `ic:"parent_hash,omitempty"` - Transaction Transaction `ic:"transaction"` - Timestamp TimeStamp `ic:"timestamp"` + ParentHash *[]byte `ic:"parent_hash,omitempty" json:"parent_hash,omitempty"` + Transaction Transaction `ic:"transaction" json:"transaction"` + Timestamp TimeStamp `ic:"timestamp" json:"timestamp"` } type BlockIndex = uint64 type BlockRange struct { - Blocks []Block `ic:"blocks"` + Blocks []Block `ic:"blocks" json:"blocks"` } type GetBlocksArgs struct { - Start BlockIndex `ic:"start"` - Length uint64 `ic:"length"` + Start BlockIndex `ic:"start" json:"start"` + Length uint64 `ic:"length" json:"length"` } type Memo = uint64 type Operation struct { Mint *struct { - To AccountIdentifier `ic:"to"` - Amount Tokens `ic:"amount"` + To AccountIdentifier `ic:"to" json:"to"` + Amount Tokens `ic:"amount" json:"amount"` } `ic:"Mint,variant"` Burn *struct { - From AccountIdentifier `ic:"from"` - Amount Tokens `ic:"amount"` + From AccountIdentifier `ic:"from" json:"from"` + Amount Tokens `ic:"amount" json:"amount"` } `ic:"Burn,variant"` Transfer *struct { - From AccountIdentifier `ic:"from"` - To AccountIdentifier `ic:"to"` - Amount Tokens `ic:"amount"` - Fee Tokens `ic:"fee"` + From AccountIdentifier `ic:"from" json:"from"` + To AccountIdentifier `ic:"to" json:"to"` + Amount Tokens `ic:"amount" json:"amount"` + Fee Tokens `ic:"fee" json:"fee"` } `ic:"Transfer,variant"` Approve *struct { - From AccountIdentifier `ic:"from"` - Spender AccountIdentifier `ic:"spender"` - AllowanceE8s idl.Int `ic:"allowance_e8s"` - Fee Tokens `ic:"fee"` - ExpiresAt *TimeStamp `ic:"expires_at,omitempty"` + From AccountIdentifier `ic:"from" json:"from"` + Spender AccountIdentifier `ic:"spender" json:"spender"` + AllowanceE8s idl.Int `ic:"allowance_e8s" json:"allowance_e8s"` + Fee Tokens `ic:"fee" json:"fee"` + ExpiresAt *TimeStamp `ic:"expires_at,omitempty" json:"expires_at,omitempty"` } `ic:"Approve,variant"` TransferFrom *struct { - From AccountIdentifier `ic:"from"` - To AccountIdentifier `ic:"to"` - Spender AccountIdentifier `ic:"spender"` - Amount Tokens `ic:"amount"` - Fee Tokens `ic:"fee"` + From AccountIdentifier `ic:"from" json:"from"` + To AccountIdentifier `ic:"to" json:"to"` + Spender AccountIdentifier `ic:"spender" json:"spender"` + Amount Tokens `ic:"amount" json:"amount"` + Fee Tokens `ic:"fee" json:"fee"` } `ic:"TransferFrom,variant"` } type QueryArchiveError struct { BadFirstBlockIndex *struct { - RequestedIndex BlockIndex `ic:"requested_index"` - FirstValidIndex BlockIndex `ic:"first_valid_index"` + RequestedIndex BlockIndex `ic:"requested_index" json:"requested_index"` + FirstValidIndex BlockIndex `ic:"first_valid_index" json:"first_valid_index"` } `ic:"BadFirstBlockIndex,variant"` Other *struct { - ErrorCode uint64 `ic:"error_code"` - ErrorMessage string `ic:"error_message"` + ErrorCode uint64 `ic:"error_code" json:"error_code"` + ErrorMessage string `ic:"error_message" json:"error_message"` } `ic:"Other,variant"` } @@ -234,61 +234,61 @@ type QueryArchiveResult struct { } type QueryBlocksResponse struct { - ChainLength uint64 `ic:"chain_length"` - Certificate *[]byte `ic:"certificate,omitempty"` - Blocks []Block `ic:"blocks"` - FirstBlockIndex BlockIndex `ic:"first_block_index"` + ChainLength uint64 `ic:"chain_length" json:"chain_length"` + Certificate *[]byte `ic:"certificate,omitempty" json:"certificate,omitempty"` + Blocks []Block `ic:"blocks" json:"blocks"` + FirstBlockIndex BlockIndex `ic:"first_block_index" json:"first_block_index"` ArchivedBlocks []struct { - Start BlockIndex `ic:"start"` - Length uint64 `ic:"length"` - Callback QueryArchiveFn `ic:"callback"` - } `ic:"archived_blocks"` + Start BlockIndex `ic:"start" json:"start"` + Length uint64 `ic:"length" json:"length"` + Callback QueryArchiveFn `ic:"callback" json:"callback"` + } `ic:"archived_blocks" json:"archived_blocks"` } type SubAccount = []byte type TimeStamp struct { - TimestampNanos uint64 `ic:"timestamp_nanos"` + TimestampNanos uint64 `ic:"timestamp_nanos" json:"timestamp_nanos"` } type Tokens struct { - E8s uint64 `ic:"e8s"` + E8s uint64 `ic:"e8s" json:"e8s"` } type Transaction struct { - Memo Memo `ic:"memo"` - Icrc1Memo *[]byte `ic:"icrc1_memo,omitempty"` - Operation *Operation `ic:"operation,omitempty"` - CreatedAtTime TimeStamp `ic:"created_at_time"` + Memo Memo `ic:"memo" json:"memo"` + Icrc1Memo *[]byte `ic:"icrc1_memo,omitempty" json:"icrc1_memo,omitempty"` + Operation *Operation `ic:"operation,omitempty" json:"operation,omitempty"` + CreatedAtTime TimeStamp `ic:"created_at_time" json:"created_at_time"` } type TransferArgs struct { - Memo Memo `ic:"memo"` - Amount Tokens `ic:"amount"` - Fee Tokens `ic:"fee"` - FromSubaccount *SubAccount `ic:"from_subaccount,omitempty"` - To AccountIdentifier `ic:"to"` - CreatedAtTime *TimeStamp `ic:"created_at_time,omitempty"` + Memo Memo `ic:"memo" json:"memo"` + Amount Tokens `ic:"amount" json:"amount"` + Fee Tokens `ic:"fee" json:"fee"` + FromSubaccount *SubAccount `ic:"from_subaccount,omitempty" json:"from_subaccount,omitempty"` + To AccountIdentifier `ic:"to" json:"to"` + CreatedAtTime *TimeStamp `ic:"created_at_time,omitempty" json:"created_at_time,omitempty"` } type TransferError struct { BadFee *struct { - ExpectedFee Tokens `ic:"expected_fee"` + ExpectedFee Tokens `ic:"expected_fee" json:"expected_fee"` } `ic:"BadFee,variant"` InsufficientFunds *struct { - Balance Tokens `ic:"balance"` + Balance Tokens `ic:"balance" json:"balance"` } `ic:"InsufficientFunds,variant"` TxTooOld *struct { - AllowedWindowNanos uint64 `ic:"allowed_window_nanos"` + AllowedWindowNanos uint64 `ic:"allowed_window_nanos" json:"allowed_window_nanos"` } `ic:"TxTooOld,variant"` TxCreatedInFuture *idl.Null `ic:"TxCreatedInFuture,variant"` TxDuplicate *struct { - DuplicateOf BlockIndex `ic:"duplicate_of"` + DuplicateOf BlockIndex `ic:"duplicate_of" json:"duplicate_of"` } `ic:"TxDuplicate,variant"` } type TransferFee struct { - TransferFee Tokens `ic:"transfer_fee"` + TransferFee Tokens `ic:"transfer_fee" json:"transfer_fee"` } type TransferFeeArg struct { diff --git a/ic/icpledger/agent_test.go b/ic/icpledger/agent_test.go index 7e0d383..25f1842 100644 --- a/ic/icpledger/agent_test.go +++ b/ic/icpledger/agent_test.go @@ -72,7 +72,7 @@ func Test_Decimals(t *testing.T) { Arguments: []any{}, Handler: func(request mock.Request) ([]any, error) { return []any{struct { - Decimals uint32 `ic:"decimals"` + Decimals uint32 `ic:"decimals" json:"decimals"` }{ *new(uint32), }}, nil @@ -97,7 +97,7 @@ func Test_Name(t *testing.T) { Arguments: []any{}, Handler: func(request mock.Request) ([]any, error) { return []any{struct { - Name string `ic:"name"` + Name string `ic:"name" json:"name"` }{ *new(string), }}, nil @@ -140,9 +140,9 @@ func Test_QueryBlocks(t *testing.T) { }}, *new(uint64), []struct { - Start icpledger.BlockIndex `ic:"start"` - Length uint64 `ic:"length"` - Callback icpledger.QueryArchiveFn `ic:"callback"` + Start icpledger.BlockIndex `ic:"start" json:"start"` + Length uint64 `ic:"length" json:"length"` + Callback icpledger.QueryArchiveFn `ic:"callback" json:"callback"` }{ { @@ -177,7 +177,7 @@ func Test_Symbol(t *testing.T) { Arguments: []any{}, Handler: func(request mock.Request) ([]any, error) { return []any{struct { - Symbol string `ic:"symbol"` + Symbol string `ic:"symbol" json:"symbol"` }{ *new(string), }}, nil diff --git a/ic/icrc1/agent.go b/ic/icrc1/agent.go index 6012fa1..b410e48 100755 --- a/ic/icrc1/agent.go +++ b/ic/icrc1/agent.go @@ -9,8 +9,8 @@ import ( ) type Account struct { - Owner principal.Principal `ic:"owner"` - Subaccount *Subaccount `ic:"subaccount,omitempty"` + Owner principal.Principal `ic:"owner" json:"owner"` + Subaccount *Subaccount `ic:"subaccount,omitempty" json:"subaccount,omitempty"` } // Agent is a client for the "icrc1" canister. @@ -75,12 +75,12 @@ func (a Agent) Icrc1Fee() (*idl.Nat, error) { // Icrc1Metadata calls the "icrc1_metadata" method on the "icrc1" canister. func (a Agent) Icrc1Metadata() (*[]struct { - Field0 string `ic:"0"` - Field1 Value `ic:"1"` + Field0 string `ic:"0" json:"0"` + Field1 Value `ic:"1" json:"1"` }, error) { var r0 []struct { - Field0 string `ic:"0"` - Field1 Value `ic:"1"` + Field0 string `ic:"0" json:"0"` + Field1 Value `ic:"1" json:"1"` } if err := a.a.Query( a.canisterId, @@ -123,12 +123,12 @@ func (a Agent) Icrc1Name() (*string, error) { // Icrc1SupportedStandards calls the "icrc1_supported_standards" method on the "icrc1" canister. func (a Agent) Icrc1SupportedStandards() (*[]struct { - Name string `ic:"name"` - Url string `ic:"url"` + Name string `ic:"name" json:"name"` + Url string `ic:"url" json:"url"` }, error) { var r0 []struct { - Name string `ic:"name"` - Url string `ic:"url"` + Name string `ic:"name" json:"name"` + Url string `ic:"url" json:"url"` } if err := a.a.Query( a.canisterId, @@ -196,35 +196,35 @@ type Subaccount = []byte type Timestamp = uint64 type TransferArgs struct { - FromSubaccount *Subaccount `ic:"from_subaccount,omitempty"` - To Account `ic:"to"` - Amount idl.Nat `ic:"amount"` - Fee *idl.Nat `ic:"fee,omitempty"` - Memo *[]byte `ic:"memo,omitempty"` - CreatedAtTime *Timestamp `ic:"created_at_time,omitempty"` + FromSubaccount *Subaccount `ic:"from_subaccount,omitempty" json:"from_subaccount,omitempty"` + To Account `ic:"to" json:"to"` + Amount idl.Nat `ic:"amount" json:"amount"` + Fee *idl.Nat `ic:"fee,omitempty" json:"fee,omitempty"` + Memo *[]byte `ic:"memo,omitempty" json:"memo,omitempty"` + CreatedAtTime *Timestamp `ic:"created_at_time,omitempty" json:"created_at_time,omitempty"` } type TransferError struct { BadFee *struct { - ExpectedFee idl.Nat `ic:"expected_fee"` + ExpectedFee idl.Nat `ic:"expected_fee" json:"expected_fee"` } `ic:"BadFee,variant"` BadBurn *struct { - MinBurnAmount idl.Nat `ic:"min_burn_amount"` + MinBurnAmount idl.Nat `ic:"min_burn_amount" json:"min_burn_amount"` } `ic:"BadBurn,variant"` InsufficientFunds *struct { - Balance idl.Nat `ic:"balance"` + Balance idl.Nat `ic:"balance" json:"balance"` } `ic:"InsufficientFunds,variant"` TooOld *idl.Null `ic:"TooOld,variant"` CreatedInFuture *struct { - LedgerTime Timestamp `ic:"ledger_time"` + LedgerTime Timestamp `ic:"ledger_time" json:"ledger_time"` } `ic:"CreatedInFuture,variant"` Duplicate *struct { - DuplicateOf idl.Nat `ic:"duplicate_of"` + DuplicateOf idl.Nat `ic:"duplicate_of" json:"duplicate_of"` } `ic:"Duplicate,variant"` TemporarilyUnavailable *idl.Null `ic:"TemporarilyUnavailable,variant"` GenericError *struct { - ErrorCode idl.Nat `ic:"error_code"` - Message string `ic:"message"` + ErrorCode idl.Nat `ic:"error_code" json:"error_code"` + Message string `ic:"message" json:"message"` } `ic:"GenericError,variant"` } diff --git a/ic/icrc1/agent_test.go b/ic/icrc1/agent_test.go index c7cf6e2..04026ca 100755 --- a/ic/icrc1/agent_test.go +++ b/ic/icrc1/agent_test.go @@ -88,8 +88,8 @@ func Test_Icrc1Metadata(t *testing.T) { Arguments: []any{}, Handler: func(request mock.Request) ([]any, error) { return []any{[]struct { - Field0 string `ic:"0"` - Field1 icrc1.Value `ic:"1"` + Field0 string `ic:"0" json:"0"` + Field1 icrc1.Value `ic:"1" json:"1"` }{ { @@ -161,8 +161,8 @@ func Test_Icrc1SupportedStandards(t *testing.T) { Arguments: []any{}, Handler: func(request mock.Request) ([]any, error) { return []any{[]struct { - Name string `ic:"name"` - Url string `ic:"url"` + Name string `ic:"name" json:"name"` + Url string `ic:"url" json:"url"` }{ { diff --git a/ic/wallet/agent.go b/ic/wallet/agent.go index 8f0a408..d47c529 100755 --- a/ic/wallet/agent.go +++ b/ic/wallet/agent.go @@ -56,12 +56,12 @@ func (a Agent) Authorize(arg0 principal.Principal) error { // CertifiedTree calls the "certified_tree" method on the "wallet" canister. func (a Agent) CertifiedTree(arg0 struct { }) (*struct { - Certificate []byte `ic:"certificate"` - Tree []byte `ic:"tree"` + Certificate []byte `ic:"certificate" json:"certificate"` + Tree []byte `ic:"tree" json:"tree"` }, error) { var r0 struct { - Certificate []byte `ic:"certificate"` - Tree []byte `ic:"tree"` + Certificate []byte `ic:"certificate" json:"certificate"` + Tree []byte `ic:"tree" json:"tree"` } if err := a.a.Query( a.canisterId, @@ -143,10 +143,10 @@ func (a Agent) CreateAsset(arg0 CreateAssetArguments) error { // CreateBatch calls the "create_batch" method on the "wallet" canister. func (a Agent) CreateBatch(arg0 struct { }) (*struct { - BatchId BatchId `ic:"batch_id"` + BatchId BatchId `ic:"batch_id" json:"batch_id"` }, error) { var r0 struct { - BatchId BatchId `ic:"batch_id"` + BatchId BatchId `ic:"batch_id" json:"batch_id"` } if err := a.a.Call( a.canisterId, @@ -161,13 +161,13 @@ func (a Agent) CreateBatch(arg0 struct { // CreateChunk calls the "create_chunk" method on the "wallet" canister. func (a Agent) CreateChunk(arg0 struct { - BatchId BatchId `ic:"batch_id"` - Content []byte `ic:"content"` + BatchId BatchId `ic:"batch_id" json:"batch_id"` + Content []byte `ic:"content" json:"content"` }) (*struct { - ChunkId ChunkId `ic:"chunk_id"` + ChunkId ChunkId `ic:"chunk_id" json:"chunk_id"` }, error) { var r0 struct { - ChunkId ChunkId `ic:"chunk_id"` + ChunkId ChunkId `ic:"chunk_id" json:"chunk_id"` } if err := a.a.Call( a.canisterId, @@ -221,21 +221,21 @@ func (a Agent) DeleteBatch(arg0 DeleteBatchArguments) error { // Get calls the "get" method on the "wallet" canister. func (a Agent) Get(arg0 struct { - Key Key `ic:"key"` - AcceptEncodings []string `ic:"accept_encodings"` + Key Key `ic:"key" json:"key"` + AcceptEncodings []string `ic:"accept_encodings" json:"accept_encodings"` }) (*struct { - Content []byte `ic:"content"` - ContentType string `ic:"content_type"` - ContentEncoding string `ic:"content_encoding"` - Sha256 *[]byte `ic:"sha256,omitempty"` - TotalLength idl.Nat `ic:"total_length"` + Content []byte `ic:"content" json:"content"` + ContentType string `ic:"content_type" json:"content_type"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` + TotalLength idl.Nat `ic:"total_length" json:"total_length"` }, error) { var r0 struct { - Content []byte `ic:"content"` - ContentType string `ic:"content_type"` - ContentEncoding string `ic:"content_encoding"` - Sha256 *[]byte `ic:"sha256,omitempty"` - TotalLength idl.Nat `ic:"total_length"` + Content []byte `ic:"content" json:"content"` + ContentType string `ic:"content_type" json:"content_type"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` + TotalLength idl.Nat `ic:"total_length" json:"total_length"` } if err := a.a.Query( a.canisterId, @@ -250,16 +250,16 @@ func (a Agent) Get(arg0 struct { // GetAssetProperties calls the "get_asset_properties" method on the "wallet" canister. func (a Agent) GetAssetProperties(key Key) (*struct { - MaxAge *uint64 `ic:"max_age,omitempty"` - Headers *[]HeaderField `ic:"headers,omitempty"` - AllowRawAccess *bool `ic:"allow_raw_access,omitempty"` - IsAliased *bool `ic:"is_aliased,omitempty"` + MaxAge *uint64 `ic:"max_age,omitempty" json:"max_age,omitempty"` + Headers *[]HeaderField `ic:"headers,omitempty" json:"headers,omitempty"` + AllowRawAccess *bool `ic:"allow_raw_access,omitempty" json:"allow_raw_access,omitempty"` + IsAliased *bool `ic:"is_aliased,omitempty" json:"is_aliased,omitempty"` }, error) { var r0 struct { - MaxAge *uint64 `ic:"max_age,omitempty"` - Headers *[]HeaderField `ic:"headers,omitempty"` - AllowRawAccess *bool `ic:"allow_raw_access,omitempty"` - IsAliased *bool `ic:"is_aliased,omitempty"` + MaxAge *uint64 `ic:"max_age,omitempty" json:"max_age,omitempty"` + Headers *[]HeaderField `ic:"headers,omitempty" json:"headers,omitempty"` + AllowRawAccess *bool `ic:"allow_raw_access,omitempty" json:"allow_raw_access,omitempty"` + IsAliased *bool `ic:"is_aliased,omitempty" json:"is_aliased,omitempty"` } if err := a.a.Query( a.canisterId, @@ -274,15 +274,15 @@ func (a Agent) GetAssetProperties(key Key) (*struct { // GetChunk calls the "get_chunk" method on the "wallet" canister. func (a Agent) GetChunk(arg0 struct { - Key Key `ic:"key"` - ContentEncoding string `ic:"content_encoding"` - Index idl.Nat `ic:"index"` - Sha256 *[]byte `ic:"sha256,omitempty"` + Key Key `ic:"key" json:"key"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Index idl.Nat `ic:"index" json:"index"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` }) (*struct { - Content []byte `ic:"content"` + Content []byte `ic:"content" json:"content"` }, error) { var r0 struct { - Content []byte `ic:"content"` + Content []byte `ic:"content" json:"content"` } if err := a.a.Query( a.canisterId, @@ -339,24 +339,24 @@ func (a Agent) HttpRequestStreamingCallback(token StreamingCallbackToken) (**Str // List calls the "list" method on the "wallet" canister. func (a Agent) List(arg0 struct { }) (*[]struct { - Key Key `ic:"key"` - ContentType string `ic:"content_type"` + Key Key `ic:"key" json:"key"` + ContentType string `ic:"content_type" json:"content_type"` Encodings []struct { - ContentEncoding string `ic:"content_encoding"` - Sha256 *[]byte `ic:"sha256,omitempty"` - Length idl.Nat `ic:"length"` - Modified Time `ic:"modified"` - } `ic:"encodings"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` + Length idl.Nat `ic:"length" json:"length"` + Modified Time `ic:"modified" json:"modified"` + } `ic:"encodings" json:"encodings"` }, error) { var r0 []struct { - Key Key `ic:"key"` - ContentType string `ic:"content_type"` + Key Key `ic:"key" json:"key"` + ContentType string `ic:"content_type" json:"content_type"` Encodings []struct { - ContentEncoding string `ic:"content_encoding"` - Sha256 *[]byte `ic:"sha256,omitempty"` - Length idl.Nat `ic:"length"` - Modified Time `ic:"modified"` - } `ic:"encodings"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` + Length idl.Nat `ic:"length" json:"length"` + Modified Time `ic:"modified" json:"modified"` + } `ic:"encodings" json:"encodings"` } if err := a.a.Query( a.canisterId, @@ -451,11 +451,11 @@ func (a Agent) SetAssetProperties(arg0 SetAssetPropertiesArguments) error { // Store calls the "store" method on the "wallet" canister. func (a Agent) Store(arg0 struct { - Key Key `ic:"key"` - ContentType string `ic:"content_type"` - ContentEncoding string `ic:"content_encoding"` - Content []byte `ic:"content"` - Sha256 *[]byte `ic:"sha256,omitempty"` + Key Key `ic:"key" json:"key"` + ContentType string `ic:"content_type" json:"content_type"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Content []byte `ic:"content" json:"content"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` }) error { if err := a.a.Call( a.canisterId, @@ -567,66 +567,66 @@ type ClearArguments struct { } type CommitBatchArguments struct { - BatchId BatchId `ic:"batch_id"` - Operations []BatchOperationKind `ic:"operations"` + BatchId BatchId `ic:"batch_id" json:"batch_id"` + Operations []BatchOperationKind `ic:"operations" json:"operations"` } type CommitProposedBatchArguments struct { - BatchId BatchId `ic:"batch_id"` - Evidence []byte `ic:"evidence"` + BatchId BatchId `ic:"batch_id" json:"batch_id"` + Evidence []byte `ic:"evidence" json:"evidence"` } type ComputeEvidenceArguments struct { - BatchId BatchId `ic:"batch_id"` - MaxIterations *uint16 `ic:"max_iterations,omitempty"` + BatchId BatchId `ic:"batch_id" json:"batch_id"` + MaxIterations *uint16 `ic:"max_iterations,omitempty" json:"max_iterations,omitempty"` } type CreateAssetArguments struct { - Key Key `ic:"key"` - ContentType string `ic:"content_type"` - MaxAge *uint64 `ic:"max_age,omitempty"` - Headers *[]HeaderField `ic:"headers,omitempty"` - EnableAliasing *bool `ic:"enable_aliasing,omitempty"` - AllowRawAccess *bool `ic:"allow_raw_access,omitempty"` + Key Key `ic:"key" json:"key"` + ContentType string `ic:"content_type" json:"content_type"` + MaxAge *uint64 `ic:"max_age,omitempty" json:"max_age,omitempty"` + Headers *[]HeaderField `ic:"headers,omitempty" json:"headers,omitempty"` + EnableAliasing *bool `ic:"enable_aliasing,omitempty" json:"enable_aliasing,omitempty"` + AllowRawAccess *bool `ic:"allow_raw_access,omitempty" json:"allow_raw_access,omitempty"` } type DeleteAssetArguments struct { - Key Key `ic:"key"` + Key Key `ic:"key" json:"key"` } type DeleteBatchArguments struct { - BatchId BatchId `ic:"batch_id"` + BatchId BatchId `ic:"batch_id" json:"batch_id"` } type GrantPermission struct { - ToPrincipal principal.Principal `ic:"to_principal"` - Permission Permission `ic:"permission"` + ToPrincipal principal.Principal `ic:"to_principal" json:"to_principal"` + Permission Permission `ic:"permission" json:"permission"` } type HeaderField struct { - Field0 string `ic:"0"` - Field1 string `ic:"1"` + Field0 string `ic:"0" json:"0"` + Field1 string `ic:"1" json:"1"` } type HttpRequest struct { - Method string `ic:"method"` - Url string `ic:"url"` - Headers []HeaderField `ic:"headers"` - Body []byte `ic:"body"` - CertificateVersion *uint16 `ic:"certificate_version,omitempty"` + Method string `ic:"method" json:"method"` + Url string `ic:"url" json:"url"` + Headers []HeaderField `ic:"headers" json:"headers"` + Body []byte `ic:"body" json:"body"` + CertificateVersion *uint16 `ic:"certificate_version,omitempty" json:"certificate_version,omitempty"` } type HttpResponse struct { - StatusCode uint16 `ic:"status_code"` - Headers []HeaderField `ic:"headers"` - Body []byte `ic:"body"` - StreamingStrategy *StreamingStrategy `ic:"streaming_strategy,omitempty"` + StatusCode uint16 `ic:"status_code" json:"status_code"` + Headers []HeaderField `ic:"headers" json:"headers"` + Body []byte `ic:"body" json:"body"` + StreamingStrategy *StreamingStrategy `ic:"streaming_strategy,omitempty" json:"streaming_strategy,omitempty"` } type Key = string type ListPermitted struct { - Permission Permission `ic:"permission"` + Permission Permission `ic:"permission" json:"permission"` } type Permission struct { @@ -636,50 +636,50 @@ type Permission struct { } type RevokePermission struct { - OfPrincipal principal.Principal `ic:"of_principal"` - Permission Permission `ic:"permission"` + OfPrincipal principal.Principal `ic:"of_principal" json:"of_principal"` + Permission Permission `ic:"permission" json:"permission"` } type SetAssetContentArguments struct { - Key Key `ic:"key"` - ContentEncoding string `ic:"content_encoding"` - ChunkIds []ChunkId `ic:"chunk_ids"` - Sha256 *[]byte `ic:"sha256,omitempty"` + Key Key `ic:"key" json:"key"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + ChunkIds []ChunkId `ic:"chunk_ids" json:"chunk_ids"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` } type SetAssetPropertiesArguments struct { - Key Key `ic:"key"` - MaxAge **uint64 `ic:"max_age,omitempty"` - Headers **[]HeaderField `ic:"headers,omitempty"` - AllowRawAccess **bool `ic:"allow_raw_access,omitempty"` - IsAliased **bool `ic:"is_aliased,omitempty"` + Key Key `ic:"key" json:"key"` + MaxAge **uint64 `ic:"max_age,omitempty" json:"max_age,omitempty"` + Headers **[]HeaderField `ic:"headers,omitempty" json:"headers,omitempty"` + AllowRawAccess **bool `ic:"allow_raw_access,omitempty" json:"allow_raw_access,omitempty"` + IsAliased **bool `ic:"is_aliased,omitempty" json:"is_aliased,omitempty"` } type StreamingCallbackHttpResponse struct { - Body []byte `ic:"body"` - Token *StreamingCallbackToken `ic:"token,omitempty"` + Body []byte `ic:"body" json:"body"` + Token *StreamingCallbackToken `ic:"token,omitempty" json:"token,omitempty"` } type StreamingCallbackToken struct { - Key Key `ic:"key"` - ContentEncoding string `ic:"content_encoding"` - Index idl.Nat `ic:"index"` - Sha256 *[]byte `ic:"sha256,omitempty"` + Key Key `ic:"key" json:"key"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Index idl.Nat `ic:"index" json:"index"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` } type StreamingStrategy struct { Callback *struct { Callback struct { /* NOT SUPPORTED */ - } `ic:"callback"` - Token StreamingCallbackToken `ic:"token"` + } `ic:"callback" json:"callback"` + Token StreamingCallbackToken `ic:"token" json:"token"` } `ic:"Callback,variant"` } type Time = idl.Int type UnsetAssetContentArguments struct { - Key Key `ic:"key"` - ContentEncoding string `ic:"content_encoding"` + Key Key `ic:"key" json:"key"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` } type ValidationResult struct { diff --git a/ic/wallet/agent_test.go b/ic/wallet/agent_test.go index 7e760fe..127af7f 100755 --- a/ic/wallet/agent_test.go +++ b/ic/wallet/agent_test.go @@ -65,8 +65,8 @@ func Test_CertifiedTree(t *testing.T) { })}, Handler: func(request mock.Request) ([]any, error) { return []any{struct { - Certificate []byte `ic:"certificate"` - Tree []byte `ic:"tree"` + Certificate []byte `ic:"certificate" json:"certificate"` + Tree []byte `ic:"tree" json:"tree"` }{ *new([]byte), *new([]byte), @@ -230,7 +230,7 @@ func Test_CreateBatch(t *testing.T) { })}, Handler: func(request mock.Request) ([]any, error) { return []any{struct { - BatchId wallet.BatchId `ic:"batch_id"` + BatchId wallet.BatchId `ic:"batch_id" json:"batch_id"` }{ idl.NewNat(uint(0)), }}, nil @@ -255,12 +255,12 @@ func Test_CreateChunk(t *testing.T) { { Name: "create_chunk", Arguments: []any{new(struct { - BatchId wallet.BatchId `ic:"batch_id"` - Content []byte `ic:"content"` + BatchId wallet.BatchId `ic:"batch_id" json:"batch_id"` + Content []byte `ic:"content" json:"content"` })}, Handler: func(request mock.Request) ([]any, error) { return []any{struct { - ChunkId wallet.ChunkId `ic:"chunk_id"` + ChunkId wallet.ChunkId `ic:"chunk_id" json:"chunk_id"` }{ idl.NewNat(uint(0)), }}, nil @@ -272,8 +272,8 @@ func Test_CreateChunk(t *testing.T) { } var a0 = struct { - BatchId wallet.BatchId `ic:"batch_id"` - Content []byte `ic:"content"` + BatchId wallet.BatchId `ic:"batch_id" json:"batch_id"` + Content []byte `ic:"content" json:"content"` }{ idl.NewNat(uint(0)), *new([]byte), @@ -360,16 +360,16 @@ func Test_Get(t *testing.T) { { Name: "get", Arguments: []any{new(struct { - Key wallet.Key `ic:"key"` - AcceptEncodings []string `ic:"accept_encodings"` + Key wallet.Key `ic:"key" json:"key"` + AcceptEncodings []string `ic:"accept_encodings" json:"accept_encodings"` })}, Handler: func(request mock.Request) ([]any, error) { return []any{struct { - Content []byte `ic:"content"` - ContentType string `ic:"content_type"` - ContentEncoding string `ic:"content_encoding"` - Sha256 *[]byte `ic:"sha256,omitempty"` - TotalLength idl.Nat `ic:"total_length"` + Content []byte `ic:"content" json:"content"` + ContentType string `ic:"content_type" json:"content_type"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` + TotalLength idl.Nat `ic:"total_length" json:"total_length"` }{ *new([]byte), *new(string), @@ -385,8 +385,8 @@ func Test_Get(t *testing.T) { } var a0 = struct { - Key wallet.Key `ic:"key"` - AcceptEncodings []string `ic:"accept_encodings"` + Key wallet.Key `ic:"key" json:"key"` + AcceptEncodings []string `ic:"accept_encodings" json:"accept_encodings"` }{ *new(string), []string{*new(string)}, @@ -405,10 +405,10 @@ func Test_GetAssetProperties(t *testing.T) { Arguments: []any{new(wallet.Key)}, Handler: func(request mock.Request) ([]any, error) { return []any{struct { - MaxAge *uint64 `ic:"max_age,omitempty"` - Headers *[]wallet.HeaderField `ic:"headers,omitempty"` - AllowRawAccess *bool `ic:"allow_raw_access,omitempty"` - IsAliased *bool `ic:"is_aliased,omitempty"` + MaxAge *uint64 `ic:"max_age,omitempty" json:"max_age,omitempty"` + Headers *[]wallet.HeaderField `ic:"headers,omitempty" json:"headers,omitempty"` + AllowRawAccess *bool `ic:"allow_raw_access,omitempty" json:"allow_raw_access,omitempty"` + IsAliased *bool `ic:"is_aliased,omitempty" json:"is_aliased,omitempty"` }{ *new(*uint64), *new(*[]wallet.HeaderField), @@ -435,14 +435,14 @@ func Test_GetChunk(t *testing.T) { { Name: "get_chunk", Arguments: []any{new(struct { - Key wallet.Key `ic:"key"` - ContentEncoding string `ic:"content_encoding"` - Index idl.Nat `ic:"index"` - Sha256 *[]byte `ic:"sha256,omitempty"` + Key wallet.Key `ic:"key" json:"key"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Index idl.Nat `ic:"index" json:"index"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` })}, Handler: func(request mock.Request) ([]any, error) { return []any{struct { - Content []byte `ic:"content"` + Content []byte `ic:"content" json:"content"` }{ *new([]byte), }}, nil @@ -454,10 +454,10 @@ func Test_GetChunk(t *testing.T) { } var a0 = struct { - Key wallet.Key `ic:"key"` - ContentEncoding string `ic:"content_encoding"` - Index idl.Nat `ic:"index"` - Sha256 *[]byte `ic:"sha256,omitempty"` + Key wallet.Key `ic:"key" json:"key"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Index idl.Nat `ic:"index" json:"index"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` }{ *new(string), *new(string), @@ -572,24 +572,24 @@ func Test_List(t *testing.T) { })}, Handler: func(request mock.Request) ([]any, error) { return []any{[]struct { - Key wallet.Key `ic:"key"` - ContentType string `ic:"content_type"` + Key wallet.Key `ic:"key" json:"key"` + ContentType string `ic:"content_type" json:"content_type"` Encodings []struct { - ContentEncoding string `ic:"content_encoding"` - Sha256 *[]byte `ic:"sha256,omitempty"` - Length idl.Nat `ic:"length"` - Modified wallet.Time `ic:"modified"` - } `ic:"encodings"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` + Length idl.Nat `ic:"length" json:"length"` + Modified wallet.Time `ic:"modified" json:"modified"` + } `ic:"encodings" json:"encodings"` }{ { *new(string), *new(string), []struct { - ContentEncoding string `ic:"content_encoding"` - Sha256 *[]byte `ic:"sha256,omitempty"` - Length idl.Nat `ic:"length"` - Modified wallet.Time `ic:"modified"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` + Length idl.Nat `ic:"length" json:"length"` + Modified wallet.Time `ic:"modified" json:"modified"` }{ { @@ -783,11 +783,11 @@ func Test_Store(t *testing.T) { { Name: "store", Arguments: []any{new(struct { - Key wallet.Key `ic:"key"` - ContentType string `ic:"content_type"` - ContentEncoding string `ic:"content_encoding"` - Content []byte `ic:"content"` - Sha256 *[]byte `ic:"sha256,omitempty"` + Key wallet.Key `ic:"key" json:"key"` + ContentType string `ic:"content_type" json:"content_type"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Content []byte `ic:"content" json:"content"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` })}, Handler: func(request mock.Request) ([]any, error) { return []any{}, nil @@ -799,11 +799,11 @@ func Test_Store(t *testing.T) { } var a0 = struct { - Key wallet.Key `ic:"key"` - ContentType string `ic:"content_type"` - ContentEncoding string `ic:"content_encoding"` - Content []byte `ic:"content"` - Sha256 *[]byte `ic:"sha256,omitempty"` + Key wallet.Key `ic:"key" json:"key"` + ContentType string `ic:"content_type" json:"content_type"` + ContentEncoding string `ic:"content_encoding" json:"content_encoding"` + Content []byte `ic:"content" json:"content"` + Sha256 *[]byte `ic:"sha256,omitempty" json:"sha256,omitempty"` }{ *new(string), *new(string),