99 "context"
1010 "errors"
1111 "fmt"
12- "github.com/bsv-blockchain/go-sdk/overlay"
1312 ec "github.com/bsv-blockchain/go-sdk/primitives/ec"
1413 "github.com/bsv-blockchain/go-sdk/wallet"
1514 "github.com/bsv-blockchain/go-sdk/wallet/serializer"
@@ -37,7 +36,7 @@ type Certificate struct {
3736 Certifier ec.PublicKey `json:"certifier"`
3837
3938 // The outpoint used to confirm that the certificate has not been revoked
40- RevocationOutpoint * overlay .Outpoint `json:"revocationOutpoint"`
39+ RevocationOutpoint * wallet .Outpoint `json:"revocationOutpoint"`
4140
4241 // All the fields present in the certificate, with field names as keys and encrypted field values as strings
4342 Fields map [wallet.CertificateFieldNameUnder50Bytes ]wallet.StringBase64 `json:"fields"`
@@ -52,7 +51,7 @@ func NewCertificate(
5251 serialNumber wallet.StringBase64 ,
5352 subject ec.PublicKey ,
5453 certifier ec.PublicKey ,
55- revocationOutpoint * overlay .Outpoint ,
54+ revocationOutpoint * wallet .Outpoint ,
5655 fields map [wallet.CertificateFieldNameUnder50Bytes ]wallet.StringBase64 ,
5756 signature []byte ,
5857) * Certificate {
@@ -219,15 +218,6 @@ func (c *Certificate) ToWalletCertificate() (*wallet.Certificate, error) {
219218 return nil , fmt .Errorf ("invalid serial number: %w" , err )
220219 }
221220
222- // Convert overlay.Outpoint to wallet.Outpoint
223- var revocationOutpoint * wallet.Outpoint
224- if c .RevocationOutpoint != nil {
225- revocationOutpoint = & wallet.Outpoint {
226- Txid : c .RevocationOutpoint .Txid ,
227- Index : c .RevocationOutpoint .OutputIndex ,
228- }
229- }
230-
231221 // Convert Fields map from map[CertificateFieldNameUnder50Bytes]StringBase64 to map[string]string
232222 fields := make (map [string ]string )
233223 for fieldName , fieldValue := range c .Fields {
@@ -247,7 +237,7 @@ func (c *Certificate) ToWalletCertificate() (*wallet.Certificate, error) {
247237 SerialNumber : serialNumber ,
248238 Subject : & c .Subject , // Convert value type to pointer
249239 Certifier : & c .Certifier , // Convert value type to pointer
250- RevocationOutpoint : revocationOutpoint ,
240+ RevocationOutpoint : c . RevocationOutpoint ,
251241 Fields : fields ,
252242 Signature : signature ,
253243 }, nil
@@ -273,15 +263,6 @@ func FromWalletCertificate(walletCert *wallet.Certificate) (*Certificate, error)
273263 certifier = * walletCert .Certifier
274264 }
275265
276- // Convert wallet.Outpoint to overlay.Outpoint
277- var revocationOutpoint * overlay.Outpoint
278- if walletCert .RevocationOutpoint != nil {
279- revocationOutpoint = & overlay.Outpoint {
280- Txid : walletCert .RevocationOutpoint .Txid ,
281- OutputIndex : walletCert .RevocationOutpoint .Index ,
282- }
283- }
284-
285266 // Convert fields map from map[string]string to map[CertificateFieldNameUnder50Bytes]StringBase64
286267 fields := make (map [wallet.CertificateFieldNameUnder50Bytes ]wallet.StringBase64 )
287268 for fieldName , fieldValue := range walletCert .Fields {
@@ -298,7 +279,7 @@ func FromWalletCertificate(walletCert *wallet.Certificate) (*Certificate, error)
298279 SerialNumber : serialNumber ,
299280 Subject : subject ,
300281 Certifier : certifier ,
301- RevocationOutpoint : revocationOutpoint ,
282+ RevocationOutpoint : walletCert . RevocationOutpoint ,
302283 Fields : fields ,
303284 Signature : signature ,
304285 }, nil
0 commit comments