diff --git a/go.mod b/go.mod index 236a5fe..91701d5 100644 --- a/go.mod +++ b/go.mod @@ -10,8 +10,8 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/ethereum/go-ethereum v1.12.0 // indirect + github.com/ethereum/go-ethereum v1.13.5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.11.0 // indirect + golang.org/x/crypto v0.15.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 66ce93b..5c19d67 100644 --- a/go.sum +++ b/go.sum @@ -203,8 +203,9 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= github.com/ethereum/c-kzg-4844 v0.2.0/go.mod h1:WI2Nd82DMZAAZI1wV2neKGost9EKjvbpQR9OqE5Qqa8= github.com/ethereum/go-ethereum v1.10.26/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= -github.com/ethereum/go-ethereum v1.12.0 h1:bdnhLPtqETd4m3mS8BGMNvBTf36bO5bx/hxE2zljOa0= github.com/ethereum/go-ethereum v1.12.0/go.mod h1:/oo2X/dZLJjf2mJ6YT9wcWxa4nNJDBKDBU6sFIpx1Gs= +github.com/ethereum/go-ethereum v1.13.5 h1:U6TCRciCqZRe4FPXmy1sMGxTfuk8P7u2UoinF3VbaFk= +github.com/ethereum/go-ethereum v1.13.5/go.mod h1:yMTu38GSuyxaYzQMViqNmQ1s3cE84abZexQmTgenWk0= github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= @@ -860,8 +861,9 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= +golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= diff --git a/uma/currency.go b/uma/currency.go index 0334db1..559980f 100644 --- a/uma/currency.go +++ b/uma/currency.go @@ -1,10 +1,30 @@ package uma type Currency struct { - Code string `json:"code"` - Name string `json:"name"` - Symbol string `json:"symbol"` - MillisatoshiPerUnit int64 `json:"multiplier"` - MinSendable int64 `json:"minSendable"` - MaxSendable int64 `json:"maxSendable"` + // Code is the ISO 4217 currency code (eg. USD). + Code string `json:"code"` + + // Name is the full display name of the currency (eg. US Dollars). + Name string `json:"name"` + + // Symbol is the symbol of the currency (eg. $ for USD). + Symbol string `json:"symbol"` + + // MillisatoshiPerUnit is the estimated millisats per smallest "unit" of this currency (eg. 1 cent in USD). + MillisatoshiPerUnit int64 `json:"multiplier"` + + // MinSendable is the minimum amount of the currency that can be sent in a single transaction. This is in the + // smallest unit of the currency (eg. cents for USD). + MinSendable int64 `json:"minSendable"` + + // MaxSendable is the maximum amount of the currency that can be sent in a single transaction. This is in the + // smallest unit of the currency (eg. cents for USD). + MaxSendable int64 `json:"maxSendable"` + + // DisplayDecimals is the number of digits after the decimal point for display on the sender side. For example, + // in USD, by convention, there are 2 digits for cents - $5.95. in this case, `displayDecimals` + // would be 2. Note that the multiplier is still always in the smallest unit (cents). This field + // is only for display purposes. The sender should assume zero if this field is omitted, unless + // they know the proper display format of the target currency. + DisplayDecimals *int `json:"displayDecimals,omitempty"` } diff --git a/uma/test/uma_test.go b/uma/test/uma_test.go index 70bcfba..f39752a 100644 --- a/uma/test/uma_test.go +++ b/uma/test/uma_test.go @@ -117,6 +117,7 @@ func TestSignAndVerifyLnurlpResponse(t *testing.T) { request := createLnurlpRequest(t, senderSigningPrivateKey.Serialize()) metadata, err := createMetadataForBob() require.NoError(t, err) + dollarDisplayDecimals := 2 response, err := uma.GetLnurlpResponse( request, receiverSigningPrivateKey.Serialize(), @@ -138,6 +139,7 @@ func TestSignAndVerifyLnurlpResponse(t *testing.T) { MillisatoshiPerUnit: 34_150, MinSendable: 1, MaxSendable: 10_000_000, + DisplayDecimals: &dollarDisplayDecimals, }, }, uma.KycStatusVerified,