diff --git a/cmd/eskimo-hut/api/docs.go b/cmd/eskimo-hut/api/docs.go index f89c7256..5f387d26 100644 --- a/cmd/eskimo-hut/api/docs.go +++ b/cmd/eskimo-hut/api/docs.go @@ -1197,6 +1197,11 @@ const docTemplate = `{ "name": "clearMiningBlockchainAccountAddress", "in": "formData" }, + { + "type": "boolean", + "name": "clearSolanaMiningBlockchainAccountAddress", + "in": "formData" + }, { "type": "string", "description": "Optional. Example: ` + "`" + `{\"key1\":{\"something\":\"somethingElse\"},\"key2\":\"value\"}` + "`" + `.", @@ -1279,6 +1284,11 @@ const docTemplate = `{ "name": "resetProfilePicture", "in": "formData" }, + { + "type": "string", + "name": "solanaMiningBlockchainAccountAddress", + "in": "formData" + }, { "type": "string", "description": "Optional. Example:` + "`" + `jdoe` + "`" + `.", @@ -1781,6 +1791,10 @@ const docTemplate = `{ "type": "string" } }, + "solanaMiningBlockchainAccountAddress": { + "type": "string", + "example": "0x4B73C58370AEfcEf86A6021afCDe5673511376B2" + }, "updatedAt": { "type": "string", "example": "2022-01-03T16:20:52.156534Z" @@ -2104,6 +2118,10 @@ const docTemplate = `{ "type": "string" } }, + "solanaMiningBlockchainAccountAddress": { + "type": "string", + "example": "0x4B73C58370AEfcEf86A6021afCDe5673511376B2" + }, "updatedAt": { "type": "string", "example": "2022-01-03T16:20:52.156534Z" diff --git a/cmd/eskimo-hut/api/swagger.json b/cmd/eskimo-hut/api/swagger.json index af7fa2ab..55aa514f 100644 --- a/cmd/eskimo-hut/api/swagger.json +++ b/cmd/eskimo-hut/api/swagger.json @@ -1191,6 +1191,11 @@ "name": "clearMiningBlockchainAccountAddress", "in": "formData" }, + { + "type": "boolean", + "name": "clearSolanaMiningBlockchainAccountAddress", + "in": "formData" + }, { "type": "string", "description": "Optional. Example: `{\"key1\":{\"something\":\"somethingElse\"},\"key2\":\"value\"}`.", @@ -1273,6 +1278,11 @@ "name": "resetProfilePicture", "in": "formData" }, + { + "type": "string", + "name": "solanaMiningBlockchainAccountAddress", + "in": "formData" + }, { "type": "string", "description": "Optional. Example:`jdoe`.", @@ -1775,6 +1785,10 @@ "type": "string" } }, + "solanaMiningBlockchainAccountAddress": { + "type": "string", + "example": "0x4B73C58370AEfcEf86A6021afCDe5673511376B2" + }, "updatedAt": { "type": "string", "example": "2022-01-03T16:20:52.156534Z" @@ -2098,6 +2112,10 @@ "type": "string" } }, + "solanaMiningBlockchainAccountAddress": { + "type": "string", + "example": "0x4B73C58370AEfcEf86A6021afCDe5673511376B2" + }, "updatedAt": { "type": "string", "example": "2022-01-03T16:20:52.156534Z" diff --git a/cmd/eskimo-hut/api/swagger.yaml b/cmd/eskimo-hut/api/swagger.yaml index 5dcdd585..0e049c23 100644 --- a/cmd/eskimo-hut/api/swagger.yaml +++ b/cmd/eskimo-hut/api/swagger.yaml @@ -160,6 +160,9 @@ definitions: additionalProperties: type: string type: object + solanaMiningBlockchainAccountAddress: + example: 0x4B73C58370AEfcEf86A6021afCDe5673511376B2 + type: string updatedAt: example: "2022-01-03T16:20:52.156534Z" type: string @@ -381,6 +384,9 @@ definitions: additionalProperties: type: string type: object + solanaMiningBlockchainAccountAddress: + example: 0x4B73C58370AEfcEf86A6021afCDe5673511376B2 + type: string updatedAt: example: "2022-01-03T16:20:52.156534Z" type: string @@ -1346,6 +1352,9 @@ paths: - in: formData name: clearMiningBlockchainAccountAddress type: boolean + - in: formData + name: clearSolanaMiningBlockchainAccountAddress + type: boolean - description: 'Optional. Example: `{"key1":{"something":"somethingElse"},"key2":"value"}`.' in: formData name: clientData @@ -1402,6 +1411,9 @@ paths: in: formData name: resetProfilePicture type: boolean + - in: formData + name: solanaMiningBlockchainAccountAddress + type: string - description: Optional. Example:`jdoe`. in: formData name: username diff --git a/cmd/eskimo-hut/contract.go b/cmd/eskimo-hut/contract.go index b1725a34..c2db4689 100644 --- a/cmd/eskimo-hut/contract.go +++ b/cmd/eskimo-hut/contract.go @@ -56,9 +56,10 @@ type ( // Optional. Example:`did:ethr:0x4B73C58370AEfcEf86A6021afCDe5673511376B2`. ReferredBy string `form:"referredBy" formMultipart:"referredBy"` // Optional. Example: Array of [`globalRank`,`referralCount`,`level`,`role`,`badges`]. - HiddenProfileElements *users.Enum[users.HiddenProfileElement] `form:"hiddenProfileElements" formMultipart:"hiddenProfileElements" swaggertype:"array,string" enums:"globalRank,referralCount,level,role,badges"` //nolint:lll // . - ClearHiddenProfileElements *bool `form:"clearHiddenProfileElements" formMultipart:"clearHiddenProfileElements"` - ClearMiningBlockchainAccountAddress *bool `form:"clearMiningBlockchainAccountAddress" formMultipart:"clearMiningBlockchainAccountAddress"` //nolint:lll //. + HiddenProfileElements *users.Enum[users.HiddenProfileElement] `form:"hiddenProfileElements" formMultipart:"hiddenProfileElements" swaggertype:"array,string" enums:"globalRank,referralCount,level,role,badges"` //nolint:lll // . + ClearHiddenProfileElements *bool `form:"clearHiddenProfileElements" formMultipart:"clearHiddenProfileElements"` + ClearMiningBlockchainAccountAddress *bool `form:"clearMiningBlockchainAccountAddress" formMultipart:"clearMiningBlockchainAccountAddress"` //nolint:lll //. + ClearSolanaMiningBlockchainAccountAddress *bool `form:"clearSolanaMiningBlockchainAccountAddress" formMultipart:"clearSolanaMiningBlockchainAccountAddress"` //nolint:lll //. // Optional. Example: `{"key1":{"something":"somethingElse"},"key2":"value"}`. ClientData *string `form:"clientData" formMultipart:"clientData"` clientData *users.JSON //nolint:revive // It's meant for internal use only. @@ -85,8 +86,9 @@ type ( // Optional. Example:`Ef86A6021afCDe5673511376B2,Ef86A6021afCDe5673511376B2,Ef86A6021afCDe5673511376B2,Ef86A6021afCDe5673511376B2`. AgendaPhoneNumberHashes string `form:"agendaPhoneNumberHashes" formMultipart:"agendaPhoneNumberHashes"` // Optional. Example:`some hash`. - BlockchainAccountAddress string `form:"blockchainAccountAddress" formMultipart:"blockchainAccountAddress"` - MiningBlockchainAccountAddress string `form:"miningBlockchainAccountAddress" formMultipart:"miningBlockchainAccountAddress"` + BlockchainAccountAddress string `form:"blockchainAccountAddress" formMultipart:"blockchainAccountAddress"` + MiningBlockchainAccountAddress string `form:"miningBlockchainAccountAddress" formMultipart:"miningBlockchainAccountAddress"` + SolanaMiningBlockchainAccountAddress string `form:"solanaMiningBlockchainAccountAddress" formMultipart:"solanaMiningBlockchainAccountAddress"` // Optional. Example:`en`. Language string `form:"language" formMultipart:"language"` // Optional. Example:`1232412415326543647657`. diff --git a/cmd/eskimo-hut/users.go b/cmd/eskimo-hut/users.go index d8a0cc01..3c60c236 100644 --- a/cmd/eskimo-hut/users.go +++ b/cmd/eskimo-hut/users.go @@ -286,9 +286,13 @@ func buildUserForModification(req *server.Request[ModifyUserRequestBody, ModifyU usr.AgendaPhoneNumberHashes = &req.Data.AgendaPhoneNumberHashes usr.BlockchainAccountAddress = req.Data.BlockchainAccountAddress usr.MiningBlockchainAccountAddress = strings.ToLower(req.Data.MiningBlockchainAccountAddress) + usr.SolanaMiningBlockchainAccountAddress = strings.ToLower(req.Data.SolanaMiningBlockchainAccountAddress) if req.Data.ClearMiningBlockchainAccountAddress != nil && *req.Data.ClearMiningBlockchainAccountAddress { usr.MiningBlockchainAccountAddress = usr.ID } + if req.Data.ClearSolanaMiningBlockchainAccountAddress != nil && *req.Data.ClearSolanaMiningBlockchainAccountAddress { + usr.SolanaMiningBlockchainAccountAddress = usr.ID + } usr.Language = req.Data.Language if req.Data.ClearHiddenProfileElements != nil && *req.Data.ClearHiddenProfileElements { empty := make(users.Enum[users.HiddenProfileElement], 0, 0) //nolint:gosimple // . @@ -330,7 +334,9 @@ func (a *ModifyUserRequestBody) verifyIfAtLeastOnePropertyProvided() *server.Res a.AgendaPhoneNumberHashes == "" && a.BlockchainAccountAddress == "" && a.MiningBlockchainAccountAddress == "" && + a.SolanaMiningBlockchainAccountAddress == "" && a.ClearMiningBlockchainAccountAddress == nil && + a.ClearSolanaMiningBlockchainAccountAddress == nil && a.HiddenProfileElements == nil && a.ClearHiddenProfileElements == nil && a.ClientData == nil && diff --git a/cmd/eskimo/api/docs.go b/cmd/eskimo/api/docs.go index c204d0f1..0aca1240 100644 --- a/cmd/eskimo/api/docs.go +++ b/cmd/eskimo/api/docs.go @@ -762,6 +762,10 @@ const docTemplate = `{ "type": "string" } }, + "solanaMiningBlockchainAccountAddress": { + "type": "string", + "example": "0x4B73C58370AEfcEf86A6021afCDe5673511376B2" + }, "t1ReferralCount": { "type": "integer", "example": 100 @@ -1112,6 +1116,10 @@ const docTemplate = `{ "type": "string" } }, + "solanaMiningBlockchainAccountAddress": { + "type": "string", + "example": "0x4B73C58370AEfcEf86A6021afCDe5673511376B2" + }, "t1ReferralCount": { "type": "integer", "example": 100 diff --git a/cmd/eskimo/api/swagger.json b/cmd/eskimo/api/swagger.json index 4a00adbe..b99858a8 100644 --- a/cmd/eskimo/api/swagger.json +++ b/cmd/eskimo/api/swagger.json @@ -756,6 +756,10 @@ "type": "string" } }, + "solanaMiningBlockchainAccountAddress": { + "type": "string", + "example": "0x4B73C58370AEfcEf86A6021afCDe5673511376B2" + }, "t1ReferralCount": { "type": "integer", "example": 100 @@ -1106,6 +1110,10 @@ "type": "string" } }, + "solanaMiningBlockchainAccountAddress": { + "type": "string", + "example": "0x4B73C58370AEfcEf86A6021afCDe5673511376B2" + }, "t1ReferralCount": { "type": "integer", "example": 100 diff --git a/cmd/eskimo/api/swagger.yaml b/cmd/eskimo/api/swagger.yaml index 5e37a4ab..830e7a64 100644 --- a/cmd/eskimo/api/swagger.yaml +++ b/cmd/eskimo/api/swagger.yaml @@ -87,6 +87,9 @@ definitions: additionalProperties: type: string type: object + solanaMiningBlockchainAccountAddress: + example: 0x4B73C58370AEfcEf86A6021afCDe5673511376B2 + type: string t1ReferralCount: example: 100 type: integer @@ -340,6 +343,9 @@ definitions: additionalProperties: type: string type: object + solanaMiningBlockchainAccountAddress: + example: 0x4B73C58370AEfcEf86A6021afCDe5673511376B2 + type: string t1ReferralCount: example: 100 type: integer diff --git a/go.mod b/go.mod index bcc6028b..9a014ccd 100644 --- a/go.mod +++ b/go.mod @@ -45,11 +45,11 @@ require ( github.com/chenzhuoyu/iasm v0.9.1 // indirect github.com/cloudflare/circl v1.3.7 // indirect github.com/containerd/cgroups v1.1.0 // indirect - github.com/containerd/containerd v1.7.12 // indirect + github.com/containerd/containerd v1.7.13 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/distribution/reference v0.5.0 // indirect github.com/docker/distribution v2.8.3+incompatible // indirect - github.com/docker/docker v25.0.1+incompatible // indirect + github.com/docker/docker v25.0.2+incompatible // indirect github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect diff --git a/users/DDL.sql b/users/DDL.sql index 030fe68d..275e36f4 100644 --- a/users/DDL.sql +++ b/users/DDL.sql @@ -26,6 +26,7 @@ CREATE TABLE IF NOT EXISTS users ( kyc_steps_last_updated_at timestamp[], kyc_steps_created_at timestamp[], mining_blockchain_account_address text NOT NULL UNIQUE, + solana_mining_blockchain_account_address text NOT NULL UNIQUE, blockchain_account_address text NOT NULL UNIQUE, language text NOT NULL DEFAULT 'en', lookup tsvector NOT NULL) @@ -47,9 +48,9 @@ END $$; ALTER TABLE users ADD COLUMN IF NOT EXISTS kyc_step_blocked smallint NOT NULL DEFAULT 0; ALTER TABLE users ADD COLUMN IF NOT EXISTS kyc_steps_last_updated_at timestamp[]; ALTER TABLE users ADD COLUMN IF NOT EXISTS kyc_steps_created_at timestamp[]; -INSERT INTO users (created_at,updated_at,phone_number,phone_number_hash,email,id,username,profile_picture_name,referred_by,city,country,mining_blockchain_account_address,blockchain_account_address, lookup) - VALUES (current_timestamp,current_timestamp,'bogus','bogus','bogus','bogus','bogus','bogus.jpg','bogus','bogus','RO','bogus','bogus',to_tsvector('bogus')), - (current_timestamp,current_timestamp,'icenetwork','icenetwork','icenetwork','icenetwork','icenetwork','icenetwork.jpg','icenetwork','icenetwork','RO','icenetwork','icenetwork',to_tsvector('icenetwork')) +INSERT INTO users (created_at,updated_at,phone_number,phone_number_hash,email,id,username,profile_picture_name,referred_by,city,country,mining_blockchain_account_address,blockchain_account_address,solana_mining_blockchain_account_address,lookup) + VALUES (current_timestamp,current_timestamp,'bogus','bogus','bogus','bogus','bogus','bogus.jpg','bogus','bogus','RO','bogus','bogus','bogus',to_tsvector('bogus')), + (current_timestamp,current_timestamp,'icenetwork','icenetwork','icenetwork','icenetwork','icenetwork','icenetwork.jpg','icenetwork','icenetwork','RO','icenetwork','icenetwork','icenetwork',to_tsvector('icenetwork')) ON CONFLICT DO NOTHING; CREATE INDEX IF NOT EXISTS users_referred_by_ix ON users (referred_by); CREATE EXTENSION IF NOT EXISTS btree_gin; diff --git a/users/contract.go b/users/contract.go index 58d92380..cb2ca37d 100644 --- a/users/contract.go +++ b/users/contract.go @@ -121,15 +121,16 @@ type ( RepeatableKYCSteps *map[KYCStep]*time.Time `json:"repeatableKYCSteps,omitempty" db:"-"` //nolint:tagliatelle // Nope. PrivateUserInformation PublicUserInformation - ReferredBy UserID `json:"referredBy,omitempty" example:"did:ethr:0x4B73C58370AEfcEf86A6021afCDe5673511376B2" db:"referred_by"` - PhoneNumberHash string `json:"phoneNumberHash,omitempty" example:"Ef86A6021afCDe5673511376B2" swaggerignore:"true" db:"phone_number_hash"` - AgendaPhoneNumberHashes *string `json:"agendaPhoneNumberHashes,omitempty" example:"Ef86A6021afCDe5673511376B2,Ef86A6021afCDe5673511376B2,Ef86A6021afCDe5673511376B2,Ef86A6021afCDe5673511376B2" db:"-"` //nolint:lll // . - MiningBlockchainAccountAddress string `json:"miningBlockchainAccountAddress,omitempty" example:"0x4B73C58370AEfcEf86A6021afCDe5673511376B2" db:"mining_blockchain_account_address"` //nolint:lll // . - BlockchainAccountAddress string `json:"blockchainAccountAddress,omitempty" example:"0x4B73C58370AEfcEf86A6021afCDe5673511376B2" db:"blockchain_account_address"` //nolint:lll // . - Language string `json:"language,omitempty" example:"en" db:"language"` - Lookup string `json:"-" example:"username" db:"lookup"` - AgendaContactUserIDs []string `json:"agendaContactUserIDs,omitempty" swaggerignore:"true" db:"agenda_contact_user_ids"` - HashCode int64 `json:"hashCode,omitempty" example:"43453546464576547" swaggerignore:"true" db:"hash_code"` + ReferredBy UserID `json:"referredBy,omitempty" example:"did:ethr:0x4B73C58370AEfcEf86A6021afCDe5673511376B2" db:"referred_by"` + PhoneNumberHash string `json:"phoneNumberHash,omitempty" example:"Ef86A6021afCDe5673511376B2" swaggerignore:"true" db:"phone_number_hash"` + AgendaPhoneNumberHashes *string `json:"agendaPhoneNumberHashes,omitempty" example:"Ef86A6021afCDe5673511376B2,Ef86A6021afCDe5673511376B2,Ef86A6021afCDe5673511376B2,Ef86A6021afCDe5673511376B2" db:"-"` //nolint:lll // . + MiningBlockchainAccountAddress string `json:"miningBlockchainAccountAddress,omitempty" example:"0x4B73C58370AEfcEf86A6021afCDe5673511376B2" db:"mining_blockchain_account_address"` //nolint:lll // . + BlockchainAccountAddress string `json:"blockchainAccountAddress,omitempty" example:"0x4B73C58370AEfcEf86A6021afCDe5673511376B2" db:"blockchain_account_address"` //nolint:lll // . + SolanaMiningBlockchainAccountAddress string `json:"solanaMiningBlockchainAccountAddress,omitempty" example:"0x4B73C58370AEfcEf86A6021afCDe5673511376B2" db:"solana_mining_blockchain_account_address"` //nolint:lll // . + Language string `json:"language,omitempty" example:"en" db:"language"` + Lookup string `json:"-" example:"username" db:"lookup"` + AgendaContactUserIDs []string `json:"agendaContactUserIDs,omitempty" swaggerignore:"true" db:"agenda_contact_user_ids"` + HashCode int64 `json:"hashCode,omitempty" example:"43453546464576547" swaggerignore:"true" db:"hash_code"` } MinimalUserProfile struct { Verified *bool `json:"verified,omitempty" example:"true"` diff --git a/users/users.go b/users/users.go index 191c9864..b4bf353d 100644 --- a/users/users.go +++ b/users/users.go @@ -321,6 +321,9 @@ func (r *repository) sanitizeUser(usr *User) *User { if usr.MiningBlockchainAccountAddress == usr.ID { usr.MiningBlockchainAccountAddress = "" } + if usr.SolanaMiningBlockchainAccountAddress == usr.ID { + usr.SolanaMiningBlockchainAccountAddress = "" + } if usr.PhoneNumber == usr.ID { usr.PhoneNumber = "" } diff --git a/users/users_create.go b/users/users_create.go index 462e0236..61d60421 100644 --- a/users/users_create.go +++ b/users/users_create.go @@ -24,11 +24,11 @@ func (r *repository) CreateUser(ctx context.Context, usr *User, clientIP net.IP) r.setCreateUserDefaults(ctx, usr, clientIP) sql := ` INSERT INTO users - (ID, MINING_BLOCKCHAIN_ACCOUNT_ADDRESS, BLOCKCHAIN_ACCOUNT_ADDRESS, EMAIL, FIRST_NAME, LAST_NAME, PHONE_NUMBER, PHONE_NUMBER_HASH, USERNAME, REFERRED_BY, RANDOM_REFERRED_BY, CLIENT_DATA, PROFILE_PICTURE_NAME, COUNTRY, CITY, LANGUAGE, CREATED_AT, UPDATED_AT, LOOKUP) + (ID, MINING_BLOCKCHAIN_ACCOUNT_ADDRESS, BLOCKCHAIN_ACCOUNT_ADDRESS, SOLANA_MINING_BLOCKCHAIN_ACCOUNT_ADDRESS, EMAIL, FIRST_NAME, LAST_NAME, PHONE_NUMBER, PHONE_NUMBER_HASH, USERNAME, REFERRED_BY, RANDOM_REFERRED_BY, CLIENT_DATA, PROFILE_PICTURE_NAME, COUNTRY, CITY, LANGUAGE, CREATED_AT, UPDATED_AT, LOOKUP) VALUES - ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12::json, $13, $14, $15, $16, $17, $18, $19::tsvector)` + ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13::json, $14, $15, $16, $17, $18, $19, $20::tsvector)` args := []any{ - usr.ID, usr.MiningBlockchainAccountAddress, usr.BlockchainAccountAddress, usr.Email, usr.FirstName, usr.LastName, + usr.ID, usr.MiningBlockchainAccountAddress, usr.BlockchainAccountAddress, usr.SolanaMiningBlockchainAccountAddress, usr.Email, usr.FirstName, usr.LastName, usr.PhoneNumber, usr.PhoneNumberHash, usr.Username, usr.ReferredBy, usr.RandomReferredBy, usr.ClientData, usr.ProfilePictureURL, usr.Country, usr.City, usr.Language, usr.CreatedAt.Time, usr.UpdatedAt.Time, usr.lookup(), } @@ -67,6 +67,9 @@ func (r *repository) setCreateUserDefaults(ctx context.Context, usr *User, clien if usr.MiningBlockchainAccountAddress == "" { usr.MiningBlockchainAccountAddress = usr.ID } + if usr.SolanaMiningBlockchainAccountAddress == "" { + usr.SolanaMiningBlockchainAccountAddress = usr.ID + } if usr.Language == "" { usr.Language = "en" } @@ -99,6 +102,8 @@ func detectAndParseDuplicateDatabaseError(err error) (field string, newErr error field = "mining_blockchain_account_address" } else if storage.IsErr(err, storage.ErrDuplicate, "blockchainaccountaddress") { field = "blockchainAccountAddress" + } else if storage.IsErr(err, storage.ErrDuplicate, "solanaminingblockchainaccountaddress") { + field = "solana_mining_blockchain_account_address" } else { log.Panic("unexpected duplicate field for users space: %v", err) } diff --git a/users/users_modify.go b/users/users_modify.go index a7c3ae17..5519c311 100644 --- a/users/users_modify.go +++ b/users/users_modify.go @@ -34,6 +34,10 @@ func (r *repository) ModifyUser(ctx context.Context, usr *User, profilePicture * usr.MiningBlockchainAccountAddress != "" && usr.MiningBlockchainAccountAddress != oldUsr.MiningBlockchainAccountAddress { return errors.Errorf("changing the miningBlockchainAccountAddress a second time is not allowed") } + if oldUsr.SolanaMiningBlockchainAccountAddress != "" && oldUsr.SolanaMiningBlockchainAccountAddress != oldUsr.ID && + usr.SolanaMiningBlockchainAccountAddress != "" && usr.SolanaMiningBlockchainAccountAddress != oldUsr.SolanaMiningBlockchainAccountAddress { + return errors.Errorf("changing the solanaMiningBlockchainAccountAddress a second time is not allowed") + } } lu := lastUpdatedAt(ctx) if lu != nil && oldUsr.UpdatedAt.UnixNano() != lu.UnixNano() { @@ -140,6 +144,7 @@ func (u *User) override(user *User) *User { usr.PhoneNumberHash = mergeStringField(u.PhoneNumberHash, user.PhoneNumberHash) usr.BlockchainAccountAddress = mergeStringField(u.BlockchainAccountAddress, user.BlockchainAccountAddress) usr.MiningBlockchainAccountAddress = mergeStringField(u.MiningBlockchainAccountAddress, user.MiningBlockchainAccountAddress) + usr.SolanaMiningBlockchainAccountAddress = mergeStringField(u.SolanaMiningBlockchainAccountAddress, user.SolanaMiningBlockchainAccountAddress) return usr } @@ -249,6 +254,11 @@ func (u *User) genSQLUpdate(ctx context.Context, agendaUserIDs []UserID) (sql st sql += fmt.Sprintf(", MINING_BLOCKCHAIN_ACCOUNT_ADDRESS = $%v", nextIndex) nextIndex++ } + if u.SolanaMiningBlockchainAccountAddress != "" { + params = append(params, u.SolanaMiningBlockchainAccountAddress) + sql += fmt.Sprintf(", SOLANA_MINING_BLOCKCHAIN_ACCOUNT_ADDRESS = $%v", nextIndex) + nextIndex++ + } if u.KYCStepsLastUpdatedAt != nil { if *u.KYCStepsLastUpdatedAt == nil { sql += ", KYC_STEPS_LAST_UPDATED_AT = NULL"