0.3.6 • Published 8 months ago

@daimo/common v0.3.6

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

Common data structures

These are used across Daimo app, website, and API server.

Addresses and accounts

We use the Viem Address for ERC-55 capitalized addresses. EAccount represents an Ethereum account with name information. For example,

{ addr: "0x6982EbcC08E938FFBbCc66EdFa28cc6cFed2b741" }
{ addr: "0xc60A0A0E8bBc32DAC2E03030989AD6BEe45A874D", ensName: "dcposch.eth" }
{ addr: "0x2A6d311394184EeB6Df8FBBF58626B085374Ffe7", label: "faucet" }
{ addr: "0x4Fe4e666Be5752f1FdD210F4Ab5DE2Cc26e3E0e8", name: "ansgar" }

The last one is also a DAccount, a subset of EAccount for Daimo accounts, which have a name.

Dollars and amounts

Amounts in Daimo are stored and transmitted in two ways:

  • As bigint amount, eg 1500000
  • As string dollars, eg "1.50" ...each can be losslessly converted to the other. See amountToDollars and dollarsToAmount.

Neither of these are intended for display, which is locale-specific, eg "$1,50".

Respect the naming convention and always refer to amounts in coin units (for USDC, 1000000 = $1). Dollars should always be stored and transmitted as strings to avoid float rounding bugs.

Daimo links

These are app deep links. For example

  • https://daimo.com/link/account/ansgar
  • https://daimo.com/link/request/...
  • https://daimo.com/link/note/...

...all can be parsed or serialized to/from DaimoLink.

These are part of the website as well as the app.

0.3.6

8 months ago

0.2.13

8 months ago

0.2.12

8 months ago

0.2.11

8 months ago

0.3.0

8 months ago

0.3.1

8 months ago

0.2.10

9 months ago

0.2.9

9 months ago

0.2.8

9 months ago

0.2.4

10 months ago

0.2.0

11 months ago

0.2.3

11 months ago

1.0.0

1 year ago