Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
filippo.io/edwards25519 v1.1.0
github.com/aws/aws-sdk-go-v2 v0.17.0
github.com/code-payments/code-vm-indexer v1.2.0
github.com/code-payments/ocp-protobuf-api v1.1.0
github.com/code-payments/ocp-protobuf-api v1.1.1-0.20260304181551-b9bda6eb3667
github.com/emirpasic/gods v1.12.0
github.com/envoyproxy/protoc-gen-validate v1.2.1
github.com/golang/protobuf v1.5.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/code-payments/code-vm-indexer v1.2.0 h1:rSHpBMiT9BKgmKcXg/VIoi/h0t7jNxGx07Qz59m+6Q0=
github.com/code-payments/code-vm-indexer v1.2.0/go.mod h1:vn91YN2qNqb+gGJeZe2+l+TNxVmEEiRHXXnIn2Y40h8=
github.com/code-payments/ocp-protobuf-api v1.1.0 h1:K9GUH7FX84hqXfR6Kgc/aTXE0lus3wU3lqcvFcf7szg=
github.com/code-payments/ocp-protobuf-api v1.1.0/go.mod h1:tw6BooY5a8l6CtSZnKOruyKII0W04n89pcM4BizrgG8=
github.com/code-payments/ocp-protobuf-api v1.1.1-0.20260304181551-b9bda6eb3667 h1:uGnk9MQEfKnuAay6PQBj3HZqCvexVL40VfTShFrsj/Y=
github.com/code-payments/ocp-protobuf-api v1.1.1-0.20260304181551-b9bda6eb3667/go.mod h1:tw6BooY5a8l6CtSZnKOruyKII0W04n89pcM4BizrgG8=
github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6 h1:NmTXa/uVnDyp0TY5MKi197+3HWcnYWfnHGyaFthlnGw=
github.com/containerd/continuity v0.0.0-20190827140505-75bee3e2ccb6/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
Expand Down
2 changes: 2 additions & 0 deletions ocp/data/currency/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const (
SocialLinkTypeUnknown SocialLinkType = iota
SocialLinkTypeWebsite
SocialLinkTypeX
SocialLinkTypeTelegram
SocialLinkTypeDiscord
)

type SocialLink struct {
Expand Down
10 changes: 10 additions & 0 deletions ocp/data/currency/tests/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ func testMetadataRoundTrip(t *testing.T, s currency.Store) {
SocialLinks: []currency.SocialLink{
{Type: currency.SocialLinkTypeWebsite, Value: "https://flipcash.com"},
{Type: currency.SocialLinkTypeX, Value: "jeffycurrency"},
{Type: currency.SocialLinkTypeTelegram, Value: "jeffycurrency"},
{Type: currency.SocialLinkTypeDiscord, Value: "abc123"},
},

Seed: "H7WNaHtCa5h2k7AwZ8DbdLfM6bU2bi2jmWiUkFqgeBYk",
Expand Down Expand Up @@ -765,6 +767,8 @@ func testMetadataSaveWithVersioning(t *testing.T, s currency.Store) {
record.SocialLinks = []currency.SocialLink{
{Type: currency.SocialLinkTypeWebsite, Value: "https://updated.example.com"},
{Type: currency.SocialLinkTypeX, Value: "updatedhandle"},
{Type: currency.SocialLinkTypeTelegram, Value: "updatedtelegram"},
{Type: currency.SocialLinkTypeDiscord, Value: "updateddiscord"},
}
record.Alt = "updatedalt1111111111111111111111111111111111111"
require.NoError(t, s.SaveMetadata(context.Background(), record))
Expand All @@ -782,6 +786,8 @@ func testMetadataSaveWithVersioning(t *testing.T, s currency.Store) {
assert.Equal(t, []currency.SocialLink{
{Type: currency.SocialLinkTypeWebsite, Value: "https://updated.example.com"},
{Type: currency.SocialLinkTypeX, Value: "updatedhandle"},
{Type: currency.SocialLinkTypeTelegram, Value: "updatedtelegram"},
{Type: currency.SocialLinkTypeDiscord, Value: "updateddiscord"},
}, actual.SocialLinks)
assert.Equal(t, "updatedalt1111111111111111111111111111111111111", actual.Alt)

Expand All @@ -796,6 +802,8 @@ func testMetadataSaveWithVersioning(t *testing.T, s currency.Store) {
record.SocialLinks = []currency.SocialLink{
{Type: currency.SocialLinkTypeWebsite, Value: "https://updated2.example.com"},
{Type: currency.SocialLinkTypeX, Value: "updatedhandle2"},
{Type: currency.SocialLinkTypeTelegram, Value: "staletelegram"},
{Type: currency.SocialLinkTypeDiscord, Value: "stalediscord"},
}
record.Alt = "stalealt1111111111111111111111111111111111111111"
record.State = currency.MetadataStateUnknown
Expand All @@ -813,6 +821,8 @@ func testMetadataSaveWithVersioning(t *testing.T, s currency.Store) {
assert.Equal(t, []currency.SocialLink{
{Type: currency.SocialLinkTypeWebsite, Value: "https://updated.example.com"},
{Type: currency.SocialLinkTypeX, Value: "updatedhandle"},
{Type: currency.SocialLinkTypeTelegram, Value: "updatedtelegram"},
{Type: currency.SocialLinkTypeDiscord, Value: "updateddiscord"},
}, actual.SocialLinks)
assert.Equal(t, "updatedalt1111111111111111111111111111111111111", actual.Alt)
}
Expand Down
22 changes: 22 additions & 0 deletions ocp/rpc/currency/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,18 @@ func (s *currencyServer) GetMints(ctx context.Context, req *currencypb.GetMintsR
X: &currencypb.SocialLink_X{Username: link.Value},
},
})
case currency.SocialLinkTypeTelegram:
protoMetadata.SocialLinks = append(protoMetadata.SocialLinks, &currencypb.SocialLink{
Type: &currencypb.SocialLink_Telegram_{
Telegram: &currencypb.SocialLink_Telegram{Username: link.Value},
},
})
case currency.SocialLinkTypeDiscord:
protoMetadata.SocialLinks = append(protoMetadata.SocialLinks, &currencypb.SocialLink{
Type: &currencypb.SocialLink_Discord_{
Discord: &currencypb.SocialLink_Discord{InviteCode: link.Value},
},
})
}
}
}
Expand Down Expand Up @@ -297,6 +309,16 @@ func (s *currencyServer) UpdateMetadata(ctx context.Context, req *currencypb.Upd
Type: currency.SocialLinkTypeX,
Value: t.X.Username,
})
case *currencypb.SocialLink_Telegram_:
socialLinks = append(socialLinks, currency.SocialLink{
Type: currency.SocialLinkTypeTelegram,
Value: t.Telegram.Username,
})
case *currencypb.SocialLink_Discord_:
socialLinks = append(socialLinks, currency.SocialLink{
Type: currency.SocialLinkTypeDiscord,
Value: t.Discord.InviteCode,
})
}
}
metadataRecord.SocialLinks = socialLinks
Expand Down
Loading