Skip to content

Commit a68b7c3

Browse files
committed
Update amount representation from subunits to decimal
- Replace 'amountSubunits' with 'amount' in all TAIPs - Change amount representation from smallest units to decimal values - Update examples to use decimal amounts (e.g., 1.23 instead of 1230000000000000000) - Adjust descriptions to reflect the new decimal representation
1 parent 7973f34 commit a68b7c3

4 files changed

Lines changed: 15 additions & 22 deletions

File tree

TAIPs/taip-3.md

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ are defined:
7272
- `@type` - REQUIRED the JSON-LD type `https://tap.rsvp/schema/1.0#Transfer`
7373
(provisional)
7474
- `asset` - REQUIRED the [CAIP-19](CAIP-19) identifier of the asset
75-
- `amountSubunits` - OPTIONAL for NFTs and REQUIRED for fungible tokens.
76-
Specified as a string with the full amount in integer in the smallest subunit
77-
of a token
75+
- `amount` - OPTIONAL for NFTs and REQUIRED for fungible tokens. Specified as a string with the full amount as a decimal representation of the token
7876
- `originator` - OPTIONAL an object representing the originating (aka the
7977
sender) party (see [TAIP-6](TAIP-6))
8078
- `beneficiary` - OPTIONAL an object representing the beneficiary (aka the
@@ -91,14 +89,9 @@ be expanded and modified collaboratively by the agents of a transaction.
9189

9290
#### Transfer Amounts
9391

94-
The amount of a transfer is specified as `amountSubunits` as it is the most
95-
precise representation of an amount and is, in most cases, the same as used in
96-
the underlying blockchain protocol. For many application developers, this can be
97-
error-prone. It is the responsibility of library and tool developers to help
98-
educate and help convert between commonly used decimal amounts and the
99-
underlying sub-unit.
92+
The amount of a transfer is specified as `amount` and represents the decimal value of the asset. This approach is more intuitive for most users and application developers. It is the responsibility of library and tool developers to handle any necessary conversions when interacting with blockchain protocols that may require amounts in their smallest units.
10093

101-
As an example `ETH 1.23` should be encoded as `1230000000000000000`.
94+
As an example, `ETH 1.23` should be encoded as `"1.23"`.
10295

10396
#### `settlementId`
10497

@@ -170,7 +163,7 @@ firm to the ethereum wallet with the address
170163
"originator": {
171164
"@id": "did:web:originator.sample"
172165
},
173-
"amountSubunits": "1230000000000000000",
166+
"amount": "1.23",
174167
"agents": [
175168
{
176169
"@id": "did:web:originator.sample"
@@ -204,7 +197,7 @@ from a customer to the ethereum wallet with the address
204197
"originator": {
205198
"@id": "did:eg:bob"
206199
},
207-
"amountSubunits": "1230000000000000000",
200+
"amount": "1.23",
208201
"agents": [
209202
{
210203
"@id": "did:web:originator.vasp"
@@ -242,7 +235,7 @@ the authorization flow:
242235
"beneficiary": {
243236
"@id": "sms:+15105550101"
244237
},
245-
"amountSubunits": "1230000000000000000",
238+
"amount": "1.23",
246239
"agents": [
247240
{
248241
"@id": "did:web:originator.vasp"
@@ -278,7 +271,7 @@ settled transaction.
278271
"@id": "did:eg:alice"
279272
},
280273
"asset": "eip155:1/slip44:60",
281-
"amountSubunits": "1230000000000000000",
274+
"amount": "1.23",
282275
"settlementId": "eip155:1:tx/0x3edb98c24d46d148eb926c714f4fbaa117c47b0c0821f38bfce9763604457c33",
283276
"agents": [
284277
{

TAIPs/taip-5.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ The following example shows its use in a [TAIP-3] message:
7676
"originator": {
7777
"@id": "did:web:originator.sample"
7878
},
79-
"amountSubunits": "1230000000000000000",
79+
"amount": "1.23",
8080
"agents": [
8181
{
8282
"@id": "did:web:originator.sample"
@@ -380,7 +380,7 @@ customer is asking to transfer funds to a blockchain address:
380380
"@id": "did:eg:bob"
381381
},
382382
"asset": "eip155:1/slip44:60",
383-
"amountSubunits": "1230000000000000000",
383+
"amount": "1.23",
384384
"settlementId": "eip155:1:tx/0x3edb98c24d46d148eb926c714f4fbaa117c47b0c0821f38bfce9763604457c33",
385385
"agents": [
386386
{
@@ -421,7 +421,7 @@ Address:
421421
"@id": "did:eg:alice"
422422
},
423423
"asset": "eip155:1/slip44:60",
424-
"amountSubunits": "1230000000000000000",
424+
"amount": "1.23",
425425
"settlementId": "eip155:1:tx/0x3edb98c24d46d148eb926c714f4fbaa117c47b0c0821f38bfce9763604457c33",
426426
"agents": [
427427
{
@@ -475,7 +475,7 @@ goes to the customer's own self-hosted wallet address:
475475
"@id": "did:eg:bob"
476476
},
477477
"asset": "eip155:1/slip44:60",
478-
"amountSubunits": "1230000000000000000",
478+
"amount": "1.23",
479479
"settlementId": "eip155:1:tx/0x3edb98c24d46d148eb926c714f4fbaa117c47b0c0821f38bfce9763604457c33",
480480
"agents": [
481481
{

TAIPs/taip-6.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ transaction::
175175
"@id": "did:eg:bob"
176176
},
177177
"asset": "eip155:1/slip44:60",
178-
"amountSubunits": "1230000000000000000",
178+
"amount": "1.23",
179179
"settlementId": "eip155:1:tx/0x3edb98c24d46d148eb926c714f4fbaa117c47b0c0821f38bfce9763604457c33",
180180
"agents": [
181181
{
@@ -216,7 +216,7 @@ Address. It now has all the required information to complete it:
216216
"@id": "did:eg:alice"
217217
},
218218
"asset": "eip155:1/slip44:60",
219-
"amountSubunits": "1230000000000000000",
219+
"amount": "1.23",
220220
"settlementId": "eip155:1:tx/0x3edb98c24d46d148eb926c714f4fbaa117c47b0c0821f38bfce9763604457c33",
221221
"agents": [
222222
{
@@ -266,7 +266,7 @@ goes to the customer’s self-hosted wallet address:
266266
"@id": "did:eg:bob"
267267
},
268268
"asset": "eip155:1/slip44:60",
269-
"amountSubunits": "1230000000000000000",
269+
"amount": "1.23",
270270
"settlementId": "eip155:1:tx/0x3edb98c24d46d148eb926c714f4fbaa117c47b0c0821f38bfce9763604457c33",
271271
"agents": [
272272
{

TAIPs/taip-9.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ As an example see the following [TAIP-3] object:
7171
"@id": "did:eg:alice"
7272
},
7373
"asset": "eip155:1/slip44:60",
74-
"amountSubunits": "1230000000000000000",
74+
"amount": "1.23",
7575
"settlementId": "eip155:1:tx/0x3edb98c24d46d148eb926c714f4fbaa117c47b0c0821f38bfce9763604457c33",
7676
"agents": [
7777
{

0 commit comments

Comments
 (0)