-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
531 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package types | ||
|
||
import ( | ||
identity "github.com/xmtp/xmtp-node-go/pkg/proto/identity/api/v1" | ||
) | ||
|
||
type PublishIdentityUpdateResult struct { | ||
InboxID string | ||
|
||
NewAddresses []string | ||
RevokedAddresses []string | ||
NewInstallations [][]byte | ||
RevokedInstallations [][]byte | ||
TimestampNs uint64 | ||
} | ||
|
||
func NewPublishIdentityUpdateResult(inboxID string, timestampNs uint64, newAddresses []string, revokedAddresses []string, newInstallations [][]byte, revokedInstallations [][]byte) *PublishIdentityUpdateResult { | ||
return &PublishIdentityUpdateResult{ | ||
InboxID: inboxID, | ||
TimestampNs: timestampNs, | ||
NewAddresses: newAddresses, | ||
RevokedAddresses: revokedAddresses, | ||
NewInstallations: newInstallations, | ||
RevokedInstallations: revokedInstallations, | ||
} | ||
} | ||
|
||
func (p *PublishIdentityUpdateResult) GetChanges() []*identity.SubscribeAssociationChangesResponse { | ||
out := make([]*identity.SubscribeAssociationChangesResponse, 0) | ||
|
||
for _, newAddress := range p.NewAddresses { | ||
out = append(out, &identity.SubscribeAssociationChangesResponse{ | ||
TimestampNs: p.TimestampNs, | ||
Change: &identity.SubscribeAssociationChangesResponse_AccountAddressAssociation_{ | ||
AccountAddressAssociation: &identity.SubscribeAssociationChangesResponse_AccountAddressAssociation{ | ||
InboxId: p.InboxID, | ||
AccountAddress: newAddress, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
for _, revokedAddress := range p.RevokedAddresses { | ||
out = append(out, &identity.SubscribeAssociationChangesResponse{ | ||
TimestampNs: p.TimestampNs, | ||
Change: &identity.SubscribeAssociationChangesResponse_AccountAddressRevocation_{ | ||
AccountAddressRevocation: &identity.SubscribeAssociationChangesResponse_AccountAddressRevocation{ | ||
InboxId: p.InboxID, | ||
AccountAddress: revokedAddress, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
return out | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.