feat: implement currency formatting calculation (#3191)

This commit is contained in:
dlipicar 2023-02-17 11:11:07 -03:00 committed by GitHub
parent e998270856
commit 1d1a95091d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 2895 additions and 1271 deletions

View File

@ -1 +1 @@
0.131.10
0.131.11

View File

@ -1,59 +1,60 @@
// Code generated by go-bindata. DO NOT EDIT.
// sources:
// 1640111208_dummy.up.sql (258B)
// 1642666031_add_removed_clock_to_bookmarks.up.sql (117B)
// 1643644541_gif_api_key_setting.up.sql (108B)
// 1644188994_recent_stickers.up.sql (79B)
// 1646659233_add_address_to_dapp_permisssion.up.sql (700B)
// 1646841105_add_emoji_account.up.sql (96B)
// 1647278782_display_name.up.sql (110B)
// 1647862838_reset_last_backup.up.sql (37B)
// 1647871652_add_settings_sync_clock_table.up.sql (1.044kB)
// 1647880168_add_torrent_config.up.sql (211B)
// 1647882837_add_communities_settings_table.up.sql (206B)
// 1647956635_add_waku_messages_table.up.sql (266B)
// 1648554928_network_test.up.sql (132B)
// 1649174829_add_visitble_token.up.sql (84B)
// 1649882262_add_derived_from_accounts.up.sql (110B)
// 1650612625_add_community_message_archive_hashes_table.up.sql (130B)
// 1650616788_add_communities_archives_info_table.up.sql (208B)
// 1652715604_add_clock_accounts.up.sql (62B)
// 1653037334_add_notifications_settings_table.up.sql (1.276kB)
// 1654702119_add_mutual_contact_settings.up.sql (78B)
// 1655375270_add_clock_field_to_communities_settings_table.up.sql (74B)
// 1655385721_drop_networks_config.up.sql (27B)
// 1655385724_networks_chainColor_shortName.up.sql (220B)
// 1655456688_add_deleted_at_field_to_bookmarks_table.up.sql (69B)
// 1655462032_create_bookmarks_deleted_at_index.up.sql (81B)
// 1657617291_add_multi_transactions_table.up.sql (412B)
// 1660134042_add_social_links_settings_table.up.sql (334B)
// 1660134060_settings_bio.up.sql (91B)
// 1660134070_add_wakuv2_store.up.sql (269B)
// 1660134072_waku2_store_messages.up.sql (497B)
// 1662365868_add_key_uid_accounts.up.sql (68B)
// 1662447680_add_keypairs_table.up.sql (218B)
// 1662460056_move_favourites_to_saved_addresses.up.sql (233B)
// 1662738097_add_base_fee_transaction.up.sql (112B)
// 1662972194_add_keypairs_table.up.sql (345B)
// 1664392661_add_third_party_id_to_waku_messages.up.sql (70B)
// 1664783660_add_sync_info_to_saved_addresses.up.sql (388B)
// 1668109917_wakunodes.up.sql (99B)
// 1670249678_display_name_to_settings_sync_clock_table.up.sql (83B)
// 1670836810_add_imported_flag_to_community_archive_hashes.up.sql (144B)
// 1671438731_add_magnetlink_uri_to_communities_archive_info.up.sql (86B)
// 1672933930_switcher_card.up.sql (162B)
// 1674056187_add_price_cache.up.sql (255B)
// 1674136690_ens_usernames.up.sql (98B)
// 1674232431_add_balance_history.up.sql (698B)
// 1676368933_keypairs_to_keycards.up.sql (639B)
// doc.go (74B)
// Code generated by go-bindata. (@generated) DO NOT EDIT.
// Package migrations generated by go-bindata.
// sources:
// 1640111208_dummy.up.sql
// 1642666031_add_removed_clock_to_bookmarks.up.sql
// 1643644541_gif_api_key_setting.up.sql
// 1644188994_recent_stickers.up.sql
// 1646659233_add_address_to_dapp_permisssion.up.sql
// 1646841105_add_emoji_account.up.sql
// 1647278782_display_name.up.sql
// 1647862838_reset_last_backup.up.sql
// 1647871652_add_settings_sync_clock_table.up.sql
// 1647880168_add_torrent_config.up.sql
// 1647882837_add_communities_settings_table.up.sql
// 1647956635_add_waku_messages_table.up.sql
// 1648554928_network_test.up.sql
// 1649174829_add_visitble_token.up.sql
// 1649882262_add_derived_from_accounts.up.sql
// 1650612625_add_community_message_archive_hashes_table.up.sql
// 1650616788_add_communities_archives_info_table.up.sql
// 1652715604_add_clock_accounts.up.sql
// 1653037334_add_notifications_settings_table.up.sql
// 1654702119_add_mutual_contact_settings.up.sql
// 1655375270_add_clock_field_to_communities_settings_table.up.sql
// 1655385721_drop_networks_config.up.sql
// 1655385724_networks_chainColor_shortName.up.sql
// 1655456688_add_deleted_at_field_to_bookmarks_table.up.sql
// 1655462032_create_bookmarks_deleted_at_index.up.sql
// 1657617291_add_multi_transactions_table.up.sql
// 1660134042_add_social_links_settings_table.up.sql
// 1660134060_settings_bio.up.sql
// 1660134070_add_wakuv2_store.up.sql
// 1660134072_waku2_store_messages.up.sql
// 1662365868_add_key_uid_accounts.up.sql
// 1662447680_add_keypairs_table.up.sql
// 1662460056_move_favourites_to_saved_addresses.up.sql
// 1662738097_add_base_fee_transaction.up.sql
// 1662972194_add_keypairs_table.up.sql
// 1664392661_add_third_party_id_to_waku_messages.up.sql
// 1664783660_add_sync_info_to_saved_addresses.up.sql
// 1668109917_wakunodes.up.sql
// 1670249678_display_name_to_settings_sync_clock_table.up.sql
// 1670836810_add_imported_flag_to_community_archive_hashes.up.sql
// 1671438731_add_magnetlink_uri_to_communities_archive_info.up.sql
// 1672933930_switcher_card.up.sql
// 1674056187_add_price_cache.up.sql
// 1674136690_ens_usernames.up.sql
// 1674232431_add_balance_history.up.sql
// 1676368933_keypairs_to_keycards.up.sql
// 1676951398_add_currency_format_cache.up.sql
// doc.go
package migrations
import (
"bytes"
"compress/gzip"
"crypto/sha256"
"fmt"
"io"
"io/ioutil"
@ -86,7 +87,6 @@ func bindataRead(data []byte, name string) ([]byte, error) {
type asset struct {
bytes []byte
info os.FileInfo
digest [sha256.Size]byte
}
type bindataFileInfo struct {
@ -96,21 +96,32 @@ type bindataFileInfo struct {
modTime time.Time
}
// Name return file name
func (fi bindataFileInfo) Name() string {
return fi.name
}
// Size return file size
func (fi bindataFileInfo) Size() int64 {
return fi.size
}
// Mode return file mode
func (fi bindataFileInfo) Mode() os.FileMode {
return fi.mode
}
// ModTime return file modify time
func (fi bindataFileInfo) ModTime() time.Time {
return fi.modTime
}
// IsDir return file whether a directory
func (fi bindataFileInfo) IsDir() bool {
return false
return fi.mode&os.ModeDir != 0
}
// Sys return file is sys mode
func (fi bindataFileInfo) Sys() interface{} {
return nil
}
@ -130,8 +141,8 @@ func _1640111208_dummyUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1640111208_dummy.up.sql", size: 258, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3e, 0xf0, 0xae, 0x20, 0x6e, 0x75, 0xd1, 0x36, 0x14, 0xf2, 0x40, 0xe5, 0xd6, 0x7a, 0xc4, 0xa5, 0x72, 0xaa, 0xb5, 0x4d, 0x71, 0x97, 0xb8, 0xe8, 0x95, 0x22, 0x95, 0xa2, 0xac, 0xaf, 0x48, 0x58}}
info := bindataFileInfo{name: "1640111208_dummy.up.sql", size: 258, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -150,8 +161,8 @@ func _1642666031_add_removed_clock_to_bookmarksUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1642666031_add_removed_clock_to_bookmarks.up.sql", size: 117, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x84, 0x4e, 0x38, 0x99, 0x7a, 0xc, 0x90, 0x13, 0xec, 0xfe, 0x2f, 0x55, 0xff, 0xb7, 0xb6, 0xaa, 0x96, 0xc6, 0x92, 0x79, 0xcc, 0xee, 0x4e, 0x99, 0x53, 0xfe, 0x1c, 0xbb, 0x32, 0x2, 0xa4, 0x27}}
info := bindataFileInfo{name: "1642666031_add_removed_clock_to_bookmarks.up.sql", size: 117, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -170,8 +181,8 @@ func _1643644541_gif_api_key_settingUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1643644541_gif_api_key_setting.up.sql", size: 108, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1b, 0x94, 0x28, 0xfb, 0x66, 0xd1, 0x7c, 0xb8, 0x89, 0xe2, 0xb4, 0x71, 0x65, 0x24, 0x57, 0x22, 0x95, 0x38, 0x97, 0x3, 0x9b, 0xc6, 0xa4, 0x41, 0x7b, 0xba, 0xf7, 0xdb, 0x70, 0xf7, 0x20, 0x3a}}
info := bindataFileInfo{name: "1643644541_gif_api_key_setting.up.sql", size: 108, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -190,8 +201,8 @@ func _1644188994_recent_stickersUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1644188994_recent_stickers.up.sql", size: 79, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1e, 0xad, 0xaa, 0x30, 0xbf, 0x4, 0x7, 0xf8, 0xc3, 0x3, 0xb8, 0x97, 0x23, 0x2b, 0xbd, 0x1c, 0x60, 0x69, 0xb0, 0x42, 0x5e, 0x6b, 0xd, 0xa7, 0xa3, 0x6b, 0x2e, 0xdc, 0x70, 0x13, 0x72, 0x7}}
info := bindataFileInfo{name: "1644188994_recent_stickers.up.sql", size: 79, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -210,8 +221,8 @@ func _1646659233_add_address_to_dapp_permisssionUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1646659233_add_address_to_dapp_permisssion.up.sql", size: 700, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xed, 0xb0, 0x35, 0xcc, 0x2e, 0x16, 0xe6, 0x15, 0x86, 0x2c, 0x37, 0x80, 0xae, 0xa3, 0xc5, 0x31, 0x78, 0x5, 0x9d, 0xcd, 0x7b, 0xeb, 0x5f, 0xf2, 0xb3, 0x74, 0x72, 0xdf, 0xcf, 0x88, 0xb, 0x40}}
info := bindataFileInfo{name: "1646659233_add_address_to_dapp_permisssion.up.sql", size: 700, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -230,8 +241,8 @@ func _1646841105_add_emoji_accountUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1646841105_add_emoji_account.up.sql", size: 96, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe6, 0x77, 0x29, 0x95, 0x18, 0x64, 0x82, 0x63, 0xe7, 0xaf, 0x6c, 0xa9, 0x15, 0x7d, 0x46, 0xa6, 0xbc, 0xdf, 0xa7, 0xd, 0x2b, 0xd2, 0x2d, 0x97, 0x4d, 0xa, 0x6b, 0xd, 0x6e, 0x90, 0x42, 0x5c}}
info := bindataFileInfo{name: "1646841105_add_emoji_account.up.sql", size: 96, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -250,8 +261,8 @@ func _1647278782_display_nameUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1647278782_display_name.up.sql", size: 110, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf4, 0xa1, 0x1f, 0x3e, 0x61, 0x65, 0x8d, 0xff, 0xee, 0xde, 0xc5, 0x91, 0xd9, 0x5c, 0xb5, 0xe2, 0xf0, 0xb7, 0xe7, 0x5c, 0x5c, 0x16, 0x25, 0x89, 0xee, 0x78, 0x12, 0xea, 0x3e, 0x48, 0x41, 0xa6}}
info := bindataFileInfo{name: "1647278782_display_name.up.sql", size: 110, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -270,8 +281,8 @@ func _1647862838_reset_last_backupUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1647862838_reset_last_backup.up.sql", size: 37, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x21, 0xe3, 0xd5, 0xf6, 0x5f, 0xfe, 0x65, 0xfa, 0x1d, 0x88, 0xf8, 0x5f, 0x24, 0x71, 0x34, 0x68, 0x96, 0x2a, 0x60, 0x87, 0x15, 0x82, 0x4d, 0x8a, 0x59, 0x3d, 0x1f, 0xd8, 0x56, 0xd4, 0xfb, 0xda}}
info := bindataFileInfo{name: "1647862838_reset_last_backup.up.sql", size: 37, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -290,8 +301,8 @@ func _1647871652_add_settings_sync_clock_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1647871652_add_settings_sync_clock_table.up.sql", size: 1044, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd8, 0x58, 0xec, 0x85, 0x90, 0xfa, 0x30, 0x98, 0x98, 0x9a, 0xa6, 0xa8, 0x96, 0x2b, 0x38, 0x93, 0xf3, 0xae, 0x46, 0x74, 0xa4, 0x41, 0x62, 0x9b, 0x2, 0x86, 0xbf, 0xe5, 0x2a, 0xce, 0xe2, 0xc0}}
info := bindataFileInfo{name: "1647871652_add_settings_sync_clock_table.up.sql", size: 1044, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -310,8 +321,8 @@ func _1647880168_add_torrent_configUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1647880168_add_torrent_config.up.sql", size: 211, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1, 0x92, 0x22, 0x37, 0x96, 0xf3, 0xb5, 0x5b, 0x27, 0xd0, 0x7d, 0x43, 0x5, 0x4e, 0x9d, 0xe2, 0x49, 0xbe, 0x86, 0x31, 0xa1, 0x89, 0xff, 0xd6, 0x51, 0xe0, 0x9c, 0xb, 0xda, 0xfc, 0xf2, 0x93}}
info := bindataFileInfo{name: "1647880168_add_torrent_config.up.sql", size: 211, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -330,8 +341,8 @@ func _1647882837_add_communities_settings_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1647882837_add_communities_settings_table.up.sql", size: 206, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xbd, 0x87, 0x78, 0x99, 0xd9, 0x5d, 0xbd, 0xf7, 0x57, 0x9c, 0xca, 0x97, 0xbd, 0xb3, 0xe9, 0xb5, 0x89, 0x31, 0x3f, 0xf6, 0x5c, 0x13, 0xb, 0xc3, 0x54, 0x93, 0x18, 0x40, 0x7, 0x82, 0xfe, 0x7e}}
info := bindataFileInfo{name: "1647882837_add_communities_settings_table.up.sql", size: 206, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -350,8 +361,8 @@ func _1647956635_add_waku_messages_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1647956635_add_waku_messages_table.up.sql", size: 266, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd1, 0xe, 0xe1, 0xdc, 0xda, 0x2e, 0x89, 0x8d, 0xdc, 0x2a, 0x1c, 0x13, 0xa1, 0xfc, 0xfe, 0xf, 0xb2, 0xb9, 0x85, 0xc8, 0x45, 0xd6, 0xd1, 0x7, 0x5c, 0xa3, 0x8, 0x47, 0x44, 0x6d, 0x96, 0xe0}}
info := bindataFileInfo{name: "1647956635_add_waku_messages_table.up.sql", size: 266, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -370,8 +381,8 @@ func _1648554928_network_testUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1648554928_network_test.up.sql", size: 132, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x9a, 0xc5, 0x7f, 0x87, 0xf3, 0x2c, 0xf7, 0xbb, 0xd3, 0x3a, 0x4e, 0x76, 0x88, 0xca, 0xaf, 0x73, 0xce, 0x8f, 0xa1, 0xf6, 0x3d, 0x4d, 0xed, 0x6f, 0x49, 0xf2, 0xfe, 0x56, 0x2a, 0x60, 0x68, 0xca}}
info := bindataFileInfo{name: "1648554928_network_test.up.sql", size: 132, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -390,8 +401,8 @@ func _1649174829_add_visitble_tokenUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1649174829_add_visitble_token.up.sql", size: 84, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa3, 0x22, 0xc0, 0x2b, 0x3f, 0x4f, 0x3d, 0x5e, 0x4c, 0x68, 0x7c, 0xd0, 0x15, 0x36, 0x9f, 0xec, 0xa1, 0x2a, 0x7b, 0xb4, 0xe3, 0xc6, 0xc9, 0xb4, 0x81, 0x50, 0x4a, 0x11, 0x3b, 0x35, 0x7, 0xcf}}
info := bindataFileInfo{name: "1649174829_add_visitble_token.up.sql", size: 84, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -410,8 +421,8 @@ func _1649882262_add_derived_from_accountsUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1649882262_add_derived_from_accounts.up.sql", size: 110, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x11, 0xb9, 0x44, 0x4d, 0x85, 0x8d, 0x7f, 0xb4, 0xae, 0x4f, 0x5c, 0x66, 0x64, 0xb6, 0xe2, 0xe, 0x3d, 0xad, 0x9d, 0x8, 0x4f, 0xab, 0x6e, 0xa8, 0x7d, 0x76, 0x3, 0xad, 0x96, 0x1, 0xee, 0x5c}}
info := bindataFileInfo{name: "1649882262_add_derived_from_accounts.up.sql", size: 110, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -430,8 +441,8 @@ func _1650612625_add_community_message_archive_hashes_tableUpSql() (*asset, erro
return nil, err
}
info := bindataFileInfo{name: "1650612625_add_community_message_archive_hashes_table.up.sql", size: 130, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x48, 0x31, 0xb3, 0x75, 0x23, 0xe2, 0x45, 0xe, 0x47, 0x1b, 0x35, 0xa5, 0x6e, 0x83, 0x4e, 0x64, 0x7d, 0xd7, 0xa2, 0xda, 0xe9, 0x53, 0xf1, 0x16, 0x86, 0x2c, 0x57, 0xad, 0xfa, 0xca, 0x39, 0xde}}
info := bindataFileInfo{name: "1650612625_add_community_message_archive_hashes_table.up.sql", size: 130, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -450,8 +461,8 @@ func _1650616788_add_communities_archives_info_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1650616788_add_communities_archives_info_table.up.sql", size: 208, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd1, 0x4f, 0x80, 0x45, 0xb9, 0xd9, 0x15, 0xe2, 0x78, 0xd0, 0xcb, 0x71, 0xc1, 0x1b, 0xb7, 0x1b, 0x1b, 0x97, 0xfe, 0x47, 0x53, 0x3c, 0x62, 0xbc, 0xdd, 0x3a, 0x94, 0x1a, 0xc, 0x48, 0x76, 0xe}}
info := bindataFileInfo{name: "1650616788_add_communities_archives_info_table.up.sql", size: 208, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -470,8 +481,8 @@ func _1652715604_add_clock_accountsUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1652715604_add_clock_accounts.up.sql", size: 62, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb6, 0xd9, 0x8d, 0x73, 0xc9, 0xef, 0xfa, 0xb1, 0x4b, 0xa5, 0xf3, 0x5, 0x19, 0x26, 0x46, 0xf8, 0x47, 0x93, 0xdb, 0xac, 0x2, 0xef, 0xf9, 0x71, 0x56, 0x83, 0xe6, 0x2d, 0xb0, 0xd7, 0x83, 0x5c}}
info := bindataFileInfo{name: "1652715604_add_clock_accounts.up.sql", size: 62, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -490,8 +501,8 @@ func _1653037334_add_notifications_settings_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1653037334_add_notifications_settings_table.up.sql", size: 1276, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x4b, 0xc4, 0x65, 0xac, 0xa, 0xf2, 0xef, 0xb6, 0x39, 0x3c, 0xc5, 0xb1, 0xb2, 0x9c, 0x86, 0x58, 0xe0, 0x38, 0xcb, 0x57, 0x3c, 0x76, 0x73, 0x87, 0x79, 0x4e, 0xf6, 0xed, 0xb0, 0x8e, 0x9e, 0xa}}
info := bindataFileInfo{name: "1653037334_add_notifications_settings_table.up.sql", size: 1276, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -510,8 +521,8 @@ func _1654702119_add_mutual_contact_settingsUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1654702119_add_mutual_contact_settings.up.sql", size: 78, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x26, 0x66, 0x67, 0x50, 0xfe, 0xd7, 0xe3, 0x29, 0x8b, 0xff, 0x9d, 0x5a, 0x87, 0xa7, 0x99, 0x6e, 0xd6, 0xcd, 0x2e, 0xbb, 0x17, 0xdf, 0x7f, 0xf7, 0xa3, 0xfa, 0x32, 0x7c, 0x2d, 0x92, 0xc8, 0x74}}
info := bindataFileInfo{name: "1654702119_add_mutual_contact_settings.up.sql", size: 78, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -530,8 +541,8 @@ func _1655375270_add_clock_field_to_communities_settings_tableUpSql() (*asset, e
return nil, err
}
info := bindataFileInfo{name: "1655375270_add_clock_field_to_communities_settings_table.up.sql", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x19, 0xc5, 0xc0, 0xf9, 0x84, 0x53, 0xdf, 0x83, 0xcf, 0xb6, 0x40, 0x6d, 0xf5, 0xdc, 0x77, 0x37, 0xb7, 0xe3, 0xa, 0x75, 0xe7, 0x6, 0x11, 0xca, 0x2b, 0x51, 0x92, 0xdd, 0x7d, 0xdb, 0xc3, 0xf5}}
info := bindataFileInfo{name: "1655375270_add_clock_field_to_communities_settings_table.up.sql", size: 74, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -550,8 +561,8 @@ func _1655385721_drop_networks_configUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1655385721_drop_networks_config.up.sql", size: 27, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfc, 0xa7, 0x20, 0xbb, 0x67, 0x21, 0xe, 0xc6, 0xc8, 0x21, 0x74, 0xe0, 0xce, 0xc8, 0xe2, 0x2, 0xb4, 0xea, 0xf0, 0xe5, 0xc4, 0x4d, 0xdd, 0xd4, 0x52, 0x31, 0xa9, 0x3d, 0xcd, 0xd8, 0x9b, 0xab}}
info := bindataFileInfo{name: "1655385721_drop_networks_config.up.sql", size: 27, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -570,8 +581,8 @@ func _1655385724_networks_chaincolor_shortnameUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1655385724_networks_chainColor_shortName.up.sql", size: 220, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd9, 0xe7, 0x84, 0xbb, 0x5f, 0xd2, 0x2c, 0x42, 0x88, 0x62, 0x52, 0xb6, 0x58, 0x31, 0xac, 0xc, 0x96, 0x2b, 0x1b, 0xe5, 0x4e, 0x9a, 0x3a, 0xf6, 0xf6, 0xfc, 0xa9, 0x1a, 0x35, 0x62, 0x28, 0x88}}
info := bindataFileInfo{name: "1655385724_networks_chainColor_shortName.up.sql", size: 220, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -590,8 +601,8 @@ func _1655456688_add_deleted_at_field_to_bookmarks_tableUpSql() (*asset, error)
return nil, err
}
info := bindataFileInfo{name: "1655456688_add_deleted_at_field_to_bookmarks_table.up.sql", size: 69, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe7, 0x9a, 0xbd, 0x9a, 0xc9, 0xf, 0xdf, 0x90, 0x0, 0x5d, 0xea, 0x6e, 0x7d, 0x51, 0x95, 0xcd, 0x90, 0xd3, 0x1a, 0x36, 0x6c, 0xf4, 0xbd, 0xa7, 0x6b, 0xbf, 0xe5, 0xdb, 0xa3, 0x88, 0xe3, 0x50}}
info := bindataFileInfo{name: "1655456688_add_deleted_at_field_to_bookmarks_table.up.sql", size: 69, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -610,8 +621,8 @@ func _1655462032_create_bookmarks_deleted_at_indexUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1655462032_create_bookmarks_deleted_at_index.up.sql", size: 81, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf, 0x8e, 0x20, 0x6b, 0x14, 0x9e, 0xcd, 0x97, 0xd3, 0xfe, 0x62, 0x3, 0x26, 0x59, 0x1, 0x6c, 0x99, 0xef, 0x6d, 0x21, 0xd4, 0xb5, 0xa3, 0xf4, 0x39, 0x40, 0x54, 0x6, 0xd, 0x60, 0x13, 0x38}}
info := bindataFileInfo{name: "1655462032_create_bookmarks_deleted_at_index.up.sql", size: 81, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -630,8 +641,8 @@ func _1657617291_add_multi_transactions_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1657617291_add_multi_transactions_table.up.sql", size: 412, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x86, 0xb0, 0x4e, 0x8c, 0x4, 0x82, 0xb4, 0x43, 0xaa, 0xd0, 0x16, 0xdd, 0xcb, 0x88, 0x81, 0xac, 0x4, 0x34, 0x1a, 0x8f, 0x2e, 0xc5, 0x69, 0xb, 0xf0, 0x17, 0xf7, 0xe3, 0x9, 0xe, 0x54, 0xe0}}
info := bindataFileInfo{name: "1657617291_add_multi_transactions_table.up.sql", size: 412, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -650,8 +661,8 @@ func _1660134042_add_social_links_settings_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1660134042_add_social_links_settings_table.up.sql", size: 334, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x84, 0x73, 0xb6, 0xe7, 0x3f, 0xaa, 0x39, 0x9a, 0x56, 0x56, 0x31, 0xf1, 0x8e, 0x26, 0x23, 0x1, 0xe4, 0xfa, 0x98, 0xfe, 0x78, 0x87, 0x20, 0xcb, 0x52, 0xf4, 0x38, 0x7f, 0xc4, 0x1c, 0x4, 0x22}}
info := bindataFileInfo{name: "1660134042_add_social_links_settings_table.up.sql", size: 334, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -670,8 +681,8 @@ func _1660134060_settings_bioUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1660134060_settings_bio.up.sql", size: 91, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x46, 0x25, 0xa0, 0xa6, 0x47, 0xff, 0xbc, 0x2a, 0x0, 0xff, 0x59, 0x4b, 0xb0, 0xc9, 0x4e, 0x15, 0xe4, 0xd9, 0xda, 0xeb, 0xfe, 0x55, 0x98, 0xc3, 0x9d, 0x96, 0xe7, 0xf, 0xd1, 0x5c, 0x93, 0x73}}
info := bindataFileInfo{name: "1660134060_settings_bio.up.sql", size: 91, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -690,8 +701,8 @@ func _1660134070_add_wakuv2_storeUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1660134070_add_wakuv2_store.up.sql", size: 269, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x1d, 0xe6, 0xc3, 0x9, 0xef, 0xdc, 0xae, 0x49, 0x30, 0x78, 0x54, 0xd6, 0xdb, 0xbf, 0xc0, 0x8e, 0x25, 0x8f, 0xfc, 0x67, 0x80, 0x39, 0x37, 0xd4, 0x86, 0xc1, 0x85, 0xc8, 0x99, 0xc4, 0x59, 0xd4}}
info := bindataFileInfo{name: "1660134070_add_wakuv2_store.up.sql", size: 269, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -710,8 +721,8 @@ func _1660134072_waku2_store_messagesUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1660134072_waku2_store_messages.up.sql", size: 497, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x3e, 0xeb, 0xb4, 0xa0, 0xa1, 0x2b, 0xcb, 0x4c, 0x3c, 0xc6, 0xd0, 0xe8, 0x96, 0xe3, 0x96, 0xf1, 0x4f, 0x1f, 0xe0, 0xe7, 0x1f, 0x85, 0xa3, 0xe, 0xf7, 0x52, 0x56, 0x63, 0x2b, 0xb0, 0x87, 0x7b}}
info := bindataFileInfo{name: "1660134072_waku2_store_messages.up.sql", size: 497, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -730,8 +741,8 @@ func _1662365868_add_key_uid_accountsUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1662365868_add_key_uid_accounts.up.sql", size: 68, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xc6, 0xd8, 0x2f, 0x2f, 0x3b, 0xa8, 0xbd, 0x6d, 0xf6, 0x87, 0x7e, 0xd2, 0xf1, 0xa2, 0xf7, 0x81, 0x6a, 0x23, 0x10, 0xbc, 0xbf, 0x5b, 0xe7, 0x2b, 0x9c, 0xa9, 0x8a, 0x18, 0xbb, 0xd0, 0x86, 0x91}}
info := bindataFileInfo{name: "1662365868_add_key_uid_accounts.up.sql", size: 68, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -750,8 +761,8 @@ func _1662447680_add_keypairs_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1662447680_add_keypairs_table.up.sql", size: 218, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xdc, 0x25, 0xa9, 0xc7, 0x63, 0x27, 0x97, 0x35, 0x5f, 0x6b, 0xab, 0x26, 0xcb, 0xf9, 0xbd, 0x5e, 0xac, 0x3, 0xa0, 0x5e, 0xb9, 0x71, 0xa3, 0x1f, 0xb3, 0x4f, 0x7f, 0x79, 0x28, 0x48, 0xbe, 0xc}}
info := bindataFileInfo{name: "1662447680_add_keypairs_table.up.sql", size: 218, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -770,8 +781,8 @@ func _1662460056_move_favourites_to_saved_addressesUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1662460056_move_favourites_to_saved_addresses.up.sql", size: 233, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x10, 0xa2, 0x8c, 0xa3, 0xec, 0xad, 0xdf, 0xc3, 0x48, 0x5, 0x9b, 0x50, 0x25, 0x59, 0xae, 0x7d, 0xee, 0x58, 0xd2, 0x41, 0x27, 0xf2, 0x22, 0x2e, 0x9a, 0xb9, 0x4a, 0xcc, 0x38, 0x6e, 0x3a, 0xb2}}
info := bindataFileInfo{name: "1662460056_move_favourites_to_saved_addresses.up.sql", size: 233, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -790,8 +801,8 @@ func _1662738097_add_base_fee_transactionUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1662738097_add_base_fee_transaction.up.sql", size: 112, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6b, 0xfb, 0x10, 0xae, 0xfc, 0x77, 0x70, 0x98, 0x6f, 0xec, 0xaa, 0xcd, 0x7, 0xc7, 0x74, 0x23, 0xc, 0xd5, 0x1e, 0x82, 0xdd, 0xfe, 0xff, 0x3b, 0xd2, 0x49, 0x10, 0x5b, 0x30, 0xc, 0x2d, 0xb0}}
info := bindataFileInfo{name: "1662738097_add_base_fee_transaction.up.sql", size: 112, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -810,8 +821,8 @@ func _1662972194_add_keypairs_tableUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1662972194_add_keypairs_table.up.sql", size: 345, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xab, 0x76, 0xf2, 0x86, 0xe1, 0x7e, 0xe9, 0x47, 0x32, 0x48, 0xd5, 0x6b, 0xe5, 0xd, 0xab, 0xb7, 0xf1, 0xd4, 0xf1, 0xad, 0x38, 0xa6, 0x11, 0xe7, 0xce, 0x5c, 0x11, 0x11, 0xf, 0x47, 0xb2, 0x4}}
info := bindataFileInfo{name: "1662972194_add_keypairs_table.up.sql", size: 345, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -830,8 +841,8 @@ func _1664392661_add_third_party_id_to_waku_messagesUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1664392661_add_third_party_id_to_waku_messages.up.sql", size: 70, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xfd, 0x67, 0x66, 0x9e, 0x66, 0x74, 0xce, 0x1c, 0xb, 0x1b, 0x9d, 0xd5, 0xfc, 0x65, 0xe, 0x83, 0x90, 0x4c, 0x61, 0x4e, 0x6b, 0xe7, 0x86, 0xbe, 0x36, 0x4f, 0x91, 0x36, 0x4, 0x47, 0x7b, 0x82}}
info := bindataFileInfo{name: "1664392661_add_third_party_id_to_waku_messages.up.sql", size: 70, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -850,8 +861,8 @@ func _1664783660_add_sync_info_to_saved_addressesUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1664783660_add_sync_info_to_saved_addresses.up.sql", size: 388, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x67, 0x7c, 0x3a, 0x95, 0x4e, 0x55, 0xb2, 0xbd, 0xb4, 0x18, 0x93, 0xc1, 0xcf, 0x9f, 0x12, 0xbb, 0x49, 0x8a, 0x2a, 0x6a, 0x2a, 0x7f, 0xad, 0x44, 0xc3, 0xf, 0x3a, 0x79, 0x18, 0xb9, 0x4c, 0x64}}
info := bindataFileInfo{name: "1664783660_add_sync_info_to_saved_addresses.up.sql", size: 388, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -870,8 +881,8 @@ func _1668109917_wakunodesUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1668109917_wakunodes.up.sql", size: 99, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x29, 0xaa, 0x9e, 0x2, 0x66, 0x85, 0x69, 0xa8, 0xd9, 0xe2, 0x4b, 0x8d, 0x2a, 0x9c, 0xdf, 0xd2, 0xef, 0x64, 0x58, 0xe3, 0xa6, 0xe7, 0xc1, 0xd1, 0xc8, 0x9c, 0xc0, 0x2c, 0x1, 0xa8, 0x7b, 0x81}}
info := bindataFileInfo{name: "1668109917_wakunodes.up.sql", size: 99, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -890,8 +901,8 @@ func _1670249678_display_name_to_settings_sync_clock_tableUpSql() (*asset, error
return nil, err
}
info := bindataFileInfo{name: "1670249678_display_name_to_settings_sync_clock_table.up.sql", size: 83, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x39, 0x18, 0xdc, 0xc4, 0x1f, 0x79, 0x22, 0x16, 0x4d, 0xdf, 0x6c, 0x66, 0xd5, 0xa4, 0x88, 0x5d, 0x5, 0x37, 0xa7, 0x41, 0x5, 0x50, 0xae, 0x12, 0xfa, 0x7e, 0x89, 0x24, 0x5c, 0xae, 0x30, 0xfc}}
info := bindataFileInfo{name: "1670249678_display_name_to_settings_sync_clock_table.up.sql", size: 83, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -910,8 +921,8 @@ func _1670836810_add_imported_flag_to_community_archive_hashesUpSql() (*asset, e
return nil, err
}
info := bindataFileInfo{name: "1670836810_add_imported_flag_to_community_archive_hashes.up.sql", size: 144, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6f, 0xf, 0xf0, 0xbd, 0xfe, 0x63, 0x25, 0x8f, 0x5e, 0x46, 0x4b, 0x45, 0x31, 0x8b, 0x3e, 0xd8, 0x6b, 0x5d, 0x9d, 0x6d, 0x10, 0x9a, 0x87, 0x4b, 0x18, 0xc6, 0x39, 0x81, 0x6e, 0xe4, 0x75, 0xfb}}
info := bindataFileInfo{name: "1670836810_add_imported_flag_to_community_archive_hashes.up.sql", size: 144, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -930,8 +941,8 @@ func _1671438731_add_magnetlink_uri_to_communities_archive_infoUpSql() (*asset,
return nil, err
}
info := bindataFileInfo{name: "1671438731_add_magnetlink_uri_to_communities_archive_info.up.sql", size: 86, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xda, 0x8b, 0x4b, 0xd6, 0xd8, 0xe2, 0x3d, 0xf7, 0x6b, 0xcd, 0x1e, 0x70, 0x9, 0x2e, 0x35, 0x4, 0x61, 0xc3, 0xb5, 0x9d, 0xc5, 0x27, 0x21, 0xa, 0x5a, 0xd6, 0x3e, 0xa6, 0x24, 0xa2, 0x12, 0xdf}}
info := bindataFileInfo{name: "1671438731_add_magnetlink_uri_to_communities_archive_info.up.sql", size: 86, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -950,8 +961,8 @@ func _1672933930_switcher_cardUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1672933930_switcher_card.up.sql", size: 162, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x39, 0xba, 0xdc, 0xbb, 0x40, 0x4, 0xf2, 0x10, 0xdf, 0xb4, 0xd2, 0x80, 0x8a, 0x74, 0x4d, 0xf6, 0xbc, 0x50, 0x7, 0xd, 0x22, 0x7f, 0xc4, 0xaf, 0xaa, 0xde, 0xdc, 0x71, 0xe9, 0x42, 0x98, 0x36}}
info := bindataFileInfo{name: "1672933930_switcher_card.up.sql", size: 162, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -970,8 +981,8 @@ func _1674056187_add_price_cacheUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1674056187_add_price_cache.up.sql", size: 255, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb7, 0x79, 0x6a, 0x9b, 0x28, 0xd1, 0x22, 0xf0, 0x84, 0x76, 0x40, 0x39, 0x49, 0x15, 0x5d, 0xaa, 0xfd, 0x11, 0xff, 0x13, 0x27, 0x42, 0x12, 0xfa, 0x82, 0xe6, 0x7a, 0xf0, 0x5e, 0x1f, 0xe3, 0xba}}
info := bindataFileInfo{name: "1674056187_add_price_cache.up.sql", size: 255, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -990,8 +1001,8 @@ func _1674136690_ens_usernamesUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1674136690_ens_usernames.up.sql", size: 98, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x81, 0x7a, 0xf3, 0xa8, 0x88, 0x99, 0xd6, 0x9c, 0x69, 0x48, 0x3c, 0x10, 0xda, 0x72, 0xdc, 0x14, 0xd, 0x6e, 0x8c, 0x82, 0x92, 0x2d, 0x2c, 0xee, 0x4c, 0x70, 0xa4, 0xdc, 0x5c, 0x5, 0x2, 0xc3}}
info := bindataFileInfo{name: "1674136690_ens_usernames.up.sql", size: 98, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -1010,8 +1021,8 @@ func _1674232431_add_balance_historyUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1674232431_add_balance_history.up.sql", size: 698, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf7, 0xb5, 0x18, 0xca, 0x4a, 0x93, 0xbb, 0x6f, 0xa4, 0xee, 0xe4, 0x3e, 0xff, 0x6a, 0x4b, 0xe2, 0xe1, 0x61, 0x28, 0xee, 0xc5, 0x26, 0x57, 0x61, 0x5e, 0x6d, 0x44, 0x1e, 0x85, 0x43, 0x70, 0xa2}}
info := bindataFileInfo{name: "1674232431_add_balance_history.up.sql", size: 698, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -1030,8 +1041,28 @@ func _1676368933_keypairs_to_keycardsUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1676368933_keypairs_to_keycards.up.sql", size: 639, mode: os.FileMode(0644), modTime: time.Unix(1676633516, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x81, 0x93, 0x27, 0x2, 0xf0, 0x37, 0x81, 0x65, 0xa4, 0xb3, 0x5b, 0x60, 0x36, 0x95, 0xfc, 0x81, 0xf0, 0x3b, 0x7c, 0xc3, 0x2c, 0x85, 0xbd, 0x38, 0x46, 0xa4, 0x95, 0x4a, 0x6, 0x3e, 0x74, 0xd5}}
info := bindataFileInfo{name: "1676368933_keypairs_to_keycards.up.sql", size: 639, mode: os.FileMode(420), modTime: time.Unix(1676634669, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var __1676951398_add_currency_format_cacheUpSql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x8f\xc1\x4a\x03\x31\x14\x45\xf7\xf3\x15\x77\x69\xc1\x7e\x41\x57\x69\x8d\x18\x18\x12\x9c\x66\xa4\xbb\x10\x33\xaf\x1a\xc8\x64\x86\x97\xb8\x88\x5f\x2f\xb4\xea\x42\x10\xba\xbe\xf7\xc0\x39\xdb\x2d\x4c\x26\x50\xae\xdc\xb0\x12\xa3\xb4\xf9\x75\x49\xdd\x61\x90\xc2\x4a\x58\xb1\xef\x25\xd4\x23\xb4\xb1\x90\x27\x75\xb4\x47\x84\x0f\x66\xca\xa1\xb9\xf3\xc2\xb3\xaf\x2e\xf8\xf0\x4e\xb8\xeb\x00\x7c\xd3\x78\x11\xc3\xe1\x49\x0c\x17\x4a\x8f\x7d\x7f\x7f\x19\xa7\x58\xd6\xe4\x9b\x9b\x28\xc4\xd9\xa7\x02\xa5\xed\x9f\x4b\xa9\x1c\x57\x57\xd9\xc7\x14\xf3\x9b\xfb\x24\x5e\xa8\x60\x6f\x4c\x2f\x85\xfe\xfd\x76\x9b\x5d\xf7\x63\x38\x6a\xf5\x3c\x4a\x28\xfd\x20\x4f\xb7\x88\xba\x38\x51\xae\xf1\xdc\xdc\xb5\xd9\xe8\xff\x82\xae\x2d\x9b\xdd\x57\x00\x00\x00\xff\xff\x11\xe9\xc3\xee\x23\x01\x00\x00")
func _1676951398_add_currency_format_cacheUpSqlBytes() ([]byte, error) {
return bindataRead(
__1676951398_add_currency_format_cacheUpSql,
"1676951398_add_currency_format_cache.up.sql",
)
}
func _1676951398_add_currency_format_cacheUpSql() (*asset, error) {
bytes, err := _1676951398_add_currency_format_cacheUpSqlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "1676951398_add_currency_format_cache.up.sql", size: 291, mode: os.FileMode(420), modTime: time.Unix(1676634669, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -1050,8 +1081,8 @@ func docGo() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(0644), modTime: time.Unix(1676633395, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xde, 0x7c, 0x28, 0xcd, 0x47, 0xf2, 0xfa, 0x7c, 0x51, 0x2d, 0xd8, 0x38, 0xb, 0xb0, 0x34, 0x9d, 0x4c, 0x62, 0xa, 0x9e, 0x28, 0xc3, 0x31, 0x23, 0xd9, 0xbb, 0x89, 0x9f, 0xa0, 0x89, 0x1f, 0xe8}}
info := bindataFileInfo{name: "doc.go", size: 74, mode: os.FileMode(420), modTime: time.Unix(1676333840, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@ -1070,12 +1101,6 @@ func Asset(name string) ([]byte, error) {
return nil, fmt.Errorf("Asset %s not found", name)
}
// AssetString returns the asset contents as a string (instead of a []byte).
func AssetString(name string) (string, error) {
data, err := Asset(name)
return string(data), err
}
// MustAsset is like Asset but panics when Asset would return an error.
// It simplifies safe initialization of global variables.
func MustAsset(name string) []byte {
@ -1087,12 +1112,6 @@ func MustAsset(name string) []byte {
return a
}
// MustAssetString is like AssetString but panics when Asset would return an
// error. It simplifies safe initialization of global variables.
func MustAssetString(name string) string {
return string(MustAsset(name))
}
// AssetInfo loads and returns the asset info for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
@ -1108,33 +1127,6 @@ func AssetInfo(name string) (os.FileInfo, error) {
return nil, fmt.Errorf("AssetInfo %s not found", name)
}
// AssetDigest returns the digest of the file with the given name. It returns an
// error if the asset could not be found or the digest could not be loaded.
func AssetDigest(name string) ([sha256.Size]byte, error) {
canonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[canonicalName]; ok {
a, err := f()
if err != nil {
return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err)
}
return a.digest, nil
}
return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name)
}
// Digests returns a map of all known files and their checksums.
func Digests() (map[string][sha256.Size]byte, error) {
mp := make(map[string][sha256.Size]byte, len(_bindata))
for name := range _bindata {
a, err := _bindata[name]()
if err != nil {
return nil, err
}
mp[name] = a.digest
}
return mp, nil
}
// AssetNames returns the names of the assets.
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
@ -1147,97 +1139,52 @@ func AssetNames() []string {
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
"1640111208_dummy.up.sql": _1640111208_dummyUpSql,
"1642666031_add_removed_clock_to_bookmarks.up.sql": _1642666031_add_removed_clock_to_bookmarksUpSql,
"1643644541_gif_api_key_setting.up.sql": _1643644541_gif_api_key_settingUpSql,
"1644188994_recent_stickers.up.sql": _1644188994_recent_stickersUpSql,
"1646659233_add_address_to_dapp_permisssion.up.sql": _1646659233_add_address_to_dapp_permisssionUpSql,
"1646841105_add_emoji_account.up.sql": _1646841105_add_emoji_accountUpSql,
"1647278782_display_name.up.sql": _1647278782_display_nameUpSql,
"1647862838_reset_last_backup.up.sql": _1647862838_reset_last_backupUpSql,
"1647871652_add_settings_sync_clock_table.up.sql": _1647871652_add_settings_sync_clock_tableUpSql,
"1647880168_add_torrent_config.up.sql": _1647880168_add_torrent_configUpSql,
"1647882837_add_communities_settings_table.up.sql": _1647882837_add_communities_settings_tableUpSql,
"1647956635_add_waku_messages_table.up.sql": _1647956635_add_waku_messages_tableUpSql,
"1648554928_network_test.up.sql": _1648554928_network_testUpSql,
"1649174829_add_visitble_token.up.sql": _1649174829_add_visitble_tokenUpSql,
"1649882262_add_derived_from_accounts.up.sql": _1649882262_add_derived_from_accountsUpSql,
"1650612625_add_community_message_archive_hashes_table.up.sql": _1650612625_add_community_message_archive_hashes_tableUpSql,
"1650616788_add_communities_archives_info_table.up.sql": _1650616788_add_communities_archives_info_tableUpSql,
"1652715604_add_clock_accounts.up.sql": _1652715604_add_clock_accountsUpSql,
"1653037334_add_notifications_settings_table.up.sql": _1653037334_add_notifications_settings_tableUpSql,
"1654702119_add_mutual_contact_settings.up.sql": _1654702119_add_mutual_contact_settingsUpSql,
"1655375270_add_clock_field_to_communities_settings_table.up.sql": _1655375270_add_clock_field_to_communities_settings_tableUpSql,
"1655385721_drop_networks_config.up.sql": _1655385721_drop_networks_configUpSql,
"1655385724_networks_chainColor_shortName.up.sql": _1655385724_networks_chaincolor_shortnameUpSql,
"1655456688_add_deleted_at_field_to_bookmarks_table.up.sql": _1655456688_add_deleted_at_field_to_bookmarks_tableUpSql,
"1655462032_create_bookmarks_deleted_at_index.up.sql": _1655462032_create_bookmarks_deleted_at_indexUpSql,
"1657617291_add_multi_transactions_table.up.sql": _1657617291_add_multi_transactions_tableUpSql,
"1660134042_add_social_links_settings_table.up.sql": _1660134042_add_social_links_settings_tableUpSql,
"1660134060_settings_bio.up.sql": _1660134060_settings_bioUpSql,
"1660134070_add_wakuv2_store.up.sql": _1660134070_add_wakuv2_storeUpSql,
"1660134072_waku2_store_messages.up.sql": _1660134072_waku2_store_messagesUpSql,
"1662365868_add_key_uid_accounts.up.sql": _1662365868_add_key_uid_accountsUpSql,
"1662447680_add_keypairs_table.up.sql": _1662447680_add_keypairs_tableUpSql,
"1662460056_move_favourites_to_saved_addresses.up.sql": _1662460056_move_favourites_to_saved_addressesUpSql,
"1662738097_add_base_fee_transaction.up.sql": _1662738097_add_base_fee_transactionUpSql,
"1662972194_add_keypairs_table.up.sql": _1662972194_add_keypairs_tableUpSql,
"1664392661_add_third_party_id_to_waku_messages.up.sql": _1664392661_add_third_party_id_to_waku_messagesUpSql,
"1664783660_add_sync_info_to_saved_addresses.up.sql": _1664783660_add_sync_info_to_saved_addressesUpSql,
"1668109917_wakunodes.up.sql": _1668109917_wakunodesUpSql,
"1670249678_display_name_to_settings_sync_clock_table.up.sql": _1670249678_display_name_to_settings_sync_clock_tableUpSql,
"1670836810_add_imported_flag_to_community_archive_hashes.up.sql": _1670836810_add_imported_flag_to_community_archive_hashesUpSql,
"1671438731_add_magnetlink_uri_to_communities_archive_info.up.sql": _1671438731_add_magnetlink_uri_to_communities_archive_infoUpSql,
"1672933930_switcher_card.up.sql": _1672933930_switcher_cardUpSql,
"1674056187_add_price_cache.up.sql": _1674056187_add_price_cacheUpSql,
"1674136690_ens_usernames.up.sql": _1674136690_ens_usernamesUpSql,
"1674232431_add_balance_history.up.sql": _1674232431_add_balance_historyUpSql,
"1676368933_keypairs_to_keycards.up.sql": _1676368933_keypairs_to_keycardsUpSql,
"1676951398_add_currency_format_cache.up.sql": _1676951398_add_currency_format_cacheUpSql,
"doc.go": docGo,
}
@ -1250,9 +1197,9 @@ var _bindata = map[string]func() (*asset, error){
// img/
// a.png
// b.png
// then AssetDir("data") would return []string{"foo.txt", "img"},
// AssetDir("data/img") would return []string{"a.png", "b.png"},
// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("nonexistent") would return an error
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
node := _bintree
@ -1328,10 +1275,11 @@ var _bintree = &bintree{nil, map[string]*bintree{
"1674136690_ens_usernames.up.sql": &bintree{_1674136690_ens_usernamesUpSql, map[string]*bintree{}},
"1674232431_add_balance_history.up.sql": &bintree{_1674232431_add_balance_historyUpSql, map[string]*bintree{}},
"1676368933_keypairs_to_keycards.up.sql": &bintree{_1676368933_keypairs_to_keycardsUpSql, map[string]*bintree{}},
"1676951398_add_currency_format_cache.up.sql": &bintree{_1676951398_add_currency_format_cacheUpSql, map[string]*bintree{}},
"doc.go": &bintree{docGo, map[string]*bintree{}},
}}
// RestoreAsset restores an asset under the given directory.
// RestoreAsset restores an asset under the given directory
func RestoreAsset(dir, name string) error {
data, err := Asset(name)
if err != nil {
@ -1349,10 +1297,14 @@ func RestoreAsset(dir, name string) error {
if err != nil {
return err
}
return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
if err != nil {
return err
}
return nil
}
// RestoreAssets restores an asset under the given directory recursively.
// RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
// File

View File

@ -0,0 +1,8 @@
-- One entry per symbol
CREATE TABLE IF NOT EXISTS currency_format_cache (
symbol VARCHAR NOT NULL,
display_decimals INT NOT NULL,
strip_trailing_zeroes BOOLEAN NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS currency_format_cache_identify_entry ON currency_format_cache (symbol);

2
go.mod
View File

@ -76,8 +76,8 @@ require github.com/fogleman/gg v1.3.0
require (
github.com/gorilla/sessions v1.2.1
github.com/ipfs/go-log/v2 v2.5.1
github.com/ladydascalie/currency v1.6.0
github.com/meirf/gopart v0.0.0-20180520194036-37e9492a85a8
github.com/rmg/iso4217 v1.0.0
github.com/waku-org/go-waku v0.4.1-0.20230213133834-a3f08943acb4
github.com/yeqown/go-qrcode/v2 v2.2.1
github.com/yeqown/go-qrcode/writer/standard v1.2.1

4
go.sum
View File

@ -1301,6 +1301,8 @@ github.com/ktrysmt/go-bitbucket v0.6.4/go.mod h1:9u0v3hsd2rqCHRIpbir1oP7F58uo5dq
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg=
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
github.com/ladydascalie/currency v1.6.0 h1:r5s/TMCYcpn6jPRHLV3F8nI7YjpY8trvstfuixxiHns=
github.com/ladydascalie/currency v1.6.0/go.mod h1:C9eil8e6tthhBb5yhwoH1U0LT5hm1BP/g+v/V82KYjY=
github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8=
github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
@ -1837,8 +1839,6 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ
github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho=
github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8=
github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM=
github.com/rmg/iso4217 v1.0.0 h1:qZP5nhSwHDKkgpuapOL6BDfHUbBgwXfiPTbPGcwZ92E=
github.com/rmg/iso4217 v1.0.0/go.mod h1:AbFI9wPu0EAO+Q6swPiMEfAtyz7T7EfNigAOKNNyiBE=
github.com/robertkrimen/godocdown v0.0.0-20130622164427-0bfa04905481/go.mod h1:C9WhFzY47SzYBIvzFqSvHIR6ROgDo4TtdTuRaOMjF/s=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=

View File

@ -2,14 +2,11 @@ package wallet
import (
"context"
"errors"
"fmt"
"math/big"
"strings"
"time"
"github.com/rmg/iso4217"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/log"
@ -18,6 +15,7 @@ import (
"github.com/status-im/status-go/services/wallet/async"
"github.com/status-im/status-go/services/wallet/bridge"
"github.com/status-im/status-go/services/wallet/chain"
"github.com/status-im/status-go/services/wallet/currency"
"github.com/status-im/status-go/services/wallet/history"
"github.com/status-im/status-go/services/wallet/thirdparty"
"github.com/status-im/status-go/services/wallet/token"
@ -337,11 +335,6 @@ func (api *API) FetchPrices(ctx context.Context, symbols []string, currencies []
return api.s.priceManager.FetchPrices(symbols, currencies)
}
func (api *API) GetCachedPrices(ctx context.Context) (map[string]map[string]float64, error) {
log.Debug("call to GetCachedPrices")
return api.s.priceManager.GetCachedPrices()
}
func (api *API) FetchMarketValues(ctx context.Context, symbols []string, currencies []string) (map[string]map[string]thirdparty.MarketCoinValues, error) {
log.Debug("call to FetchMarketValues")
return api.s.cryptoCompare.FetchTokenMarketValues(symbols, currencies)
@ -556,18 +549,12 @@ func (api *API) CreateMultiTransaction(ctx context.Context, multiTransaction *Mu
return api.s.transactionManager.createMultiTransaction(ctx, multiTransaction, data, api.router.bridges, password)
}
func (api *API) IsCurrencyFiat(name string) bool {
code, _ := iso4217.ByName(strings.ToUpper(name))
return (code != 0)
func (api *API) GetCachedCurrencyFormats() (currency.FormatPerSymbol, error) {
log.Debug("call to GetCachedCurrencyFormats")
return api.s.currency.GetCachedCurrencyFormats()
}
func (api *API) GetFiatCurrencyMinorUnit(name string) (int, error) {
code, minor := iso4217.ByName(strings.ToUpper(name))
if code == 0 {
return code, errors.New("Unknown currency: " + name)
}
return minor, nil
func (api *API) FetchAllCurrencyFormats() (currency.FormatPerSymbol, error) {
log.Debug("call to FetchAllCurrencyFormats")
return api.s.currency.FetchAllCurrencyFormats()
}

View File

@ -0,0 +1,151 @@
package currency
import (
"errors"
"math"
"strings"
iso4217 "github.com/ladydascalie/currency"
"github.com/status-im/status-go/services/wallet/price"
"github.com/status-im/status-go/services/wallet/token"
)
const decimalsCalculationCurrency = "USD"
const lowerTokenResolutionInUsd = 0.1
const higherTokenResolutionInUsd = 0.01
type Format struct {
Symbol string `json:"symbol"`
DisplayDecimals uint `json:"displayDecimals"`
StripTrailingZeroes bool `json:"stripTrailingZeroes"`
}
type FormatPerSymbol = map[string]Format
type Currency struct {
priceManager *price.Manager
}
func NewCurrency(priceManager *price.Manager) *Currency {
return &Currency{
priceManager: priceManager,
}
}
func IsCurrencyFiat(symbol string) bool {
return iso4217.Valid(strings.ToUpper(symbol))
}
func GetAllFiatCurrencySymbols() []string {
return iso4217.ValidCodes
}
func calculateFiatDisplayDecimals(symbol string) (uint, error) {
currency, err := iso4217.Get(strings.ToUpper(symbol))
if err != nil {
return 0, err
}
return uint(currency.MinorUnits()), nil
}
func calculateFiatCurrencyFormat(symbol string) (*Format, error) {
displayDecimals, err := calculateFiatDisplayDecimals(symbol)
if err != nil {
return nil, err
}
format := &Format{
Symbol: symbol,
DisplayDecimals: displayDecimals,
StripTrailingZeroes: false,
}
return format, nil
}
func calculateTokenDisplayDecimals(price float64) uint {
var displayDecimals float64 = 0.0
if price > 0 {
lowerDecimalsBound := math.Max(0.0, math.Log10(price)-math.Log10(lowerTokenResolutionInUsd))
upperDecimalsBound := math.Max(0.0, math.Log10(price)-math.Log10(higherTokenResolutionInUsd))
// Use as few decimals as needed to ensure lower precision
displayDecimals = math.Ceil(lowerDecimalsBound)
if displayDecimals+1.0 <= upperDecimalsBound {
// If allowed by upper bound, ensure resolution changes as soon as currency hits multiple of 10
displayDecimals += 1.0
}
}
return uint(displayDecimals)
}
func (cm *Currency) calculateTokenCurrencyFormat(symbol string, price float64) (*Format, error) {
pegSymbol := token.GetTokenPegSymbol(symbol)
if pegSymbol != "" {
var currencyFormat, err = calculateFiatCurrencyFormat(pegSymbol)
if err != nil {
return nil, err
}
currencyFormat.Symbol = symbol
return currencyFormat, nil
}
currencyFormat := &Format{
Symbol: symbol,
DisplayDecimals: calculateTokenDisplayDecimals(price),
StripTrailingZeroes: true,
}
return currencyFormat, nil
}
func GetFiatCurrencyFormats(symbols []string) (FormatPerSymbol, error) {
formats := make(FormatPerSymbol)
for _, symbol := range symbols {
format, err := calculateFiatCurrencyFormat(symbol)
if err != nil {
return nil, err
}
formats[symbol] = *format
}
return formats, nil
}
func (cm *Currency) FetchTokenCurrencyFormats(symbols []string) (FormatPerSymbol, error) {
formats := make(FormatPerSymbol)
// Get latest cached price, fetch only if not available
prices, err := cm.priceManager.GetOrFetchPrices(symbols, []string{decimalsCalculationCurrency}, math.MaxInt64)
if err != nil {
return nil, err
}
for _, symbol := range symbols {
priceData, ok := prices[symbol][decimalsCalculationCurrency]
if !ok {
return nil, errors.New("Could not get price for: " + symbol)
}
format, err := cm.calculateTokenCurrencyFormat(symbol, priceData.Price)
if err != nil {
return nil, err
}
formats[symbol] = *format
}
return formats, nil
}

View File

@ -0,0 +1,73 @@
package currency
import (
"context"
"database/sql"
)
type DB struct {
db *sql.DB
}
func NewCurrencyDB(sqlDb *sql.DB) *DB {
return &DB{
db: sqlDb,
}
}
func getCachedFormatsFromDBRows(rows *sql.Rows) (FormatPerSymbol, error) {
formats := make(FormatPerSymbol)
for rows.Next() {
var format Format
if err := rows.Scan(&format.Symbol, &format.DisplayDecimals, &format.StripTrailingZeroes); err != nil {
return nil, err
}
formats[format.Symbol] = format
}
return formats, nil
}
func (cdb *DB) GetCachedFormats() (FormatPerSymbol, error) {
rows, err := cdb.db.Query("SELECT symbol, display_decimals, strip_trailing_zeroes FROM currency_format_cache")
if err != nil {
return nil, err
}
defer rows.Close()
return getCachedFormatsFromDBRows(rows)
}
func (cdb *DB) UpdateCachedFormats(formats FormatPerSymbol) error {
tx, err := cdb.db.BeginTx(context.Background(), &sql.TxOptions{})
if err != nil {
return err
}
defer func() {
if err == nil {
err = tx.Commit()
return
}
// don't shadow original error
_ = tx.Rollback()
}()
insert, err := tx.Prepare(`INSERT OR REPLACE INTO currency_format_cache
(symbol, display_decimals, strip_trailing_zeroes)
VALUES
(?, ?, ?)`)
if err != nil {
return err
}
for _, format := range formats {
_, err = insert.Exec(format.Symbol, format.DisplayDecimals, format.StripTrailingZeroes)
if err != nil {
return err
}
}
return nil
}

View File

@ -0,0 +1,85 @@
package currency
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/status-im/status-go/appdatabase"
)
func setupTestCurrencyDB(t *testing.T) (*DB, func()) {
db, err := appdatabase.InitializeDB(":memory:", "wallet-currency-db-tests-", 1)
require.NoError(t, err)
return NewCurrencyDB(db), func() {
require.NoError(t, db.Close())
}
}
func TestCurrencyFormats(t *testing.T) {
db, stop := setupTestCurrencyDB(t)
defer stop()
rst, err := db.GetCachedFormats()
require.NoError(t, err)
require.Empty(t, rst)
pr1 := FormatPerSymbol{
"A": {
Symbol: "A",
DisplayDecimals: 1,
StripTrailingZeroes: false,
},
"B": {
Symbol: "B",
DisplayDecimals: 2,
StripTrailingZeroes: true,
},
}
err = db.UpdateCachedFormats(pr1)
require.NoError(t, err)
rst, err = db.GetCachedFormats()
require.NoError(t, err)
require.Equal(t, rst, pr1)
pr2 := FormatPerSymbol{
"B": {
Symbol: "B",
DisplayDecimals: 3,
StripTrailingZeroes: true,
},
"C": {
Symbol: "C",
DisplayDecimals: 4,
StripTrailingZeroes: false,
},
}
err = db.UpdateCachedFormats(pr2)
require.NoError(t, err)
rst, err = db.GetCachedFormats()
require.NoError(t, err)
expected := FormatPerSymbol{
"A": {
Symbol: "A",
DisplayDecimals: 1,
StripTrailingZeroes: false,
},
"B": {
Symbol: "B",
DisplayDecimals: 3,
StripTrailingZeroes: true,
},
"C": {
Symbol: "C",
DisplayDecimals: 4,
StripTrailingZeroes: false,
},
}
require.Equal(t, rst, expected)
}

View File

@ -0,0 +1,27 @@
package currency
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestCalculateTokenDisplayDecimals(t *testing.T) {
require.EqualValues(t, 0, calculateTokenDisplayDecimals(0.001))
require.EqualValues(t, 0, calculateTokenDisplayDecimals(0.01))
require.EqualValues(t, 0, calculateTokenDisplayDecimals(0.015))
require.EqualValues(t, 1, calculateTokenDisplayDecimals(0.1))
require.EqualValues(t, 1, calculateTokenDisplayDecimals(0.3))
require.EqualValues(t, 2, calculateTokenDisplayDecimals(1))
require.EqualValues(t, 2, calculateTokenDisplayDecimals(5))
require.EqualValues(t, 3, calculateTokenDisplayDecimals(10))
require.EqualValues(t, 3, calculateTokenDisplayDecimals(80))
require.EqualValues(t, 4, calculateTokenDisplayDecimals(100))
require.EqualValues(t, 4, calculateTokenDisplayDecimals(365))
require.EqualValues(t, 5, calculateTokenDisplayDecimals(1000))
require.EqualValues(t, 5, calculateTokenDisplayDecimals(6548))
require.EqualValues(t, 6, calculateTokenDisplayDecimals(10000))
require.EqualValues(t, 6, calculateTokenDisplayDecimals(54623))
require.EqualValues(t, 7, calculateTokenDisplayDecimals(100000))
require.EqualValues(t, 7, calculateTokenDisplayDecimals(986315))
}

View File

@ -0,0 +1,113 @@
package currency
import (
"context"
"database/sql"
"time"
"github.com/ethereum/go-ethereum/event"
"github.com/status-im/status-go/services/wallet/price"
"github.com/status-im/status-go/services/wallet/token"
"github.com/status-im/status-go/services/wallet/walletevent"
)
const (
EventCurrencyTickUpdateFormat walletevent.EventType = "wallet-currency-tick-update-format"
currencyFormatUpdateInterval = 1 * time.Hour
)
type Service struct {
currency *Currency
db *DB
tokenManager *token.Manager
walletFeed *event.Feed
cancelFn context.CancelFunc
}
func NewService(db *sql.DB, walletFeed *event.Feed, tokenManager *token.Manager, priceManager *price.Manager) *Service {
return &Service{
currency: NewCurrency(priceManager),
db: NewCurrencyDB(db),
tokenManager: tokenManager,
walletFeed: walletFeed,
}
}
func (s *Service) Start() {
// Update all fiat currency formats in cache
fiatFormats, err := s.getAllFiatCurrencyFormats()
if err == nil {
_ = s.db.UpdateCachedFormats(fiatFormats)
}
ctx, cancel := context.WithCancel(context.Background())
s.cancelFn = cancel
go func() {
ticker := time.NewTicker(currencyFormatUpdateInterval)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
s.walletFeed.Send(walletevent.Event{
Type: EventCurrencyTickUpdateFormat,
})
}
}
}()
}
func (s *Service) Stop() {
if s.cancelFn != nil {
s.cancelFn()
}
}
func (s *Service) GetCachedCurrencyFormats() (FormatPerSymbol, error) {
return s.db.GetCachedFormats()
}
func (s *Service) FetchAllCurrencyFormats() (FormatPerSymbol, error) {
// Only token prices can change, so we fetch those
tokenFormats, err := s.fetchAllTokenCurrencyFormats()
if err != nil {
return nil, err
}
err = s.db.UpdateCachedFormats(tokenFormats)
if err != nil {
return nil, err
}
return s.GetCachedCurrencyFormats()
}
func (s *Service) getAllFiatCurrencyFormats() (FormatPerSymbol, error) {
return GetFiatCurrencyFormats(GetAllFiatCurrencySymbols())
}
func (s *Service) fetchAllTokenCurrencyFormats() (FormatPerSymbol, error) {
tokens, err := s.tokenManager.GetAllTokensAndNativeCurrencies()
if err != nil {
return nil, err
}
tokenPerSymbolMap := make(map[string]bool)
tokenSymbols := make([]string, 0)
for _, t := range tokens {
symbol := t.Symbol
if !tokenPerSymbolMap[symbol] {
tokenPerSymbolMap[symbol] = true
tokenSymbols = append(tokenSymbols, symbol)
}
}
return s.currency.FetchTokenCurrencyFormats(tokenSymbols)
}

View File

@ -1,98 +0,0 @@
package wallet
import (
"context"
"database/sql"
"fmt"
"github.com/status-im/status-go/services/wallet/thirdparty"
)
type PricesPerTokenAndCurrency = map[string]map[string]float64
type PriceManager struct {
db *sql.DB
cryptoCompare *thirdparty.CryptoCompare
}
func NewPriceManager(db *sql.DB, cryptoCompare *thirdparty.CryptoCompare) *PriceManager {
return &PriceManager{db: db, cryptoCompare: cryptoCompare}
}
func (pm *PriceManager) FetchPrices(symbols []string, currencies []string) (PricesPerTokenAndCurrency, error) {
result, err := pm.cryptoCompare.FetchPrices(symbols, currencies)
if err != nil {
return nil, err
}
if err = pm.updatePriceCache(result); err != nil {
return nil, err
}
return result, nil
}
func (pm *PriceManager) updatePriceCache(prices PricesPerTokenAndCurrency) error {
tx, err := pm.db.BeginTx(context.Background(), &sql.TxOptions{})
if err != nil {
return err
}
defer func() {
if err == nil {
err = tx.Commit()
return
}
// don't shadow original error
_ = tx.Rollback()
}()
insert, err := tx.Prepare(`INSERT OR REPLACE INTO price_cache
(token, currency, price)
VALUES
(?, ?, ?)`)
if err != nil {
return err
}
for token, pricesPerCurrency := range prices {
for currency, price := range pricesPerCurrency {
_, err = insert.Exec(token, currency, fmt.Sprintf("%f", price))
if err != nil {
return err
}
}
}
return nil
}
func getCachedPricesFromDBRows(rows *sql.Rows) (PricesPerTokenAndCurrency, error) {
prices := make(PricesPerTokenAndCurrency)
for rows.Next() {
var token string
var currency string
var price float64
if err := rows.Scan(&token, &currency, &price); err != nil {
return nil, err
}
_, present := prices[token]
if !present {
prices[token] = map[string]float64{}
}
prices[token][currency] = price
}
return prices, nil
}
func (pm *PriceManager) GetCachedPrices() (PricesPerTokenAndCurrency, error) {
rows, err := pm.db.Query("SELECT token, currency, price FROM price_cache")
if err != nil {
return nil, err
}
defer rows.Close()
return getCachedPricesFromDBRows(rows)
}

View File

@ -0,0 +1,119 @@
package price
import (
"time"
)
type DataPoint struct {
Price float64
UpdatedAt int64
}
type DataPerTokenAndCurrency = map[string]map[string]DataPoint
type Manager struct {
priceProvider Provider
priceCache DataPerTokenAndCurrency
}
func NewManager(priceProvider Provider) *Manager {
return &Manager{
priceProvider: priceProvider,
priceCache: make(DataPerTokenAndCurrency),
}
}
func (pm *Manager) FetchPrice(symbol string, currency string) (float64, error) {
symbols := [1]string{symbol}
currencies := [1]string{currency}
prices, err := pm.FetchPrices(symbols[:], currencies[:])
if err != nil {
return 0, err
}
return prices[symbol][currency], nil
}
func (pm *Manager) FetchPrices(symbols []string, currencies []string) (map[string]map[string]float64, error) {
result, err := pm.priceProvider.FetchPrices(symbols, currencies)
if err != nil {
return nil, err
}
pm.updatePriceCache(result)
return result, nil
}
func (pm *Manager) getCachedPricesFor(symbols []string, currencies []string) DataPerTokenAndCurrency {
prices := make(DataPerTokenAndCurrency)
for _, symbol := range symbols {
prices[symbol] = make(map[string]DataPoint)
for _, currency := range currencies {
prices[symbol][currency] = pm.priceCache[symbol][currency]
}
}
return prices
}
func (pm *Manager) updatePriceCache(prices map[string]map[string]float64) {
for token, pricesPerCurrency := range prices {
_, present := pm.priceCache[token]
if !present {
pm.priceCache[token] = make(map[string]DataPoint)
}
for currency, price := range pricesPerCurrency {
pm.priceCache[token][currency] = DataPoint{
Price: price,
UpdatedAt: time.Now().Unix(),
}
}
}
}
func (pm *Manager) GetCachedPrices() DataPerTokenAndCurrency {
return pm.priceCache
}
// Return cached price if present in cache and age is less than maxAgeInSeconds. Fetch otherwise.
func (pm *Manager) GetOrFetchPrices(symbols []string, currencies []string, maxAgeInSeconds int64) (DataPerTokenAndCurrency, error) {
symbolsToFetchMap := make(map[string]bool)
symbolsToFetch := make([]string, 0, len(symbols))
now := time.Now().Unix()
for _, symbol := range symbols {
tokenPriceCache, ok := pm.priceCache[symbol]
if !ok {
if !symbolsToFetchMap[symbol] {
symbolsToFetchMap[symbol] = true
symbolsToFetch = append(symbolsToFetch, symbol)
}
continue
}
for _, currency := range currencies {
if now-tokenPriceCache[currency].UpdatedAt > maxAgeInSeconds {
if !symbolsToFetchMap[symbol] {
symbolsToFetchMap[symbol] = true
symbolsToFetch = append(symbolsToFetch, symbol)
}
break
}
}
}
if len(symbolsToFetch) > 0 {
_, err := pm.FetchPrices(symbolsToFetch, currencies)
if err != nil {
return nil, err
}
}
prices := pm.getCachedPricesFor(symbols, currencies)
return prices, nil
}

View File

@ -0,0 +1,5 @@
package price
type Provider interface {
FetchPrices(symbols []string, currencies []string) (map[string]map[string]float64, error)
}

View File

@ -0,0 +1,97 @@
package price
import (
"testing"
"github.com/stretchr/testify/require"
)
type MockPriceProvider struct {
mockPrices map[string]map[string]float64
}
func NewMockPriceProvider() *MockPriceProvider {
return &MockPriceProvider{}
}
func (mpp *MockPriceProvider) setMockPrices(prices map[string]map[string]float64) {
mpp.mockPrices = prices
}
func (mpp *MockPriceProvider) FetchPrices(symbols []string, currencies []string) (map[string]map[string]float64, error) {
res := make(map[string]map[string]float64)
for _, symbol := range symbols {
res[symbol] = make(map[string]float64)
for _, currency := range currencies {
res[symbol][currency] = mpp.mockPrices[symbol][currency]
}
}
return res, nil
}
func setupTestPrice(t *testing.T, priceProvider Provider) *Manager {
return NewManager(priceProvider)
}
func TestPrice(t *testing.T) {
priceProvider := NewMockPriceProvider()
mockPrices := map[string]map[string]float64{
"BTC": {
"USD": 1.23456,
"EUR": 2.34567,
"DAI": 3.45678,
"ARS": 9.87654,
},
"ETH": {
"USD": 4.56789,
"EUR": 5.67891,
"DAI": 6.78912,
"ARS": 8.76543,
},
"SNT": {
"USD": 7.654,
"EUR": 6.0,
"DAI": 1455.12,
"ARS": 0.0,
},
}
priceProvider.setMockPrices(mockPrices)
manager := setupTestPrice(t, priceProvider)
{
rst := manager.GetCachedPrices()
require.Empty(t, rst)
}
{
symbols := []string{"BTC", "ETH"}
currencies := []string{"USD", "EUR"}
rst, err := manager.FetchPrices(symbols, currencies)
require.NoError(t, err)
for _, symbol := range symbols {
for _, currency := range currencies {
require.Equal(t, rst[symbol][currency], mockPrices[symbol][currency])
}
}
}
{
symbols := []string{"BTC", "ETH", "SNT"}
currencies := []string{"USD", "EUR", "DAI", "ARS"}
rst, err := manager.FetchPrices(symbols, currencies)
require.NoError(t, err)
for _, symbol := range symbols {
for _, currency := range currencies {
require.Equal(t, rst[symbol][currency], mockPrices[symbol][currency])
}
}
}
cache := manager.GetCachedPrices()
for symbol, pricePerCurrency := range mockPrices {
for currency, price := range pricePerCurrency {
require.Equal(t, price, cache[symbol][currency].Price)
}
}
}

View File

@ -1,75 +0,0 @@
package wallet
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/status-im/status-go/appdatabase"
"github.com/status-im/status-go/services/wallet/thirdparty"
)
func setupTestPriceDB(t *testing.T) (*PriceManager, func()) {
db, err := appdatabase.InitializeDB(":memory:", "wallet-price-tests-", 1)
require.NoError(t, err)
return NewPriceManager(db, thirdparty.NewCryptoCompare()), func() {
require.NoError(t, db.Close())
}
}
func TestPrice(t *testing.T) {
manager, stop := setupTestPriceDB(t)
defer stop()
rst, err := manager.GetCachedPrices()
require.NoError(t, err)
require.Empty(t, rst)
pr1 := PricesPerTokenAndCurrency{
"ETH": {
"USD": 1.23456,
"EUR": 2.34567,
"DAI": 3.45678,
},
"BTC": {
"USD": 4.56789,
"EUR": 5.67891,
"DAI": 6.78912,
},
}
err = manager.updatePriceCache(pr1)
require.NoError(t, err)
rst, err = manager.GetCachedPrices()
require.NoError(t, err)
require.Equal(t, rst, pr1)
pr2 := PricesPerTokenAndCurrency{
"BTC": {
"USD": 1.23456,
"EUR": 2.34567,
"DAI": 3.45678,
"ARS": 9.87654,
},
"ETH": {
"USD": 4.56789,
"EUR": 5.67891,
"DAI": 6.78912,
"ARS": 8.76543,
},
"SNT": {
"USD": 7.654,
"EUR": 6.0,
"DAI": 1455.12,
"ARS": 0.0,
},
}
err = manager.updatePriceCache(pr2)
require.NoError(t, err)
rst, err = manager.GetCachedPrices()
require.NoError(t, err)
require.Equal(t, rst, pr2)
}

View File

@ -13,6 +13,8 @@ import (
"github.com/status-im/status-go/rpc"
"github.com/status-im/status-go/services/wallet/async"
"github.com/status-im/status-go/services/wallet/chain"
"github.com/status-im/status-go/services/wallet/price"
"github.com/status-im/status-go/services/wallet/thirdparty"
"github.com/status-im/status-go/services/wallet/token"
"github.com/status-im/status-go/services/wallet/walletevent"
@ -26,14 +28,14 @@ func getFixedCurrencies() []string {
return []string{"USD"}
}
func NewReader(rpcClient *rpc.Client, tokenManager *token.Manager, priceManager *PriceManager, cryptoCompare *thirdparty.CryptoCompare, accountsDB *accounts.Database, walletFeed *event.Feed) *Reader {
func NewReader(rpcClient *rpc.Client, tokenManager *token.Manager, priceManager *price.Manager, cryptoCompare *thirdparty.CryptoCompare, accountsDB *accounts.Database, walletFeed *event.Feed) *Reader {
return &Reader{rpcClient, tokenManager, priceManager, cryptoCompare, accountsDB, walletFeed, nil}
}
type Reader struct {
rpcClient *rpc.Client
tokenManager *token.Manager
priceManager *PriceManager
priceManager *price.Manager
cryptoCompare *thirdparty.CryptoCompare
accountsDB *accounts.Database
walletFeed *event.Feed
@ -276,7 +278,7 @@ func (r *Reader) GetWalletToken(ctx context.Context, addresses []common.Address)
AssetWebsiteURL: tokenDetails[symbol].AssetWebsiteURL,
BuiltOn: tokenDetails[symbol].BuiltOn,
MarketValuesPerCurrency: marketValuesPerCurrency,
PegSymbol: tokens[0].PegSymbol,
PegSymbol: token.GetTokenPegSymbol(symbol),
}
result[address] = append(result[address], walletToken)

View File

@ -16,7 +16,9 @@ import (
"github.com/status-im/status-go/services/ens"
"github.com/status-im/status-go/services/stickers"
"github.com/status-im/status-go/services/wallet/chain"
"github.com/status-im/status-go/services/wallet/currency"
"github.com/status-im/status-go/services/wallet/history"
"github.com/status-im/status-go/services/wallet/price"
"github.com/status-im/status-go/services/wallet/thirdparty"
"github.com/status-im/status-go/services/wallet/token"
"github.com/status-im/status-go/services/wallet/transfer"
@ -55,9 +57,10 @@ func NewService(
transactionManager := &TransactionManager{db: db, transactor: transactor, gethManager: gethManager, config: config, accountsDB: accountsDB}
transferController := transfer.NewTransferController(db, rpcClient, accountFeed, walletFeed)
cryptoCompare := thirdparty.NewCryptoCompare()
priceManager := NewPriceManager(db, cryptoCompare)
priceManager := price.NewManager(cryptoCompare)
reader := NewReader(rpcClient, tokenManager, priceManager, cryptoCompare, accountsDB, walletFeed)
history := history.NewService(db, walletFeed, rpcClient, tokenManager, cryptoCompare)
currency := currency.NewService(db, walletFeed, tokenManager, priceManager)
return &Service{
db: db,
accountsDB: accountsDB,
@ -79,6 +82,7 @@ func NewService(
reader: reader,
cryptoCompare: cryptoCompare,
history: history,
currency: currency,
}
}
@ -93,7 +97,7 @@ type Service struct {
cryptoOnRampManager *CryptoOnRampManager
transferController *transfer.Controller
feesManager *FeeManager
priceManager *PriceManager
priceManager *price.Manager
started bool
openseaAPIKey string
gethManager *account.GethManager
@ -105,11 +109,13 @@ type Service struct {
reader *Reader
cryptoCompare *thirdparty.CryptoCompare
history *history.Service
currency *currency.Service
}
// Start signals transmitter.
func (s *Service) Start() error {
s.transferController.Start()
s.currency.Start()
err := s.signals.Start()
s.history.Start()
s.started = true
@ -126,6 +132,7 @@ func (s *Service) Stop() error {
log.Info("wallet will be stopped")
s.signals.Stop()
s.transferController.Stop()
s.currency.Stop()
s.reader.Stop()
s.history.Stop()
s.started = false

View File

@ -144,6 +144,24 @@ func (tm *Manager) FindSNT(chainID uint64) *Token {
return nil
}
func (tm *Manager) GetAllTokensAndNativeCurrencies() ([]*Token, error) {
allTokens, err := tm.GetAllTokens()
if err != nil {
return nil, err
}
networks, err := tm.RPCClient.NetworkManager.Get(false)
if err != nil {
return nil, err
}
for _, network := range networks {
allTokens = append(allTokens, tm.ToToken(network))
}
return allTokens, nil
}
func (tm *Manager) GetAllTokens() ([]*Token, error) {
result := make([]*Token, 0)
for _, tokens := range tokenStore {

View File

@ -2,6 +2,27 @@ package token
import "github.com/ethereum/go-ethereum/common"
var tokenPeg = map[string]string{
"aUSDC": "USD",
"DAI": "USD",
"SAI": "USD",
"sUSD": "USD",
"PAXG": "XAU",
"TCAD": "CAD",
"TUSD": "USD",
"TGBP": "GBP",
"TAUD": "AUD",
"USDC": "USD",
"USDD": "USD",
"USDS": "USD",
"USDT": "USD",
"USDP": "USD",
}
func GetTokenPegSymbol(symbol string) string {
return tokenPeg[symbol]
}
var tokenStore = map[uint64]map[common.Address]*Token{
1: {
common.HexToAddress("0x6b175474e89094c44da98b954eedeac495271d0f"): &Token{
@ -11,7 +32,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 18,
ChainID: 1,
PegSymbol: "USD",
},
common.HexToAddress("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"): &Token{
Address: common.HexToAddress("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359"),
@ -20,7 +40,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 18,
ChainID: 1,
PegSymbol: "USD",
},
common.HexToAddress("0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2"): &Token{
Address: common.HexToAddress("0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2"),
@ -733,7 +752,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 6,
ChainID: 1,
PegSymbol: "USD",
},
common.HexToAddress("0x58b6a8a3302369daec383334672404ee733ab239"): &Token{
Address: common.HexToAddress("0x58b6a8a3302369daec383334672404ee733ab239"),
@ -870,7 +888,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 18,
ChainID: 1,
PegSymbol: "USD",
},
common.HexToAddress("0xEA26c4aC16D4a5A106820BC8AEE85fd0b7b2b664"): &Token{
Address: common.HexToAddress("0xEA26c4aC16D4a5A106820BC8AEE85fd0b7b2b664"),
@ -887,7 +904,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 18,
ChainID: 1,
PegSymbol: "XAU",
},
common.HexToAddress("0x865ec58b06bF6305B886793AA20A2da31D034E68"): &Token{
Address: common.HexToAddress("0x865ec58b06bF6305B886793AA20A2da31D034E68"),
@ -944,7 +960,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 18,
ChainID: 1,
PegSymbol: "CAD",
},
common.HexToAddress("0x6710c63432A2De02954fc0f851db07146a6c0312"): &Token{
Address: common.HexToAddress("0x6710c63432A2De02954fc0f851db07146a6c0312"),
@ -985,7 +1000,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 18,
ChainID: 1,
PegSymbol: "USD",
},
common.HexToAddress("0xD0a4b8946Cb52f0661273bfbC6fD0E0C75Fc6433"): &Token{
Address: common.HexToAddress("0xD0a4b8946Cb52f0661273bfbC6fD0E0C75Fc6433"),
@ -1010,7 +1024,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 18,
ChainID: 1,
PegSymbol: "GBP",
},
common.HexToAddress("0xbf2179859fc6D5BEE9Bf9158632Dc51678a4100e"): &Token{
Address: common.HexToAddress("0xbf2179859fc6D5BEE9Bf9158632Dc51678a4100e"),
@ -1051,7 +1064,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 6,
ChainID: 1,
PegSymbol: "USD",
},
common.HexToAddress("0xa3d58c4E56fedCae3a7c43A725aeE9A71F0ece4e"): &Token{
Address: common.HexToAddress("0xa3d58c4E56fedCae3a7c43A725aeE9A71F0ece4e"),
@ -1092,7 +1104,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 18,
ChainID: 1,
PegSymbol: "AUD",
},
common.HexToAddress("0x66497A283E0a007bA3974e837784C6AE323447de"): &Token{
Address: common.HexToAddress("0x66497A283E0a007bA3974e837784C6AE323447de"),
@ -1181,7 +1192,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 6,
ChainID: 1,
PegSymbol: "USD",
},
common.HexToAddress("0xB98d4C97425d9908E66E53A6fDf673ACcA0BE986"): &Token{
Address: common.HexToAddress("0xB98d4C97425d9908E66E53A6fDf673ACcA0BE986"),
@ -1246,7 +1256,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 18,
ChainID: 1,
PegSymbol: "USD",
},
common.HexToAddress("0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643"): &Token{
Address: common.HexToAddress("0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643"),
@ -1311,7 +1320,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 6,
ChainID: 1,
PegSymbol: "USD",
},
common.HexToAddress("0xc944e90c64b2c07662a292be6244bdf05cda44a7"): &Token{
Address: common.HexToAddress("0xc944e90c64b2c07662a292be6244bdf05cda44a7"),
@ -1470,7 +1478,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 6,
ChainID: 5,
PegSymbol: "USD",
},
common.HexToAddress("0x022e292b44b5a146f2e8ee36ff44d3dd863c915c"): &Token{
Address: common.HexToAddress("0x022e292b44b5a146f2e8ee36ff44d3dd863c915c"),
@ -1503,7 +1510,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 6,
ChainID: 5,
PegSymbol: "USD",
},
common.HexToAddress("0xf2edF1c091f683E3fb452497d9a98A49cBA84666"): &Token{
Address: common.HexToAddress("0xf2edF1c091f683E3fb452497d9a98A49cBA84666"),
@ -1512,7 +1518,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 18,
ChainID: 5,
PegSymbol: "USD",
},
},
10: {
@ -1523,7 +1528,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 6,
ChainID: 10,
PegSymbol: "USD",
},
},
100: {
@ -1544,7 +1548,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 6,
ChainID: 420,
PegSymbol: "USD",
},
},
42161: {
@ -1555,7 +1558,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 18,
ChainID: 42161,
PegSymbol: "USD",
},
common.HexToAddress("0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"): &Token{
Address: common.HexToAddress("0xff970a61a04b1ca14834a43f5de4533ebddb5cc8"),
@ -1564,7 +1566,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 6,
ChainID: 42161,
PegSymbol: "USD",
},
common.HexToAddress("0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"): &Token{
Address: common.HexToAddress("0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"),
@ -1573,7 +1574,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 18,
ChainID: 42161,
PegSymbol: "USD",
},
common.HexToAddress("0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f"): &Token{
Address: common.HexToAddress("0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f"),
@ -1614,7 +1614,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 18,
ChainID: 42161,
PegSymbol: "USD",
},
common.HexToAddress("0x23a941036ae778ac51ab04cea08ed6e2fe103614"): &Token{
Address: common.HexToAddress("0x23a941036ae778ac51ab04cea08ed6e2fe103614"),
@ -1631,7 +1630,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 18,
ChainID: 42161,
PegSymbol: "USD",
},
common.HexToAddress("0x11cdb42b0eb46d95f990bedd4695a6e3fa034978"): &Token{
Address: common.HexToAddress("0x11cdb42b0eb46d95f990bedd4695a6e3fa034978"),
@ -1650,7 +1648,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 6,
ChainID: 421613,
PegSymbol: "USD",
},
common.HexToAddress("0x265B25e22bcd7f10a5bD6E6410F10537Cc7567e8"): &Token{
Address: common.HexToAddress("0x265B25e22bcd7f10a5bD6E6410F10537Cc7567e8"),
@ -1659,7 +1656,6 @@ var tokenStore = map[uint64]map[common.Address]*Token{
Color: "#f8f8f8",
Decimals: 6,
ChainID: 421613,
PegSymbol: "USD",
},
},
}

1
vendor/github.com/ladydascalie/currency/.gitignore generated vendored Normal file
View File

@ -0,0 +1 @@
.idea/

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
MIT License
Copyright (c) 2014 Ryan Graham
Copyright (c) 2021 Benjamin Cable
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

4
vendor/github.com/ladydascalie/currency/Makefile generated vendored Normal file
View File

@ -0,0 +1,4 @@
build:
go run cmd/main.go
gofmt -w std.go
go test -v -cover ./...

29
vendor/github.com/ladydascalie/currency/README.md generated vendored Normal file
View File

@ -0,0 +1,29 @@
# currency
This package generates structs containing all the up-to-date `ISO4217` currency codes and minor units, along with a very simple validator.
Data is graciously provided by:
- [International Organization for Standardization](https://www.iso.org/iso-4217-currency-codes.html)
- [Currency Code Services ISO 4217 Maintenance Agency](https://www.currency-iso.org)
## Usage:
```
package main
func main() {
// Validation of codes.
ok := currency.Valid("ABC")
if !ok {
// whatever you need.
}
// easy to get the values
fmt.Println(currency.USD.Code())
// Output: USD
fmt.Println(currency.USD.MinorUnit())
// Output: 2
}
```

791
vendor/github.com/ladydascalie/currency/std.go generated vendored Normal file
View File

@ -0,0 +1,791 @@
package currency
/*-------------------------------+
| Code generated by std_currency |
| DO NOT EDIT |
+-------------------------------*/
import "fmt"
// Currency defines a currency containing
// It's code, taken from the constants above
// as well as it's minor units, as an integer.
type Currency struct {
code string
minorUnits int
factor int
}
// Code returns the currency code to the user
func (c *Currency) Code() string { return c.code }
// MinorUnits returns the minor unit to the user
func (c *Currency) MinorUnits() int { return c.minorUnits }
// Factor returns the factor by which a float should be multiplied
// to get back to it's smallest denomination
//
// Example:
// pence := 100.00 * currency.GBP.Factor()
func (c *Currency) Factor() int { return c.factor }
// FactorI64 returns the factor, converted to a int64
func (c *Currency) FactorI64() int64 { return int64(c.factor) }
// FactorF64 returns the factor, converted to a float64
func (c *Currency) FactorF64() float64 { return float64(c.factor) }
// Get returns a currency struct if the provided
// code is contained within the valid codes. Otherwise
// an error will be returned
func Get(code string) (*Currency, error) {
if Valid(code) {
val, ok := currencies[code]
if ok {
return &val, nil
}
}
return nil, fmt.Errorf("currency: could not find currency with code: %q", code)
}
// Valid checks if a provided code is contained
// inside the provided ValidCodes slice
func Valid(code string) bool {
for _, c := range ValidCodes {
if c == code {
return true
}
}
return false
}
// Following are all the structs containing currency data
var (
// AED currency struct
AED = Currency{code: "AED", minorUnits: 2, factor: 100}
// AFN currency struct
AFN = Currency{code: "AFN", minorUnits: 2, factor: 100}
// ALL currency struct
ALL = Currency{code: "ALL", minorUnits: 2, factor: 100}
// AMD currency struct
AMD = Currency{code: "AMD", minorUnits: 2, factor: 100}
// ANG currency struct
ANG = Currency{code: "ANG", minorUnits: 2, factor: 100}
// AOA currency struct
AOA = Currency{code: "AOA", minorUnits: 2, factor: 100}
// ARS currency struct
ARS = Currency{code: "ARS", minorUnits: 2, factor: 100}
// AUD currency struct
AUD = Currency{code: "AUD", minorUnits: 2, factor: 100}
// AWG currency struct
AWG = Currency{code: "AWG", minorUnits: 2, factor: 100}
// AZN currency struct
AZN = Currency{code: "AZN", minorUnits: 2, factor: 100}
// BAM currency struct
BAM = Currency{code: "BAM", minorUnits: 2, factor: 100}
// BBD currency struct
BBD = Currency{code: "BBD", minorUnits: 2, factor: 100}
// BDT currency struct
BDT = Currency{code: "BDT", minorUnits: 2, factor: 100}
// BGN currency struct
BGN = Currency{code: "BGN", minorUnits: 2, factor: 100}
// BHD currency struct
BHD = Currency{code: "BHD", minorUnits: 3, factor: 1000}
// BIF currency struct
BIF = Currency{code: "BIF", minorUnits: 0, factor: 1}
// BMD currency struct
BMD = Currency{code: "BMD", minorUnits: 2, factor: 100}
// BND currency struct
BND = Currency{code: "BND", minorUnits: 2, factor: 100}
// BOB currency struct
BOB = Currency{code: "BOB", minorUnits: 2, factor: 100}
// BOV currency struct
BOV = Currency{code: "BOV", minorUnits: 2, factor: 100}
// BRL currency struct
BRL = Currency{code: "BRL", minorUnits: 2, factor: 100}
// BSD currency struct
BSD = Currency{code: "BSD", minorUnits: 2, factor: 100}
// BTN currency struct
BTN = Currency{code: "BTN", minorUnits: 2, factor: 100}
// BWP currency struct
BWP = Currency{code: "BWP", minorUnits: 2, factor: 100}
// BYN currency struct
BYN = Currency{code: "BYN", minorUnits: 2, factor: 100}
// BZD currency struct
BZD = Currency{code: "BZD", minorUnits: 2, factor: 100}
// CAD currency struct
CAD = Currency{code: "CAD", minorUnits: 2, factor: 100}
// CDF currency struct
CDF = Currency{code: "CDF", minorUnits: 2, factor: 100}
// CHE currency struct
CHE = Currency{code: "CHE", minorUnits: 2, factor: 100}
// CHF currency struct
CHF = Currency{code: "CHF", minorUnits: 2, factor: 100}
// CHW currency struct
CHW = Currency{code: "CHW", minorUnits: 2, factor: 100}
// CLF currency struct
CLF = Currency{code: "CLF", minorUnits: 4, factor: 10000}
// CLP currency struct
CLP = Currency{code: "CLP", minorUnits: 0, factor: 1}
// CNY currency struct
CNY = Currency{code: "CNY", minorUnits: 2, factor: 100}
// COP currency struct
COP = Currency{code: "COP", minorUnits: 2, factor: 100}
// COU currency struct
COU = Currency{code: "COU", minorUnits: 2, factor: 100}
// CRC currency struct
CRC = Currency{code: "CRC", minorUnits: 2, factor: 100}
// CUC currency struct
CUC = Currency{code: "CUC", minorUnits: 2, factor: 100}
// CUP currency struct
CUP = Currency{code: "CUP", minorUnits: 2, factor: 100}
// CVE currency struct
CVE = Currency{code: "CVE", minorUnits: 2, factor: 100}
// CZK currency struct
CZK = Currency{code: "CZK", minorUnits: 2, factor: 100}
// DJF currency struct
DJF = Currency{code: "DJF", minorUnits: 0, factor: 1}
// DKK currency struct
DKK = Currency{code: "DKK", minorUnits: 2, factor: 100}
// DOP currency struct
DOP = Currency{code: "DOP", minorUnits: 2, factor: 100}
// DZD currency struct
DZD = Currency{code: "DZD", minorUnits: 2, factor: 100}
// EGP currency struct
EGP = Currency{code: "EGP", minorUnits: 2, factor: 100}
// ERN currency struct
ERN = Currency{code: "ERN", minorUnits: 2, factor: 100}
// ETB currency struct
ETB = Currency{code: "ETB", minorUnits: 2, factor: 100}
// EUR currency struct
EUR = Currency{code: "EUR", minorUnits: 2, factor: 100}
// FJD currency struct
FJD = Currency{code: "FJD", minorUnits: 2, factor: 100}
// FKP currency struct
FKP = Currency{code: "FKP", minorUnits: 2, factor: 100}
// GBP currency struct
GBP = Currency{code: "GBP", minorUnits: 2, factor: 100}
// GEL currency struct
GEL = Currency{code: "GEL", minorUnits: 2, factor: 100}
// GHS currency struct
GHS = Currency{code: "GHS", minorUnits: 2, factor: 100}
// GIP currency struct
GIP = Currency{code: "GIP", minorUnits: 2, factor: 100}
// GMD currency struct
GMD = Currency{code: "GMD", minorUnits: 2, factor: 100}
// GNF currency struct
GNF = Currency{code: "GNF", minorUnits: 0, factor: 1}
// GTQ currency struct
GTQ = Currency{code: "GTQ", minorUnits: 2, factor: 100}
// GYD currency struct
GYD = Currency{code: "GYD", minorUnits: 2, factor: 100}
// HKD currency struct
HKD = Currency{code: "HKD", minorUnits: 2, factor: 100}
// HNL currency struct
HNL = Currency{code: "HNL", minorUnits: 2, factor: 100}
// HTG currency struct
HTG = Currency{code: "HTG", minorUnits: 2, factor: 100}
// HUF currency struct
HUF = Currency{code: "HUF", minorUnits: 2, factor: 100}
// IDR currency struct
IDR = Currency{code: "IDR", minorUnits: 2, factor: 100}
// ILS currency struct
ILS = Currency{code: "ILS", minorUnits: 2, factor: 100}
// INR currency struct
INR = Currency{code: "INR", minorUnits: 2, factor: 100}
// IQD currency struct
IQD = Currency{code: "IQD", minorUnits: 3, factor: 1000}
// IRR currency struct
IRR = Currency{code: "IRR", minorUnits: 2, factor: 100}
// ISK currency struct
ISK = Currency{code: "ISK", minorUnits: 0, factor: 1}
// JMD currency struct
JMD = Currency{code: "JMD", minorUnits: 2, factor: 100}
// JOD currency struct
JOD = Currency{code: "JOD", minorUnits: 3, factor: 1000}
// JPY currency struct
JPY = Currency{code: "JPY", minorUnits: 0, factor: 1}
// KES currency struct
KES = Currency{code: "KES", minorUnits: 2, factor: 100}
// KGS currency struct
KGS = Currency{code: "KGS", minorUnits: 2, factor: 100}
// KHR currency struct
KHR = Currency{code: "KHR", minorUnits: 2, factor: 100}
// KMF currency struct
KMF = Currency{code: "KMF", minorUnits: 0, factor: 1}
// KPW currency struct
KPW = Currency{code: "KPW", minorUnits: 2, factor: 100}
// KRW currency struct
KRW = Currency{code: "KRW", minorUnits: 0, factor: 1}
// KWD currency struct
KWD = Currency{code: "KWD", minorUnits: 3, factor: 1000}
// KYD currency struct
KYD = Currency{code: "KYD", minorUnits: 2, factor: 100}
// KZT currency struct
KZT = Currency{code: "KZT", minorUnits: 2, factor: 100}
// LAK currency struct
LAK = Currency{code: "LAK", minorUnits: 2, factor: 100}
// LBP currency struct
LBP = Currency{code: "LBP", minorUnits: 2, factor: 100}
// LKR currency struct
LKR = Currency{code: "LKR", minorUnits: 2, factor: 100}
// LRD currency struct
LRD = Currency{code: "LRD", minorUnits: 2, factor: 100}
// LSL currency struct
LSL = Currency{code: "LSL", minorUnits: 2, factor: 100}
// LYD currency struct
LYD = Currency{code: "LYD", minorUnits: 3, factor: 1000}
// MAD currency struct
MAD = Currency{code: "MAD", minorUnits: 2, factor: 100}
// MDL currency struct
MDL = Currency{code: "MDL", minorUnits: 2, factor: 100}
// MGA currency struct
MGA = Currency{code: "MGA", minorUnits: 2, factor: 100}
// MKD currency struct
MKD = Currency{code: "MKD", minorUnits: 2, factor: 100}
// MMK currency struct
MMK = Currency{code: "MMK", minorUnits: 2, factor: 100}
// MNT currency struct
MNT = Currency{code: "MNT", minorUnits: 2, factor: 100}
// MOP currency struct
MOP = Currency{code: "MOP", minorUnits: 2, factor: 100}
// MRU currency struct
MRU = Currency{code: "MRU", minorUnits: 2, factor: 100}
// MUR currency struct
MUR = Currency{code: "MUR", minorUnits: 2, factor: 100}
// MVR currency struct
MVR = Currency{code: "MVR", minorUnits: 2, factor: 100}
// MWK currency struct
MWK = Currency{code: "MWK", minorUnits: 2, factor: 100}
// MXN currency struct
MXN = Currency{code: "MXN", minorUnits: 2, factor: 100}
// MXV currency struct
MXV = Currency{code: "MXV", minorUnits: 2, factor: 100}
// MYR currency struct
MYR = Currency{code: "MYR", minorUnits: 2, factor: 100}
// MZN currency struct
MZN = Currency{code: "MZN", minorUnits: 2, factor: 100}
// NAD currency struct
NAD = Currency{code: "NAD", minorUnits: 2, factor: 100}
// NGN currency struct
NGN = Currency{code: "NGN", minorUnits: 2, factor: 100}
// NIO currency struct
NIO = Currency{code: "NIO", minorUnits: 2, factor: 100}
// NOK currency struct
NOK = Currency{code: "NOK", minorUnits: 2, factor: 100}
// NPR currency struct
NPR = Currency{code: "NPR", minorUnits: 2, factor: 100}
// NZD currency struct
NZD = Currency{code: "NZD", minorUnits: 2, factor: 100}
// OMR currency struct
OMR = Currency{code: "OMR", minorUnits: 3, factor: 1000}
// PAB currency struct
PAB = Currency{code: "PAB", minorUnits: 2, factor: 100}
// PEN currency struct
PEN = Currency{code: "PEN", minorUnits: 2, factor: 100}
// PGK currency struct
PGK = Currency{code: "PGK", minorUnits: 2, factor: 100}
// PHP currency struct
PHP = Currency{code: "PHP", minorUnits: 2, factor: 100}
// PKR currency struct
PKR = Currency{code: "PKR", minorUnits: 2, factor: 100}
// PLN currency struct
PLN = Currency{code: "PLN", minorUnits: 2, factor: 100}
// PYG currency struct
PYG = Currency{code: "PYG", minorUnits: 0, factor: 1}
// QAR currency struct
QAR = Currency{code: "QAR", minorUnits: 2, factor: 100}
// RON currency struct
RON = Currency{code: "RON", minorUnits: 2, factor: 100}
// RSD currency struct
RSD = Currency{code: "RSD", minorUnits: 2, factor: 100}
// RUB currency struct
RUB = Currency{code: "RUB", minorUnits: 2, factor: 100}
// RWF currency struct
RWF = Currency{code: "RWF", minorUnits: 0, factor: 1}
// SAR currency struct
SAR = Currency{code: "SAR", minorUnits: 2, factor: 100}
// SBD currency struct
SBD = Currency{code: "SBD", minorUnits: 2, factor: 100}
// SCR currency struct
SCR = Currency{code: "SCR", minorUnits: 2, factor: 100}
// SDG currency struct
SDG = Currency{code: "SDG", minorUnits: 2, factor: 100}
// SEK currency struct
SEK = Currency{code: "SEK", minorUnits: 2, factor: 100}
// SGD currency struct
SGD = Currency{code: "SGD", minorUnits: 2, factor: 100}
// SHP currency struct
SHP = Currency{code: "SHP", minorUnits: 2, factor: 100}
// SLE currency struct
SLE = Currency{code: "SLE", minorUnits: 2, factor: 100}
// SLL currency struct
SLL = Currency{code: "SLL", minorUnits: 2, factor: 100}
// SOS currency struct
SOS = Currency{code: "SOS", minorUnits: 2, factor: 100}
// SRD currency struct
SRD = Currency{code: "SRD", minorUnits: 2, factor: 100}
// SSP currency struct
SSP = Currency{code: "SSP", minorUnits: 2, factor: 100}
// STN currency struct
STN = Currency{code: "STN", minorUnits: 2, factor: 100}
// SVC currency struct
SVC = Currency{code: "SVC", minorUnits: 2, factor: 100}
// SYP currency struct
SYP = Currency{code: "SYP", minorUnits: 2, factor: 100}
// SZL currency struct
SZL = Currency{code: "SZL", minorUnits: 2, factor: 100}
// THB currency struct
THB = Currency{code: "THB", minorUnits: 2, factor: 100}
// TJS currency struct
TJS = Currency{code: "TJS", minorUnits: 2, factor: 100}
// TMT currency struct
TMT = Currency{code: "TMT", minorUnits: 2, factor: 100}
// TND currency struct
TND = Currency{code: "TND", minorUnits: 3, factor: 1000}
// TOP currency struct
TOP = Currency{code: "TOP", minorUnits: 2, factor: 100}
// TRY currency struct
TRY = Currency{code: "TRY", minorUnits: 2, factor: 100}
// TTD currency struct
TTD = Currency{code: "TTD", minorUnits: 2, factor: 100}
// TWD currency struct
TWD = Currency{code: "TWD", minorUnits: 2, factor: 100}
// TZS currency struct
TZS = Currency{code: "TZS", minorUnits: 2, factor: 100}
// UAH currency struct
UAH = Currency{code: "UAH", minorUnits: 2, factor: 100}
// UGX currency struct
UGX = Currency{code: "UGX", minorUnits: 0, factor: 1}
// USD currency struct
USD = Currency{code: "USD", minorUnits: 2, factor: 100}
// USN currency struct
USN = Currency{code: "USN", minorUnits: 2, factor: 100}
// UYI currency struct
UYI = Currency{code: "UYI", minorUnits: 0, factor: 1}
// UYU currency struct
UYU = Currency{code: "UYU", minorUnits: 2, factor: 100}
// UYW currency struct
UYW = Currency{code: "UYW", minorUnits: 4, factor: 10000}
// UZS currency struct
UZS = Currency{code: "UZS", minorUnits: 2, factor: 100}
// VED currency struct
VED = Currency{code: "VED", minorUnits: 2, factor: 100}
// VES currency struct
VES = Currency{code: "VES", minorUnits: 2, factor: 100}
// VND currency struct
VND = Currency{code: "VND", minorUnits: 0, factor: 1}
// VUV currency struct
VUV = Currency{code: "VUV", minorUnits: 0, factor: 1}
// WST currency struct
WST = Currency{code: "WST", minorUnits: 2, factor: 100}
// XAF currency struct
XAF = Currency{code: "XAF", minorUnits: 0, factor: 1}
// XAG currency struct
XAG = Currency{code: "XAG", minorUnits: 0, factor: 1}
// XAU currency struct
XAU = Currency{code: "XAU", minorUnits: 0, factor: 1}
// XBA currency struct
XBA = Currency{code: "XBA", minorUnits: 0, factor: 1}
// XBB currency struct
XBB = Currency{code: "XBB", minorUnits: 0, factor: 1}
// XBC currency struct
XBC = Currency{code: "XBC", minorUnits: 0, factor: 1}
// XBD currency struct
XBD = Currency{code: "XBD", minorUnits: 0, factor: 1}
// XCD currency struct
XCD = Currency{code: "XCD", minorUnits: 2, factor: 100}
// XDR currency struct
XDR = Currency{code: "XDR", minorUnits: 0, factor: 1}
// XOF currency struct
XOF = Currency{code: "XOF", minorUnits: 0, factor: 1}
// XPD currency struct
XPD = Currency{code: "XPD", minorUnits: 0, factor: 1}
// XPF currency struct
XPF = Currency{code: "XPF", minorUnits: 0, factor: 1}
// XPT currency struct
XPT = Currency{code: "XPT", minorUnits: 0, factor: 1}
// XSU currency struct
XSU = Currency{code: "XSU", minorUnits: 0, factor: 1}
// XTS currency struct
XTS = Currency{code: "XTS", minorUnits: 0, factor: 1}
// XUA currency struct
XUA = Currency{code: "XUA", minorUnits: 0, factor: 1}
// XXX currency struct
XXX = Currency{code: "XXX", minorUnits: 0, factor: 1}
// YER currency struct
YER = Currency{code: "YER", minorUnits: 2, factor: 100}
// ZAR currency struct
ZAR = Currency{code: "ZAR", minorUnits: 2, factor: 100}
// ZMW currency struct
ZMW = Currency{code: "ZMW", minorUnits: 2, factor: 100}
// ZWL currency struct
ZWL = Currency{code: "ZWL", minorUnits: 2, factor: 100}
)
var currencies = map[string]Currency{
"AED": AED,
"AFN": AFN,
"ALL": ALL,
"AMD": AMD,
"ANG": ANG,
"AOA": AOA,
"ARS": ARS,
"AUD": AUD,
"AWG": AWG,
"AZN": AZN,
"BAM": BAM,
"BBD": BBD,
"BDT": BDT,
"BGN": BGN,
"BHD": BHD,
"BIF": BIF,
"BMD": BMD,
"BND": BND,
"BOB": BOB,
"BOV": BOV,
"BRL": BRL,
"BSD": BSD,
"BTN": BTN,
"BWP": BWP,
"BYN": BYN,
"BZD": BZD,
"CAD": CAD,
"CDF": CDF,
"CHE": CHE,
"CHF": CHF,
"CHW": CHW,
"CLF": CLF,
"CLP": CLP,
"CNY": CNY,
"COP": COP,
"COU": COU,
"CRC": CRC,
"CUC": CUC,
"CUP": CUP,
"CVE": CVE,
"CZK": CZK,
"DJF": DJF,
"DKK": DKK,
"DOP": DOP,
"DZD": DZD,
"EGP": EGP,
"ERN": ERN,
"ETB": ETB,
"EUR": EUR,
"FJD": FJD,
"FKP": FKP,
"GBP": GBP,
"GEL": GEL,
"GHS": GHS,
"GIP": GIP,
"GMD": GMD,
"GNF": GNF,
"GTQ": GTQ,
"GYD": GYD,
"HKD": HKD,
"HNL": HNL,
"HTG": HTG,
"HUF": HUF,
"IDR": IDR,
"ILS": ILS,
"INR": INR,
"IQD": IQD,
"IRR": IRR,
"ISK": ISK,
"JMD": JMD,
"JOD": JOD,
"JPY": JPY,
"KES": KES,
"KGS": KGS,
"KHR": KHR,
"KMF": KMF,
"KPW": KPW,
"KRW": KRW,
"KWD": KWD,
"KYD": KYD,
"KZT": KZT,
"LAK": LAK,
"LBP": LBP,
"LKR": LKR,
"LRD": LRD,
"LSL": LSL,
"LYD": LYD,
"MAD": MAD,
"MDL": MDL,
"MGA": MGA,
"MKD": MKD,
"MMK": MMK,
"MNT": MNT,
"MOP": MOP,
"MRU": MRU,
"MUR": MUR,
"MVR": MVR,
"MWK": MWK,
"MXN": MXN,
"MXV": MXV,
"MYR": MYR,
"MZN": MZN,
"NAD": NAD,
"NGN": NGN,
"NIO": NIO,
"NOK": NOK,
"NPR": NPR,
"NZD": NZD,
"OMR": OMR,
"PAB": PAB,
"PEN": PEN,
"PGK": PGK,
"PHP": PHP,
"PKR": PKR,
"PLN": PLN,
"PYG": PYG,
"QAR": QAR,
"RON": RON,
"RSD": RSD,
"RUB": RUB,
"RWF": RWF,
"SAR": SAR,
"SBD": SBD,
"SCR": SCR,
"SDG": SDG,
"SEK": SEK,
"SGD": SGD,
"SHP": SHP,
"SLE": SLE,
"SLL": SLL,
"SOS": SOS,
"SRD": SRD,
"SSP": SSP,
"STN": STN,
"SVC": SVC,
"SYP": SYP,
"SZL": SZL,
"THB": THB,
"TJS": TJS,
"TMT": TMT,
"TND": TND,
"TOP": TOP,
"TRY": TRY,
"TTD": TTD,
"TWD": TWD,
"TZS": TZS,
"UAH": UAH,
"UGX": UGX,
"USD": USD,
"USN": USN,
"UYI": UYI,
"UYU": UYU,
"UYW": UYW,
"UZS": UZS,
"VED": VED,
"VES": VES,
"VND": VND,
"VUV": VUV,
"WST": WST,
"XAF": XAF,
"XAG": XAG,
"XAU": XAU,
"XBA": XBA,
"XBB": XBB,
"XBC": XBC,
"XBD": XBD,
"XCD": XCD,
"XDR": XDR,
"XOF": XOF,
"XPD": XPD,
"XPF": XPF,
"XPT": XPT,
"XSU": XSU,
"XTS": XTS,
"XUA": XUA,
"XXX": XXX,
"YER": YER,
"ZAR": ZAR,
"ZMW": ZMW,
"ZWL": ZWL,
}
// ValidCodes is provided so that you may build your own validation against it
var ValidCodes = []string{
"AED",
"AFN",
"ALL",
"AMD",
"ANG",
"AOA",
"ARS",
"AUD",
"AWG",
"AZN",
"BAM",
"BBD",
"BDT",
"BGN",
"BHD",
"BIF",
"BMD",
"BND",
"BOB",
"BOV",
"BRL",
"BSD",
"BTN",
"BWP",
"BYN",
"BZD",
"CAD",
"CDF",
"CHE",
"CHF",
"CHW",
"CLF",
"CLP",
"CNY",
"COP",
"COU",
"CRC",
"CUC",
"CUP",
"CVE",
"CZK",
"DJF",
"DKK",
"DOP",
"DZD",
"EGP",
"ERN",
"ETB",
"EUR",
"FJD",
"FKP",
"GBP",
"GEL",
"GHS",
"GIP",
"GMD",
"GNF",
"GTQ",
"GYD",
"HKD",
"HNL",
"HTG",
"HUF",
"IDR",
"ILS",
"INR",
"IQD",
"IRR",
"ISK",
"JMD",
"JOD",
"JPY",
"KES",
"KGS",
"KHR",
"KMF",
"KPW",
"KRW",
"KWD",
"KYD",
"KZT",
"LAK",
"LBP",
"LKR",
"LRD",
"LSL",
"LYD",
"MAD",
"MDL",
"MGA",
"MKD",
"MMK",
"MNT",
"MOP",
"MRU",
"MUR",
"MVR",
"MWK",
"MXN",
"MXV",
"MYR",
"MZN",
"NAD",
"NGN",
"NIO",
"NOK",
"NPR",
"NZD",
"OMR",
"PAB",
"PEN",
"PGK",
"PHP",
"PKR",
"PLN",
"PYG",
"QAR",
"RON",
"RSD",
"RUB",
"RWF",
"SAR",
"SBD",
"SCR",
"SDG",
"SEK",
"SGD",
"SHP",
"SLE",
"SLL",
"SOS",
"SRD",
"SSP",
"STN",
"SVC",
"SYP",
"SZL",
"THB",
"TJS",
"TMT",
"TND",
"TOP",
"TRY",
"TTD",
"TWD",
"TZS",
"UAH",
"UGX",
"USD",
"USN",
"UYI",
"UYU",
"UYW",
"UZS",
"VED",
"VES",
"VND",
"VUV",
"WST",
"XAF",
"XAG",
"XAU",
"XBA",
"XBB",
"XBC",
"XBD",
"XCD",
"XDR",
"XOF",
"XPD",
"XPF",
"XPT",
"XSU",
"XTS",
"XUA",
"XXX",
"YER",
"ZAR",
"ZMW",
"ZWL",
}

186
vendor/github.com/ladydascalie/currency/std.kt generated vendored Normal file
View File

@ -0,0 +1,186 @@
data class Currency(val currencyCode: String, val minorUnits: Int, val factor: Int) {
companion object {
val currencyMap = mapOf<String, Currency>(
"AED" to Currency("AED", 2, 100),
"AFN" to Currency("AFN", 2, 100),
"ALL" to Currency("ALL", 2, 100),
"AMD" to Currency("AMD", 2, 100),
"ANG" to Currency("ANG", 2, 100),
"AOA" to Currency("AOA", 2, 100),
"ARS" to Currency("ARS", 2, 100),
"AUD" to Currency("AUD", 2, 100),
"AWG" to Currency("AWG", 2, 100),
"AZN" to Currency("AZN", 2, 100),
"BAM" to Currency("BAM", 2, 100),
"BBD" to Currency("BBD", 2, 100),
"BDT" to Currency("BDT", 2, 100),
"BGN" to Currency("BGN", 2, 100),
"BHD" to Currency("BHD", 3, 1000),
"BIF" to Currency("BIF", 0, 1),
"BMD" to Currency("BMD", 2, 100),
"BND" to Currency("BND", 2, 100),
"BOB" to Currency("BOB", 2, 100),
"BOV" to Currency("BOV", 2, 100),
"BRL" to Currency("BRL", 2, 100),
"BSD" to Currency("BSD", 2, 100),
"BTN" to Currency("BTN", 2, 100),
"BWP" to Currency("BWP", 2, 100),
"BYN" to Currency("BYN", 2, 100),
"BZD" to Currency("BZD", 2, 100),
"CAD" to Currency("CAD", 2, 100),
"CDF" to Currency("CDF", 2, 100),
"CHE" to Currency("CHE", 2, 100),
"CHF" to Currency("CHF", 2, 100),
"CHW" to Currency("CHW", 2, 100),
"CLF" to Currency("CLF", 4, 10000),
"CLP" to Currency("CLP", 0, 1),
"CNY" to Currency("CNY", 2, 100),
"COP" to Currency("COP", 2, 100),
"COU" to Currency("COU", 2, 100),
"CRC" to Currency("CRC", 2, 100),
"CUC" to Currency("CUC", 2, 100),
"CUP" to Currency("CUP", 2, 100),
"CVE" to Currency("CVE", 2, 100),
"CZK" to Currency("CZK", 2, 100),
"DJF" to Currency("DJF", 0, 1),
"DKK" to Currency("DKK", 2, 100),
"DOP" to Currency("DOP", 2, 100),
"DZD" to Currency("DZD", 2, 100),
"EGP" to Currency("EGP", 2, 100),
"ERN" to Currency("ERN", 2, 100),
"ETB" to Currency("ETB", 2, 100),
"EUR" to Currency("EUR", 2, 100),
"FJD" to Currency("FJD", 2, 100),
"FKP" to Currency("FKP", 2, 100),
"GBP" to Currency("GBP", 2, 100),
"GEL" to Currency("GEL", 2, 100),
"GHS" to Currency("GHS", 2, 100),
"GIP" to Currency("GIP", 2, 100),
"GMD" to Currency("GMD", 2, 100),
"GNF" to Currency("GNF", 0, 1),
"GTQ" to Currency("GTQ", 2, 100),
"GYD" to Currency("GYD", 2, 100),
"HKD" to Currency("HKD", 2, 100),
"HNL" to Currency("HNL", 2, 100),
"HTG" to Currency("HTG", 2, 100),
"HUF" to Currency("HUF", 2, 100),
"IDR" to Currency("IDR", 2, 100),
"ILS" to Currency("ILS", 2, 100),
"INR" to Currency("INR", 2, 100),
"IQD" to Currency("IQD", 3, 1000),
"IRR" to Currency("IRR", 2, 100),
"ISK" to Currency("ISK", 0, 1),
"JMD" to Currency("JMD", 2, 100),
"JOD" to Currency("JOD", 3, 1000),
"JPY" to Currency("JPY", 0, 1),
"KES" to Currency("KES", 2, 100),
"KGS" to Currency("KGS", 2, 100),
"KHR" to Currency("KHR", 2, 100),
"KMF" to Currency("KMF", 0, 1),
"KPW" to Currency("KPW", 2, 100),
"KRW" to Currency("KRW", 0, 1),
"KWD" to Currency("KWD", 3, 1000),
"KYD" to Currency("KYD", 2, 100),
"KZT" to Currency("KZT", 2, 100),
"LAK" to Currency("LAK", 2, 100),
"LBP" to Currency("LBP", 2, 100),
"LKR" to Currency("LKR", 2, 100),
"LRD" to Currency("LRD", 2, 100),
"LSL" to Currency("LSL", 2, 100),
"LYD" to Currency("LYD", 3, 1000),
"MAD" to Currency("MAD", 2, 100),
"MDL" to Currency("MDL", 2, 100),
"MGA" to Currency("MGA", 2, 100),
"MKD" to Currency("MKD", 2, 100),
"MMK" to Currency("MMK", 2, 100),
"MNT" to Currency("MNT", 2, 100),
"MOP" to Currency("MOP", 2, 100),
"MRU" to Currency("MRU", 2, 100),
"MUR" to Currency("MUR", 2, 100),
"MVR" to Currency("MVR", 2, 100),
"MWK" to Currency("MWK", 2, 100),
"MXN" to Currency("MXN", 2, 100),
"MXV" to Currency("MXV", 2, 100),
"MYR" to Currency("MYR", 2, 100),
"MZN" to Currency("MZN", 2, 100),
"NAD" to Currency("NAD", 2, 100),
"NGN" to Currency("NGN", 2, 100),
"NIO" to Currency("NIO", 2, 100),
"NOK" to Currency("NOK", 2, 100),
"NPR" to Currency("NPR", 2, 100),
"NZD" to Currency("NZD", 2, 100),
"OMR" to Currency("OMR", 3, 1000),
"PAB" to Currency("PAB", 2, 100),
"PEN" to Currency("PEN", 2, 100),
"PGK" to Currency("PGK", 2, 100),
"PHP" to Currency("PHP", 2, 100),
"PKR" to Currency("PKR", 2, 100),
"PLN" to Currency("PLN", 2, 100),
"PYG" to Currency("PYG", 0, 1),
"QAR" to Currency("QAR", 2, 100),
"RON" to Currency("RON", 2, 100),
"RSD" to Currency("RSD", 2, 100),
"RUB" to Currency("RUB", 2, 100),
"RWF" to Currency("RWF", 0, 1),
"SAR" to Currency("SAR", 2, 100),
"SBD" to Currency("SBD", 2, 100),
"SCR" to Currency("SCR", 2, 100),
"SDG" to Currency("SDG", 2, 100),
"SEK" to Currency("SEK", 2, 100),
"SGD" to Currency("SGD", 2, 100),
"SHP" to Currency("SHP", 2, 100),
"SLE" to Currency("SLE", 2, 100),
"SLL" to Currency("SLL", 2, 100),
"SOS" to Currency("SOS", 2, 100),
"SRD" to Currency("SRD", 2, 100),
"SSP" to Currency("SSP", 2, 100),
"STN" to Currency("STN", 2, 100),
"SVC" to Currency("SVC", 2, 100),
"SYP" to Currency("SYP", 2, 100),
"SZL" to Currency("SZL", 2, 100),
"THB" to Currency("THB", 2, 100),
"TJS" to Currency("TJS", 2, 100),
"TMT" to Currency("TMT", 2, 100),
"TND" to Currency("TND", 3, 1000),
"TOP" to Currency("TOP", 2, 100),
"TRY" to Currency("TRY", 2, 100),
"TTD" to Currency("TTD", 2, 100),
"TWD" to Currency("TWD", 2, 100),
"TZS" to Currency("TZS", 2, 100),
"UAH" to Currency("UAH", 2, 100),
"UGX" to Currency("UGX", 0, 1),
"USD" to Currency("USD", 2, 100),
"USN" to Currency("USN", 2, 100),
"UYI" to Currency("UYI", 0, 1),
"UYU" to Currency("UYU", 2, 100),
"UYW" to Currency("UYW", 4, 10000),
"UZS" to Currency("UZS", 2, 100),
"VED" to Currency("VED", 2, 100),
"VES" to Currency("VES", 2, 100),
"VND" to Currency("VND", 0, 1),
"VUV" to Currency("VUV", 0, 1),
"WST" to Currency("WST", 2, 100),
"XAF" to Currency("XAF", 0, 1),
"XAG" to Currency("XAG", 0, 1),
"XAU" to Currency("XAU", 0, 1),
"XBA" to Currency("XBA", 0, 1),
"XBB" to Currency("XBB", 0, 1),
"XBC" to Currency("XBC", 0, 1),
"XBD" to Currency("XBD", 0, 1),
"XCD" to Currency("XCD", 2, 100),
"XDR" to Currency("XDR", 0, 1),
"XOF" to Currency("XOF", 0, 1),
"XPD" to Currency("XPD", 0, 1),
"XPF" to Currency("XPF", 0, 1),
"XPT" to Currency("XPT", 0, 1),
"XSU" to Currency("XSU", 0, 1),
"XTS" to Currency("XTS", 0, 1),
"XUA" to Currency("XUA", 0, 1),
"XXX" to Currency("XXX", 0, 1),
"YER" to Currency("YER", 2, 100),
"ZAR" to Currency("ZAR", 2, 100),
"ZMW" to Currency("ZMW", 2, 100),
"ZWL" to Currency("ZWL", 2, 100)
)
}
}

388
vendor/github.com/ladydascalie/currency/std.swift generated vendored Normal file
View File

@ -0,0 +1,388 @@
import UIKit
struct Currency {
/// The `ISO 4217` currency code
var code: String
/// The number of digits to display after the decimal point when displaying the currency
var minorUnits: Int
/// The factor to divide the currency figure by before handing to a currency formatter
var factor: Int
}
class Currencies {
static let AED: Currency = Currency(code: "AED", minorUnits: 2, factor: 100)
static let AFN: Currency = Currency(code: "AFN", minorUnits: 2, factor: 100)
static let ALL: Currency = Currency(code: "ALL", minorUnits: 2, factor: 100)
static let AMD: Currency = Currency(code: "AMD", minorUnits: 2, factor: 100)
static let ANG: Currency = Currency(code: "ANG", minorUnits: 2, factor: 100)
static let AOA: Currency = Currency(code: "AOA", minorUnits: 2, factor: 100)
static let ARS: Currency = Currency(code: "ARS", minorUnits: 2, factor: 100)
static let AUD: Currency = Currency(code: "AUD", minorUnits: 2, factor: 100)
static let AWG: Currency = Currency(code: "AWG", minorUnits: 2, factor: 100)
static let AZN: Currency = Currency(code: "AZN", minorUnits: 2, factor: 100)
static let BAM: Currency = Currency(code: "BAM", minorUnits: 2, factor: 100)
static let BBD: Currency = Currency(code: "BBD", minorUnits: 2, factor: 100)
static let BDT: Currency = Currency(code: "BDT", minorUnits: 2, factor: 100)
static let BGN: Currency = Currency(code: "BGN", minorUnits: 2, factor: 100)
static let BHD: Currency = Currency(code: "BHD", minorUnits: 3, factor: 1000)
static let BIF: Currency = Currency(code: "BIF", minorUnits: 0, factor: 1)
static let BMD: Currency = Currency(code: "BMD", minorUnits: 2, factor: 100)
static let BND: Currency = Currency(code: "BND", minorUnits: 2, factor: 100)
static let BOB: Currency = Currency(code: "BOB", minorUnits: 2, factor: 100)
static let BOV: Currency = Currency(code: "BOV", minorUnits: 2, factor: 100)
static let BRL: Currency = Currency(code: "BRL", minorUnits: 2, factor: 100)
static let BSD: Currency = Currency(code: "BSD", minorUnits: 2, factor: 100)
static let BTN: Currency = Currency(code: "BTN", minorUnits: 2, factor: 100)
static let BWP: Currency = Currency(code: "BWP", minorUnits: 2, factor: 100)
static let BYN: Currency = Currency(code: "BYN", minorUnits: 2, factor: 100)
static let BZD: Currency = Currency(code: "BZD", minorUnits: 2, factor: 100)
static let CAD: Currency = Currency(code: "CAD", minorUnits: 2, factor: 100)
static let CDF: Currency = Currency(code: "CDF", minorUnits: 2, factor: 100)
static let CHE: Currency = Currency(code: "CHE", minorUnits: 2, factor: 100)
static let CHF: Currency = Currency(code: "CHF", minorUnits: 2, factor: 100)
static let CHW: Currency = Currency(code: "CHW", minorUnits: 2, factor: 100)
static let CLF: Currency = Currency(code: "CLF", minorUnits: 4, factor: 10000)
static let CLP: Currency = Currency(code: "CLP", minorUnits: 0, factor: 1)
static let CNY: Currency = Currency(code: "CNY", minorUnits: 2, factor: 100)
static let COP: Currency = Currency(code: "COP", minorUnits: 2, factor: 100)
static let COU: Currency = Currency(code: "COU", minorUnits: 2, factor: 100)
static let CRC: Currency = Currency(code: "CRC", minorUnits: 2, factor: 100)
static let CUC: Currency = Currency(code: "CUC", minorUnits: 2, factor: 100)
static let CUP: Currency = Currency(code: "CUP", minorUnits: 2, factor: 100)
static let CVE: Currency = Currency(code: "CVE", minorUnits: 2, factor: 100)
static let CZK: Currency = Currency(code: "CZK", minorUnits: 2, factor: 100)
static let DJF: Currency = Currency(code: "DJF", minorUnits: 0, factor: 1)
static let DKK: Currency = Currency(code: "DKK", minorUnits: 2, factor: 100)
static let DOP: Currency = Currency(code: "DOP", minorUnits: 2, factor: 100)
static let DZD: Currency = Currency(code: "DZD", minorUnits: 2, factor: 100)
static let EGP: Currency = Currency(code: "EGP", minorUnits: 2, factor: 100)
static let ERN: Currency = Currency(code: "ERN", minorUnits: 2, factor: 100)
static let ETB: Currency = Currency(code: "ETB", minorUnits: 2, factor: 100)
static let EUR: Currency = Currency(code: "EUR", minorUnits: 2, factor: 100)
static let FJD: Currency = Currency(code: "FJD", minorUnits: 2, factor: 100)
static let FKP: Currency = Currency(code: "FKP", minorUnits: 2, factor: 100)
static let GBP: Currency = Currency(code: "GBP", minorUnits: 2, factor: 100)
static let GEL: Currency = Currency(code: "GEL", minorUnits: 2, factor: 100)
static let GHS: Currency = Currency(code: "GHS", minorUnits: 2, factor: 100)
static let GIP: Currency = Currency(code: "GIP", minorUnits: 2, factor: 100)
static let GMD: Currency = Currency(code: "GMD", minorUnits: 2, factor: 100)
static let GNF: Currency = Currency(code: "GNF", minorUnits: 0, factor: 1)
static let GTQ: Currency = Currency(code: "GTQ", minorUnits: 2, factor: 100)
static let GYD: Currency = Currency(code: "GYD", minorUnits: 2, factor: 100)
static let HKD: Currency = Currency(code: "HKD", minorUnits: 2, factor: 100)
static let HNL: Currency = Currency(code: "HNL", minorUnits: 2, factor: 100)
static let HTG: Currency = Currency(code: "HTG", minorUnits: 2, factor: 100)
static let HUF: Currency = Currency(code: "HUF", minorUnits: 2, factor: 100)
static let IDR: Currency = Currency(code: "IDR", minorUnits: 2, factor: 100)
static let ILS: Currency = Currency(code: "ILS", minorUnits: 2, factor: 100)
static let INR: Currency = Currency(code: "INR", minorUnits: 2, factor: 100)
static let IQD: Currency = Currency(code: "IQD", minorUnits: 3, factor: 1000)
static let IRR: Currency = Currency(code: "IRR", minorUnits: 2, factor: 100)
static let ISK: Currency = Currency(code: "ISK", minorUnits: 0, factor: 1)
static let JMD: Currency = Currency(code: "JMD", minorUnits: 2, factor: 100)
static let JOD: Currency = Currency(code: "JOD", minorUnits: 3, factor: 1000)
static let JPY: Currency = Currency(code: "JPY", minorUnits: 0, factor: 1)
static let KES: Currency = Currency(code: "KES", minorUnits: 2, factor: 100)
static let KGS: Currency = Currency(code: "KGS", minorUnits: 2, factor: 100)
static let KHR: Currency = Currency(code: "KHR", minorUnits: 2, factor: 100)
static let KMF: Currency = Currency(code: "KMF", minorUnits: 0, factor: 1)
static let KPW: Currency = Currency(code: "KPW", minorUnits: 2, factor: 100)
static let KRW: Currency = Currency(code: "KRW", minorUnits: 0, factor: 1)
static let KWD: Currency = Currency(code: "KWD", minorUnits: 3, factor: 1000)
static let KYD: Currency = Currency(code: "KYD", minorUnits: 2, factor: 100)
static let KZT: Currency = Currency(code: "KZT", minorUnits: 2, factor: 100)
static let LAK: Currency = Currency(code: "LAK", minorUnits: 2, factor: 100)
static let LBP: Currency = Currency(code: "LBP", minorUnits: 2, factor: 100)
static let LKR: Currency = Currency(code: "LKR", minorUnits: 2, factor: 100)
static let LRD: Currency = Currency(code: "LRD", minorUnits: 2, factor: 100)
static let LSL: Currency = Currency(code: "LSL", minorUnits: 2, factor: 100)
static let LYD: Currency = Currency(code: "LYD", minorUnits: 3, factor: 1000)
static let MAD: Currency = Currency(code: "MAD", minorUnits: 2, factor: 100)
static let MDL: Currency = Currency(code: "MDL", minorUnits: 2, factor: 100)
static let MGA: Currency = Currency(code: "MGA", minorUnits: 2, factor: 100)
static let MKD: Currency = Currency(code: "MKD", minorUnits: 2, factor: 100)
static let MMK: Currency = Currency(code: "MMK", minorUnits: 2, factor: 100)
static let MNT: Currency = Currency(code: "MNT", minorUnits: 2, factor: 100)
static let MOP: Currency = Currency(code: "MOP", minorUnits: 2, factor: 100)
static let MRU: Currency = Currency(code: "MRU", minorUnits: 2, factor: 100)
static let MUR: Currency = Currency(code: "MUR", minorUnits: 2, factor: 100)
static let MVR: Currency = Currency(code: "MVR", minorUnits: 2, factor: 100)
static let MWK: Currency = Currency(code: "MWK", minorUnits: 2, factor: 100)
static let MXN: Currency = Currency(code: "MXN", minorUnits: 2, factor: 100)
static let MXV: Currency = Currency(code: "MXV", minorUnits: 2, factor: 100)
static let MYR: Currency = Currency(code: "MYR", minorUnits: 2, factor: 100)
static let MZN: Currency = Currency(code: "MZN", minorUnits: 2, factor: 100)
static let NAD: Currency = Currency(code: "NAD", minorUnits: 2, factor: 100)
static let NGN: Currency = Currency(code: "NGN", minorUnits: 2, factor: 100)
static let NIO: Currency = Currency(code: "NIO", minorUnits: 2, factor: 100)
static let NOK: Currency = Currency(code: "NOK", minorUnits: 2, factor: 100)
static let NPR: Currency = Currency(code: "NPR", minorUnits: 2, factor: 100)
static let NZD: Currency = Currency(code: "NZD", minorUnits: 2, factor: 100)
static let OMR: Currency = Currency(code: "OMR", minorUnits: 3, factor: 1000)
static let PAB: Currency = Currency(code: "PAB", minorUnits: 2, factor: 100)
static let PEN: Currency = Currency(code: "PEN", minorUnits: 2, factor: 100)
static let PGK: Currency = Currency(code: "PGK", minorUnits: 2, factor: 100)
static let PHP: Currency = Currency(code: "PHP", minorUnits: 2, factor: 100)
static let PKR: Currency = Currency(code: "PKR", minorUnits: 2, factor: 100)
static let PLN: Currency = Currency(code: "PLN", minorUnits: 2, factor: 100)
static let PYG: Currency = Currency(code: "PYG", minorUnits: 0, factor: 1)
static let QAR: Currency = Currency(code: "QAR", minorUnits: 2, factor: 100)
static let RON: Currency = Currency(code: "RON", minorUnits: 2, factor: 100)
static let RSD: Currency = Currency(code: "RSD", minorUnits: 2, factor: 100)
static let RUB: Currency = Currency(code: "RUB", minorUnits: 2, factor: 100)
static let RWF: Currency = Currency(code: "RWF", minorUnits: 0, factor: 1)
static let SAR: Currency = Currency(code: "SAR", minorUnits: 2, factor: 100)
static let SBD: Currency = Currency(code: "SBD", minorUnits: 2, factor: 100)
static let SCR: Currency = Currency(code: "SCR", minorUnits: 2, factor: 100)
static let SDG: Currency = Currency(code: "SDG", minorUnits: 2, factor: 100)
static let SEK: Currency = Currency(code: "SEK", minorUnits: 2, factor: 100)
static let SGD: Currency = Currency(code: "SGD", minorUnits: 2, factor: 100)
static let SHP: Currency = Currency(code: "SHP", minorUnits: 2, factor: 100)
static let SLE: Currency = Currency(code: "SLE", minorUnits: 2, factor: 100)
static let SLL: Currency = Currency(code: "SLL", minorUnits: 2, factor: 100)
static let SOS: Currency = Currency(code: "SOS", minorUnits: 2, factor: 100)
static let SRD: Currency = Currency(code: "SRD", minorUnits: 2, factor: 100)
static let SSP: Currency = Currency(code: "SSP", minorUnits: 2, factor: 100)
static let STN: Currency = Currency(code: "STN", minorUnits: 2, factor: 100)
static let SVC: Currency = Currency(code: "SVC", minorUnits: 2, factor: 100)
static let SYP: Currency = Currency(code: "SYP", minorUnits: 2, factor: 100)
static let SZL: Currency = Currency(code: "SZL", minorUnits: 2, factor: 100)
static let THB: Currency = Currency(code: "THB", minorUnits: 2, factor: 100)
static let TJS: Currency = Currency(code: "TJS", minorUnits: 2, factor: 100)
static let TMT: Currency = Currency(code: "TMT", minorUnits: 2, factor: 100)
static let TND: Currency = Currency(code: "TND", minorUnits: 3, factor: 1000)
static let TOP: Currency = Currency(code: "TOP", minorUnits: 2, factor: 100)
static let TRY: Currency = Currency(code: "TRY", minorUnits: 2, factor: 100)
static let TTD: Currency = Currency(code: "TTD", minorUnits: 2, factor: 100)
static let TWD: Currency = Currency(code: "TWD", minorUnits: 2, factor: 100)
static let TZS: Currency = Currency(code: "TZS", minorUnits: 2, factor: 100)
static let UAH: Currency = Currency(code: "UAH", minorUnits: 2, factor: 100)
static let UGX: Currency = Currency(code: "UGX", minorUnits: 0, factor: 1)
static let USD: Currency = Currency(code: "USD", minorUnits: 2, factor: 100)
static let USN: Currency = Currency(code: "USN", minorUnits: 2, factor: 100)
static let UYI: Currency = Currency(code: "UYI", minorUnits: 0, factor: 1)
static let UYU: Currency = Currency(code: "UYU", minorUnits: 2, factor: 100)
static let UYW: Currency = Currency(code: "UYW", minorUnits: 4, factor: 10000)
static let UZS: Currency = Currency(code: "UZS", minorUnits: 2, factor: 100)
static let VED: Currency = Currency(code: "VED", minorUnits: 2, factor: 100)
static let VES: Currency = Currency(code: "VES", minorUnits: 2, factor: 100)
static let VND: Currency = Currency(code: "VND", minorUnits: 0, factor: 1)
static let VUV: Currency = Currency(code: "VUV", minorUnits: 0, factor: 1)
static let WST: Currency = Currency(code: "WST", minorUnits: 2, factor: 100)
static let XAF: Currency = Currency(code: "XAF", minorUnits: 0, factor: 1)
static let XAG: Currency = Currency(code: "XAG", minorUnits: 0, factor: 1)
static let XAU: Currency = Currency(code: "XAU", minorUnits: 0, factor: 1)
static let XBA: Currency = Currency(code: "XBA", minorUnits: 0, factor: 1)
static let XBB: Currency = Currency(code: "XBB", minorUnits: 0, factor: 1)
static let XBC: Currency = Currency(code: "XBC", minorUnits: 0, factor: 1)
static let XBD: Currency = Currency(code: "XBD", minorUnits: 0, factor: 1)
static let XCD: Currency = Currency(code: "XCD", minorUnits: 2, factor: 100)
static let XDR: Currency = Currency(code: "XDR", minorUnits: 0, factor: 1)
static let XOF: Currency = Currency(code: "XOF", minorUnits: 0, factor: 1)
static let XPD: Currency = Currency(code: "XPD", minorUnits: 0, factor: 1)
static let XPF: Currency = Currency(code: "XPF", minorUnits: 0, factor: 1)
static let XPT: Currency = Currency(code: "XPT", minorUnits: 0, factor: 1)
static let XSU: Currency = Currency(code: "XSU", minorUnits: 0, factor: 1)
static let XTS: Currency = Currency(code: "XTS", minorUnits: 0, factor: 1)
static let XUA: Currency = Currency(code: "XUA", minorUnits: 0, factor: 1)
static let XXX: Currency = Currency(code: "XXX", minorUnits: 0, factor: 1)
static let YER: Currency = Currency(code: "YER", minorUnits: 2, factor: 100)
static let ZAR: Currency = Currency(code: "ZAR", minorUnits: 2, factor: 100)
static let ZMW: Currency = Currency(code: "ZMW", minorUnits: 2, factor: 100)
static let ZWL: Currency = Currency(code: "ZWL", minorUnits: 2, factor: 100)
static let allCurrencies: [String: Currency] =
[
"AED": AED,
"AFN": AFN,
"ALL": ALL,
"AMD": AMD,
"ANG": ANG,
"AOA": AOA,
"ARS": ARS,
"AUD": AUD,
"AWG": AWG,
"AZN": AZN,
"BAM": BAM,
"BBD": BBD,
"BDT": BDT,
"BGN": BGN,
"BHD": BHD,
"BIF": BIF,
"BMD": BMD,
"BND": BND,
"BOB": BOB,
"BOV": BOV,
"BRL": BRL,
"BSD": BSD,
"BTN": BTN,
"BWP": BWP,
"BYN": BYN,
"BZD": BZD,
"CAD": CAD,
"CDF": CDF,
"CHE": CHE,
"CHF": CHF,
"CHW": CHW,
"CLF": CLF,
"CLP": CLP,
"CNY": CNY,
"COP": COP,
"COU": COU,
"CRC": CRC,
"CUC": CUC,
"CUP": CUP,
"CVE": CVE,
"CZK": CZK,
"DJF": DJF,
"DKK": DKK,
"DOP": DOP,
"DZD": DZD,
"EGP": EGP,
"ERN": ERN,
"ETB": ETB,
"EUR": EUR,
"FJD": FJD,
"FKP": FKP,
"GBP": GBP,
"GEL": GEL,
"GHS": GHS,
"GIP": GIP,
"GMD": GMD,
"GNF": GNF,
"GTQ": GTQ,
"GYD": GYD,
"HKD": HKD,
"HNL": HNL,
"HTG": HTG,
"HUF": HUF,
"IDR": IDR,
"ILS": ILS,
"INR": INR,
"IQD": IQD,
"IRR": IRR,
"ISK": ISK,
"JMD": JMD,
"JOD": JOD,
"JPY": JPY,
"KES": KES,
"KGS": KGS,
"KHR": KHR,
"KMF": KMF,
"KPW": KPW,
"KRW": KRW,
"KWD": KWD,
"KYD": KYD,
"KZT": KZT,
"LAK": LAK,
"LBP": LBP,
"LKR": LKR,
"LRD": LRD,
"LSL": LSL,
"LYD": LYD,
"MAD": MAD,
"MDL": MDL,
"MGA": MGA,
"MKD": MKD,
"MMK": MMK,
"MNT": MNT,
"MOP": MOP,
"MRU": MRU,
"MUR": MUR,
"MVR": MVR,
"MWK": MWK,
"MXN": MXN,
"MXV": MXV,
"MYR": MYR,
"MZN": MZN,
"NAD": NAD,
"NGN": NGN,
"NIO": NIO,
"NOK": NOK,
"NPR": NPR,
"NZD": NZD,
"OMR": OMR,
"PAB": PAB,
"PEN": PEN,
"PGK": PGK,
"PHP": PHP,
"PKR": PKR,
"PLN": PLN,
"PYG": PYG,
"QAR": QAR,
"RON": RON,
"RSD": RSD,
"RUB": RUB,
"RWF": RWF,
"SAR": SAR,
"SBD": SBD,
"SCR": SCR,
"SDG": SDG,
"SEK": SEK,
"SGD": SGD,
"SHP": SHP,
"SLE": SLE,
"SLL": SLL,
"SOS": SOS,
"SRD": SRD,
"SSP": SSP,
"STN": STN,
"SVC": SVC,
"SYP": SYP,
"SZL": SZL,
"THB": THB,
"TJS": TJS,
"TMT": TMT,
"TND": TND,
"TOP": TOP,
"TRY": TRY,
"TTD": TTD,
"TWD": TWD,
"TZS": TZS,
"UAH": UAH,
"UGX": UGX,
"USD": USD,
"USN": USN,
"UYI": UYI,
"UYU": UYU,
"UYW": UYW,
"UZS": UZS,
"VED": VED,
"VES": VES,
"VND": VND,
"VUV": VUV,
"WST": WST,
"XAF": XAF,
"XAG": XAG,
"XAU": XAU,
"XBA": XBA,
"XBB": XBB,
"XBC": XBC,
"XBD": XBD,
"XCD": XCD,
"XDR": XDR,
"XOF": XOF,
"XPD": XPD,
"XPF": XPF,
"XPT": XPT,
"XSU": XSU,
"XTS": XTS,
"XUA": XUA,
"XXX": XXX,
"YER": YER,
"ZAR": ZAR,
"ZMW": ZMW,
"ZWL": ZWL
]
/// Look up a currency struct containing currency and formatting information
///
/// - Parameter code: The `ISO 4217` currency code to search for
/// - Returns: A `Currency` object, if supported. Otherwise nil.
class func currency(for code: String) -> Currency? {
return allCurrencies[code]
}
}

362
vendor/github.com/ladydascalie/currency/std_currency.js generated vendored Normal file
View File

@ -0,0 +1,362 @@
var stdCurrency = {
// AED currency object
AED: { code: "AED", name: "UAE Dirham" minorUnits: 2, factor: 100},
// AFN currency object
AFN: { code: "AFN", name: "Afghani" minorUnits: 2, factor: 100},
// ALL currency object
ALL: { code: "ALL", name: "Lek" minorUnits: 2, factor: 100},
// AMD currency object
AMD: { code: "AMD", name: "Armenian Dram" minorUnits: 2, factor: 100},
// ANG currency object
ANG: { code: "ANG", name: "Netherlands Antillean Guilder" minorUnits: 2, factor: 100},
// AOA currency object
AOA: { code: "AOA", name: "Kwanza" minorUnits: 2, factor: 100},
// ARS currency object
ARS: { code: "ARS", name: "Argentine Peso" minorUnits: 2, factor: 100},
// AUD currency object
AUD: { code: "AUD", name: "Australian Dollar" minorUnits: 2, factor: 100},
// AWG currency object
AWG: { code: "AWG", name: "Aruban Florin" minorUnits: 2, factor: 100},
// AZN currency object
AZN: { code: "AZN", name: "Azerbaijan Manat" minorUnits: 2, factor: 100},
// BAM currency object
BAM: { code: "BAM", name: "Convertible Mark" minorUnits: 2, factor: 100},
// BBD currency object
BBD: { code: "BBD", name: "Barbados Dollar" minorUnits: 2, factor: 100},
// BDT currency object
BDT: { code: "BDT", name: "Taka" minorUnits: 2, factor: 100},
// BGN currency object
BGN: { code: "BGN", name: "Bulgarian Lev" minorUnits: 2, factor: 100},
// BHD currency object
BHD: { code: "BHD", name: "Bahraini Dinar" minorUnits: 3, factor: 1000},
// BIF currency object
BIF: { code: "BIF", name: "Burundi Franc" minorUnits: 0, factor: 1},
// BMD currency object
BMD: { code: "BMD", name: "Bermudian Dollar" minorUnits: 2, factor: 100},
// BND currency object
BND: { code: "BND", name: "Brunei Dollar" minorUnits: 2, factor: 100},
// BOB currency object
BOB: { code: "BOB", name: "Boliviano" minorUnits: 2, factor: 100},
// BOV currency object
BOV: { code: "BOV", name: "Mvdol" minorUnits: 2, factor: 100},
// BRL currency object
BRL: { code: "BRL", name: "Brazilian Real" minorUnits: 2, factor: 100},
// BSD currency object
BSD: { code: "BSD", name: "Bahamian Dollar" minorUnits: 2, factor: 100},
// BTN currency object
BTN: { code: "BTN", name: "Ngultrum" minorUnits: 2, factor: 100},
// BWP currency object
BWP: { code: "BWP", name: "Pula" minorUnits: 2, factor: 100},
// BYN currency object
BYN: { code: "BYN", name: "Belarusian Ruble" minorUnits: 2, factor: 100},
// BZD currency object
BZD: { code: "BZD", name: "Belize Dollar" minorUnits: 2, factor: 100},
// CAD currency object
CAD: { code: "CAD", name: "Canadian Dollar" minorUnits: 2, factor: 100},
// CDF currency object
CDF: { code: "CDF", name: "Congolese Franc" minorUnits: 2, factor: 100},
// CHE currency object
CHE: { code: "CHE", name: "WIR Euro" minorUnits: 2, factor: 100},
// CHF currency object
CHF: { code: "CHF", name: "Swiss Franc" minorUnits: 2, factor: 100},
// CHW currency object
CHW: { code: "CHW", name: "WIR Franc" minorUnits: 2, factor: 100},
// CLF currency object
CLF: { code: "CLF", name: "Unidad de Fomento" minorUnits: 4, factor: 10000},
// CLP currency object
CLP: { code: "CLP", name: "Chilean Peso" minorUnits: 0, factor: 1},
// CNY currency object
CNY: { code: "CNY", name: "Yuan Renminbi" minorUnits: 2, factor: 100},
// COP currency object
COP: { code: "COP", name: "Colombian Peso" minorUnits: 2, factor: 100},
// COU currency object
COU: { code: "COU", name: "Unidad de Valor Real" minorUnits: 2, factor: 100},
// CRC currency object
CRC: { code: "CRC", name: "Costa Rican Colon" minorUnits: 2, factor: 100},
// CUC currency object
CUC: { code: "CUC", name: "Peso Convertible" minorUnits: 2, factor: 100},
// CUP currency object
CUP: { code: "CUP", name: "Cuban Peso" minorUnits: 2, factor: 100},
// CVE currency object
CVE: { code: "CVE", name: "Cabo Verde Escudo" minorUnits: 2, factor: 100},
// CZK currency object
CZK: { code: "CZK", name: "Czech Koruna" minorUnits: 2, factor: 100},
// DJF currency object
DJF: { code: "DJF", name: "Djibouti Franc" minorUnits: 0, factor: 1},
// DKK currency object
DKK: { code: "DKK", name: "Danish Krone" minorUnits: 2, factor: 100},
// DOP currency object
DOP: { code: "DOP", name: "Dominican Peso" minorUnits: 2, factor: 100},
// DZD currency object
DZD: { code: "DZD", name: "Algerian Dinar" minorUnits: 2, factor: 100},
// EGP currency object
EGP: { code: "EGP", name: "Egyptian Pound" minorUnits: 2, factor: 100},
// ERN currency object
ERN: { code: "ERN", name: "Nakfa" minorUnits: 2, factor: 100},
// ETB currency object
ETB: { code: "ETB", name: "Ethiopian Birr" minorUnits: 2, factor: 100},
// EUR currency object
EUR: { code: "EUR", name: "Euro" minorUnits: 2, factor: 100},
// FJD currency object
FJD: { code: "FJD", name: "Fiji Dollar" minorUnits: 2, factor: 100},
// FKP currency object
FKP: { code: "FKP", name: "Falkland Islands Pound" minorUnits: 2, factor: 100},
// GBP currency object
GBP: { code: "GBP", name: "Pound Sterling" minorUnits: 2, factor: 100},
// GEL currency object
GEL: { code: "GEL", name: "Lari" minorUnits: 2, factor: 100},
// GHS currency object
GHS: { code: "GHS", name: "Ghana Cedi" minorUnits: 2, factor: 100},
// GIP currency object
GIP: { code: "GIP", name: "Gibraltar Pound" minorUnits: 2, factor: 100},
// GMD currency object
GMD: { code: "GMD", name: "Dalasi" minorUnits: 2, factor: 100},
// GNF currency object
GNF: { code: "GNF", name: "Guinean Franc" minorUnits: 0, factor: 1},
// GTQ currency object
GTQ: { code: "GTQ", name: "Quetzal" minorUnits: 2, factor: 100},
// GYD currency object
GYD: { code: "GYD", name: "Guyana Dollar" minorUnits: 2, factor: 100},
// HKD currency object
HKD: { code: "HKD", name: "Hong Kong Dollar" minorUnits: 2, factor: 100},
// HNL currency object
HNL: { code: "HNL", name: "Lempira" minorUnits: 2, factor: 100},
// HTG currency object
HTG: { code: "HTG", name: "Gourde" minorUnits: 2, factor: 100},
// HUF currency object
HUF: { code: "HUF", name: "Forint" minorUnits: 2, factor: 100},
// IDR currency object
IDR: { code: "IDR", name: "Rupiah" minorUnits: 2, factor: 100},
// ILS currency object
ILS: { code: "ILS", name: "New Israeli Sheqel" minorUnits: 2, factor: 100},
// INR currency object
INR: { code: "INR", name: "Indian Rupee" minorUnits: 2, factor: 100},
// IQD currency object
IQD: { code: "IQD", name: "Iraqi Dinar" minorUnits: 3, factor: 1000},
// IRR currency object
IRR: { code: "IRR", name: "Iranian Rial" minorUnits: 2, factor: 100},
// ISK currency object
ISK: { code: "ISK", name: "Iceland Krona" minorUnits: 0, factor: 1},
// JMD currency object
JMD: { code: "JMD", name: "Jamaican Dollar" minorUnits: 2, factor: 100},
// JOD currency object
JOD: { code: "JOD", name: "Jordanian Dinar" minorUnits: 3, factor: 1000},
// JPY currency object
JPY: { code: "JPY", name: "Yen" minorUnits: 0, factor: 1},
// KES currency object
KES: { code: "KES", name: "Kenyan Shilling" minorUnits: 2, factor: 100},
// KGS currency object
KGS: { code: "KGS", name: "Som" minorUnits: 2, factor: 100},
// KHR currency object
KHR: { code: "KHR", name: "Riel" minorUnits: 2, factor: 100},
// KMF currency object
KMF: { code: "KMF", name: "Comorian Franc " minorUnits: 0, factor: 1},
// KPW currency object
KPW: { code: "KPW", name: "North Korean Won" minorUnits: 2, factor: 100},
// KRW currency object
KRW: { code: "KRW", name: "Won" minorUnits: 0, factor: 1},
// KWD currency object
KWD: { code: "KWD", name: "Kuwaiti Dinar" minorUnits: 3, factor: 1000},
// KYD currency object
KYD: { code: "KYD", name: "Cayman Islands Dollar" minorUnits: 2, factor: 100},
// KZT currency object
KZT: { code: "KZT", name: "Tenge" minorUnits: 2, factor: 100},
// LAK currency object
LAK: { code: "LAK", name: "Lao Kip" minorUnits: 2, factor: 100},
// LBP currency object
LBP: { code: "LBP", name: "Lebanese Pound" minorUnits: 2, factor: 100},
// LKR currency object
LKR: { code: "LKR", name: "Sri Lanka Rupee" minorUnits: 2, factor: 100},
// LRD currency object
LRD: { code: "LRD", name: "Liberian Dollar" minorUnits: 2, factor: 100},
// LSL currency object
LSL: { code: "LSL", name: "Loti" minorUnits: 2, factor: 100},
// LYD currency object
LYD: { code: "LYD", name: "Libyan Dinar" minorUnits: 3, factor: 1000},
// MAD currency object
MAD: { code: "MAD", name: "Moroccan Dirham" minorUnits: 2, factor: 100},
// MDL currency object
MDL: { code: "MDL", name: "Moldovan Leu" minorUnits: 2, factor: 100},
// MGA currency object
MGA: { code: "MGA", name: "Malagasy Ariary" minorUnits: 2, factor: 100},
// MKD currency object
MKD: { code: "MKD", name: "Denar" minorUnits: 2, factor: 100},
// MMK currency object
MMK: { code: "MMK", name: "Kyat" minorUnits: 2, factor: 100},
// MNT currency object
MNT: { code: "MNT", name: "Tugrik" minorUnits: 2, factor: 100},
// MOP currency object
MOP: { code: "MOP", name: "Pataca" minorUnits: 2, factor: 100},
// MRU currency object
MRU: { code: "MRU", name: "Ouguiya" minorUnits: 2, factor: 100},
// MUR currency object
MUR: { code: "MUR", name: "Mauritius Rupee" minorUnits: 2, factor: 100},
// MVR currency object
MVR: { code: "MVR", name: "Rufiyaa" minorUnits: 2, factor: 100},
// MWK currency object
MWK: { code: "MWK", name: "Malawi Kwacha" minorUnits: 2, factor: 100},
// MXN currency object
MXN: { code: "MXN", name: "Mexican Peso" minorUnits: 2, factor: 100},
// MXV currency object
MXV: { code: "MXV", name: "Mexican Unidad de Inversion (UDI)" minorUnits: 2, factor: 100},
// MYR currency object
MYR: { code: "MYR", name: "Malaysian Ringgit" minorUnits: 2, factor: 100},
// MZN currency object
MZN: { code: "MZN", name: "Mozambique Metical" minorUnits: 2, factor: 100},
// NAD currency object
NAD: { code: "NAD", name: "Namibia Dollar" minorUnits: 2, factor: 100},
// NGN currency object
NGN: { code: "NGN", name: "Naira" minorUnits: 2, factor: 100},
// NIO currency object
NIO: { code: "NIO", name: "Cordoba Oro" minorUnits: 2, factor: 100},
// NOK currency object
NOK: { code: "NOK", name: "Norwegian Krone" minorUnits: 2, factor: 100},
// NPR currency object
NPR: { code: "NPR", name: "Nepalese Rupee" minorUnits: 2, factor: 100},
// NZD currency object
NZD: { code: "NZD", name: "New Zealand Dollar" minorUnits: 2, factor: 100},
// OMR currency object
OMR: { code: "OMR", name: "Rial Omani" minorUnits: 3, factor: 1000},
// PAB currency object
PAB: { code: "PAB", name: "Balboa" minorUnits: 2, factor: 100},
// PEN currency object
PEN: { code: "PEN", name: "Sol" minorUnits: 2, factor: 100},
// PGK currency object
PGK: { code: "PGK", name: "Kina" minorUnits: 2, factor: 100},
// PHP currency object
PHP: { code: "PHP", name: "Philippine Peso" minorUnits: 2, factor: 100},
// PKR currency object
PKR: { code: "PKR", name: "Pakistan Rupee" minorUnits: 2, factor: 100},
// PLN currency object
PLN: { code: "PLN", name: "Zloty" minorUnits: 2, factor: 100},
// PYG currency object
PYG: { code: "PYG", name: "Guarani" minorUnits: 0, factor: 1},
// QAR currency object
QAR: { code: "QAR", name: "Qatari Rial" minorUnits: 2, factor: 100},
// RON currency object
RON: { code: "RON", name: "Romanian Leu" minorUnits: 2, factor: 100},
// RSD currency object
RSD: { code: "RSD", name: "Serbian Dinar" minorUnits: 2, factor: 100},
// RUB currency object
RUB: { code: "RUB", name: "Russian Ruble" minorUnits: 2, factor: 100},
// RWF currency object
RWF: { code: "RWF", name: "Rwanda Franc" minorUnits: 0, factor: 1},
// SAR currency object
SAR: { code: "SAR", name: "Saudi Riyal" minorUnits: 2, factor: 100},
// SBD currency object
SBD: { code: "SBD", name: "Solomon Islands Dollar" minorUnits: 2, factor: 100},
// SCR currency object
SCR: { code: "SCR", name: "Seychelles Rupee" minorUnits: 2, factor: 100},
// SDG currency object
SDG: { code: "SDG", name: "Sudanese Pound" minorUnits: 2, factor: 100},
// SEK currency object
SEK: { code: "SEK", name: "Swedish Krona" minorUnits: 2, factor: 100},
// SGD currency object
SGD: { code: "SGD", name: "Singapore Dollar" minorUnits: 2, factor: 100},
// SHP currency object
SHP: { code: "SHP", name: "Saint Helena Pound" minorUnits: 2, factor: 100},
// SLE currency object
SLE: { code: "SLE", name: "Leone" minorUnits: 2, factor: 100},
// SLL currency object
SLL: { code: "SLL", name: "Leone" minorUnits: 2, factor: 100},
// SOS currency object
SOS: { code: "SOS", name: "Somali Shilling" minorUnits: 2, factor: 100},
// SRD currency object
SRD: { code: "SRD", name: "Surinam Dollar" minorUnits: 2, factor: 100},
// SSP currency object
SSP: { code: "SSP", name: "South Sudanese Pound" minorUnits: 2, factor: 100},
// STN currency object
STN: { code: "STN", name: "Dobra" minorUnits: 2, factor: 100},
// SVC currency object
SVC: { code: "SVC", name: "El Salvador Colon" minorUnits: 2, factor: 100},
// SYP currency object
SYP: { code: "SYP", name: "Syrian Pound" minorUnits: 2, factor: 100},
// SZL currency object
SZL: { code: "SZL", name: "Lilangeni" minorUnits: 2, factor: 100},
// THB currency object
THB: { code: "THB", name: "Baht" minorUnits: 2, factor: 100},
// TJS currency object
TJS: { code: "TJS", name: "Somoni" minorUnits: 2, factor: 100},
// TMT currency object
TMT: { code: "TMT", name: "Turkmenistan New Manat" minorUnits: 2, factor: 100},
// TND currency object
TND: { code: "TND", name: "Tunisian Dinar" minorUnits: 3, factor: 1000},
// TOP currency object
TOP: { code: "TOP", name: "Paanga" minorUnits: 2, factor: 100},
// TRY currency object
TRY: { code: "TRY", name: "Turkish Lira" minorUnits: 2, factor: 100},
// TTD currency object
TTD: { code: "TTD", name: "Trinidad and Tobago Dollar" minorUnits: 2, factor: 100},
// TWD currency object
TWD: { code: "TWD", name: "New Taiwan Dollar" minorUnits: 2, factor: 100},
// TZS currency object
TZS: { code: "TZS", name: "Tanzanian Shilling" minorUnits: 2, factor: 100},
// UAH currency object
UAH: { code: "UAH", name: "Hryvnia" minorUnits: 2, factor: 100},
// UGX currency object
UGX: { code: "UGX", name: "Uganda Shilling" minorUnits: 0, factor: 1},
// USD currency object
USD: { code: "USD", name: "US Dollar" minorUnits: 2, factor: 100},
// USN currency object
USN: { code: "USN", name: "US Dollar (Next day)" minorUnits: 2, factor: 100},
// UYI currency object
UYI: { code: "UYI", name: "Uruguay Peso en Unidades Indexadas (UI)" minorUnits: 0, factor: 1},
// UYU currency object
UYU: { code: "UYU", name: "Peso Uruguayo" minorUnits: 2, factor: 100},
// UYW currency object
UYW: { code: "UYW", name: "Unidad Previsional" minorUnits: 4, factor: 10000},
// UZS currency object
UZS: { code: "UZS", name: "Uzbekistan Sum" minorUnits: 2, factor: 100},
// VED currency object
VED: { code: "VED", name: "Bolívar Soberano" minorUnits: 2, factor: 100},
// VES currency object
VES: { code: "VES", name: "Bolívar Soberano" minorUnits: 2, factor: 100},
// VND currency object
VND: { code: "VND", name: "Dong" minorUnits: 0, factor: 1},
// VUV currency object
VUV: { code: "VUV", name: "Vatu" minorUnits: 0, factor: 1},
// WST currency object
WST: { code: "WST", name: "Tala" minorUnits: 2, factor: 100},
// XAF currency object
XAF: { code: "XAF", name: "CFA Franc BEAC" minorUnits: 0, factor: 1},
// XAG currency object
XAG: { code: "XAG", name: "Silver" minorUnits: 0, factor: 1},
// XAU currency object
XAU: { code: "XAU", name: "Gold" minorUnits: 0, factor: 1},
// XBA currency object
XBA: { code: "XBA", name: "Bond Markets Unit European Composite Unit (EURCO)" minorUnits: 0, factor: 1},
// XBB currency object
XBB: { code: "XBB", name: "Bond Markets Unit European Monetary Unit (E.M.U.-6)" minorUnits: 0, factor: 1},
// XBC currency object
XBC: { code: "XBC", name: "Bond Markets Unit European Unit of Account 9 (E.U.A.-9)" minorUnits: 0, factor: 1},
// XBD currency object
XBD: { code: "XBD", name: "Bond Markets Unit European Unit of Account 17 (E.U.A.-17)" minorUnits: 0, factor: 1},
// XCD currency object
XCD: { code: "XCD", name: "East Caribbean Dollar" minorUnits: 2, factor: 100},
// XDR currency object
XDR: { code: "XDR", name: "SDR (Special Drawing Right)" minorUnits: 0, factor: 1},
// XOF currency object
XOF: { code: "XOF", name: "CFA Franc BCEAO" minorUnits: 0, factor: 1},
// XPD currency object
XPD: { code: "XPD", name: "Palladium" minorUnits: 0, factor: 1},
// XPF currency object
XPF: { code: "XPF", name: "CFP Franc" minorUnits: 0, factor: 1},
// XPT currency object
XPT: { code: "XPT", name: "Platinum" minorUnits: 0, factor: 1},
// XSU currency object
XSU: { code: "XSU", name: "Sucre" minorUnits: 0, factor: 1},
// XTS currency object
XTS: { code: "XTS", name: "Codes specifically reserved for testing purposes" minorUnits: 0, factor: 1},
// XUA currency object
XUA: { code: "XUA", name: "ADB Unit of Account" minorUnits: 0, factor: 1},
// XXX currency object
XXX: { code: "XXX", name: "The codes assigned for transactions where no currency is involved" minorUnits: 0, factor: 1},
// YER currency object
YER: { code: "YER", name: "Yemeni Rial" minorUnits: 2, factor: 100},
// ZAR currency object
ZAR: { code: "ZAR", name: "Rand" minorUnits: 2, factor: 100},
// ZMW currency object
ZMW: { code: "ZMW", name: "Zambian Kwacha" minorUnits: 2, factor: 100},
// ZWL currency object
ZWL: { code: "ZWL", name: "Zimbabwe Dollar" minorUnits: 2, factor: 100}
};

View File

@ -1,23 +0,0 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test

View File

@ -1,5 +0,0 @@
test: constants.go
go test -v
constants.go: src/iso4217-table.xml src/update.go
go run src/update.go < src/iso4217-table.xml | gofmt > $@

View File

@ -1,6 +0,0 @@
iso4217
=======
[![Go Reference](https://pkg.go.dev/badge/github.com/rmg/iso4217.svg)](https://pkg.go.dev/github.com/rmg/iso4217)
Golang convenience library containing ISO 4217 currency codes

View File

@ -1,570 +0,0 @@
// Package iso4217 is a convenience library containing ISO 4217 currency codes
package iso4217
var names = map[int]string{
0: "",
8: "ALL",
12: "DZD",
32: "ARS",
36: "AUD",
44: "BSD",
48: "BHD",
50: "BDT",
51: "AMD",
52: "BBD",
60: "BMD",
64: "BTN",
68: "BOB",
72: "BWP",
84: "BZD",
90: "SBD",
96: "BND",
104: "MMK",
108: "BIF",
116: "KHR",
124: "CAD",
132: "CVE",
136: "KYD",
144: "LKR",
152: "CLP",
156: "CNY",
170: "COP",
174: "KMF",
188: "CRC",
191: "HRK",
192: "CUP",
203: "CZK",
208: "DKK",
214: "DOP",
222: "SVC",
230: "ETB",
232: "ERN",
238: "FKP",
242: "FJD",
262: "DJF",
270: "GMD",
292: "GIP",
320: "GTQ",
324: "GNF",
328: "GYD",
332: "HTG",
340: "HNL",
344: "HKD",
348: "HUF",
352: "ISK",
356: "INR",
360: "IDR",
364: "IRR",
368: "IQD",
376: "ILS",
388: "JMD",
392: "JPY",
398: "KZT",
400: "JOD",
404: "KES",
408: "KPW",
410: "KRW",
414: "KWD",
417: "KGS",
418: "LAK",
422: "LBP",
426: "LSL",
430: "LRD",
434: "LYD",
446: "MOP",
454: "MWK",
458: "MYR",
462: "MVR",
480: "MUR",
484: "MXN",
496: "MNT",
498: "MDL",
504: "MAD",
512: "OMR",
516: "NAD",
524: "NPR",
532: "ANG",
533: "AWG",
548: "VUV",
554: "NZD",
558: "NIO",
566: "NGN",
578: "NOK",
586: "PKR",
590: "PAB",
598: "PGK",
600: "PYG",
604: "PEN",
608: "PHP",
634: "QAR",
643: "RUB",
646: "RWF",
654: "SHP",
682: "SAR",
690: "SCR",
694: "SLL",
702: "SGD",
704: "VND",
706: "SOS",
710: "ZAR",
728: "SSP",
748: "SZL",
752: "SEK",
756: "CHF",
760: "SYP",
764: "THB",
776: "TOP",
780: "TTD",
784: "AED",
788: "TND",
800: "UGX",
807: "MKD",
818: "EGP",
826: "GBP",
834: "TZS",
840: "USD",
858: "UYU",
860: "UZS",
882: "WST",
886: "YER",
901: "TWD",
925: "SLE",
926: "VED",
927: "UYW",
928: "VES",
929: "MRU",
930: "STN",
931: "CUC",
932: "ZWL",
933: "BYN",
934: "TMT",
936: "GHS",
938: "SDG",
940: "UYI",
941: "RSD",
943: "MZN",
944: "AZN",
946: "RON",
947: "CHE",
948: "CHW",
949: "TRY",
950: "XAF",
951: "XCD",
952: "XOF",
953: "XPF",
955: "XBA",
956: "XBB",
957: "XBC",
958: "XBD",
959: "XAU",
960: "XDR",
961: "XAG",
962: "XPT",
963: "XTS",
964: "XPD",
965: "XUA",
967: "ZMW",
968: "SRD",
969: "MGA",
970: "COU",
971: "AFN",
972: "TJS",
973: "AOA",
975: "BGN",
976: "CDF",
977: "BAM",
978: "EUR",
979: "MXV",
980: "UAH",
981: "GEL",
984: "BOV",
985: "PLN",
986: "BRL",
990: "CLF",
994: "XSU",
997: "USN",
999: "XXX",
}
var codes = map[string]int{
"": 0,
"ALL": 8,
"DZD": 12,
"ARS": 32,
"AUD": 36,
"BSD": 44,
"BHD": 48,
"BDT": 50,
"AMD": 51,
"BBD": 52,
"BMD": 60,
"BTN": 64,
"BOB": 68,
"BWP": 72,
"BZD": 84,
"SBD": 90,
"BND": 96,
"MMK": 104,
"BIF": 108,
"KHR": 116,
"CAD": 124,
"CVE": 132,
"KYD": 136,
"LKR": 144,
"CLP": 152,
"CNY": 156,
"COP": 170,
"KMF": 174,
"CRC": 188,
"HRK": 191,
"CUP": 192,
"CZK": 203,
"DKK": 208,
"DOP": 214,
"SVC": 222,
"ETB": 230,
"ERN": 232,
"FKP": 238,
"FJD": 242,
"DJF": 262,
"GMD": 270,
"GIP": 292,
"GTQ": 320,
"GNF": 324,
"GYD": 328,
"HTG": 332,
"HNL": 340,
"HKD": 344,
"HUF": 348,
"ISK": 352,
"INR": 356,
"IDR": 360,
"IRR": 364,
"IQD": 368,
"ILS": 376,
"JMD": 388,
"JPY": 392,
"KZT": 398,
"JOD": 400,
"KES": 404,
"KPW": 408,
"KRW": 410,
"KWD": 414,
"KGS": 417,
"LAK": 418,
"LBP": 422,
"LSL": 426,
"LRD": 430,
"LYD": 434,
"MOP": 446,
"MWK": 454,
"MYR": 458,
"MVR": 462,
"MUR": 480,
"MXN": 484,
"MNT": 496,
"MDL": 498,
"MAD": 504,
"OMR": 512,
"NAD": 516,
"NPR": 524,
"ANG": 532,
"AWG": 533,
"VUV": 548,
"NZD": 554,
"NIO": 558,
"NGN": 566,
"NOK": 578,
"PKR": 586,
"PAB": 590,
"PGK": 598,
"PYG": 600,
"PEN": 604,
"PHP": 608,
"QAR": 634,
"RUB": 643,
"RWF": 646,
"SHP": 654,
"SAR": 682,
"SCR": 690,
"SLL": 694,
"SGD": 702,
"VND": 704,
"SOS": 706,
"ZAR": 710,
"SSP": 728,
"SZL": 748,
"SEK": 752,
"CHF": 756,
"SYP": 760,
"THB": 764,
"TOP": 776,
"TTD": 780,
"AED": 784,
"TND": 788,
"UGX": 800,
"MKD": 807,
"EGP": 818,
"GBP": 826,
"TZS": 834,
"USD": 840,
"UYU": 858,
"UZS": 860,
"WST": 882,
"YER": 886,
"TWD": 901,
"SLE": 925,
"VED": 926,
"UYW": 927,
"VES": 928,
"MRU": 929,
"STN": 930,
"CUC": 931,
"ZWL": 932,
"BYN": 933,
"TMT": 934,
"GHS": 936,
"SDG": 938,
"UYI": 940,
"RSD": 941,
"MZN": 943,
"AZN": 944,
"RON": 946,
"CHE": 947,
"CHW": 948,
"TRY": 949,
"XAF": 950,
"XCD": 951,
"XOF": 952,
"XPF": 953,
"XBA": 955,
"XBB": 956,
"XBC": 957,
"XBD": 958,
"XAU": 959,
"XDR": 960,
"XAG": 961,
"XPT": 962,
"XTS": 963,
"XPD": 964,
"XUA": 965,
"ZMW": 967,
"SRD": 968,
"MGA": 969,
"COU": 970,
"AFN": 971,
"TJS": 972,
"AOA": 973,
"BGN": 975,
"CDF": 976,
"BAM": 977,
"EUR": 978,
"MXV": 979,
"UAH": 980,
"GEL": 981,
"BOV": 984,
"PLN": 985,
"BRL": 986,
"CLF": 990,
"XSU": 994,
"USN": 997,
"XXX": 999,
}
var minorUnits = map[int]int{
0: 0,
8: 2,
12: 2,
32: 2,
36: 2,
44: 2,
48: 3,
50: 2,
51: 2,
52: 2,
60: 2,
64: 2,
68: 2,
72: 2,
84: 2,
90: 2,
96: 2,
104: 2,
108: 0,
116: 2,
124: 2,
132: 2,
136: 2,
144: 2,
152: 0,
156: 2,
170: 2,
174: 0,
188: 2,
191: 2,
192: 2,
203: 2,
208: 2,
214: 2,
222: 2,
230: 2,
232: 2,
238: 2,
242: 2,
262: 0,
270: 2,
292: 2,
320: 2,
324: 0,
328: 2,
332: 2,
340: 2,
344: 2,
348: 2,
352: 0,
356: 2,
360: 2,
364: 2,
368: 3,
376: 2,
388: 2,
392: 0,
398: 2,
400: 3,
404: 2,
408: 2,
410: 0,
414: 3,
417: 2,
418: 2,
422: 2,
426: 2,
430: 2,
434: 3,
446: 2,
454: 2,
458: 2,
462: 2,
480: 2,
484: 2,
496: 2,
498: 2,
504: 2,
512: 3,
516: 2,
524: 2,
532: 2,
533: 2,
548: 0,
554: 2,
558: 2,
566: 2,
578: 2,
586: 2,
590: 2,
598: 2,
600: 0,
604: 2,
608: 2,
634: 2,
643: 2,
646: 0,
654: 2,
682: 2,
690: 2,
694: 2,
702: 2,
704: 0,
706: 2,
710: 2,
728: 2,
748: 2,
752: 2,
756: 2,
760: 2,
764: 2,
776: 2,
780: 2,
784: 2,
788: 3,
800: 0,
807: 2,
818: 2,
826: 2,
834: 2,
840: 2,
858: 2,
860: 2,
882: 2,
886: 2,
901: 2,
925: 2,
926: 2,
927: 4,
928: 2,
929: 2,
930: 2,
931: 2,
932: 2,
933: 2,
934: 2,
936: 2,
938: 2,
940: 0,
941: 2,
943: 2,
944: 2,
946: 2,
947: 2,
948: 2,
949: 2,
950: 0,
951: 2,
952: 0,
953: 0,
955: 0,
956: 0,
957: 0,
958: 0,
959: 0,
960: 0,
961: 0,
962: 0,
963: 0,
964: 0,
965: 0,
967: 2,
968: 2,
969: 2,
970: 2,
971: 2,
972: 2,
973: 2,
975: 2,
976: 2,
977: 2,
978: 2,
979: 2,
980: 2,
981: 2,
984: 2,
985: 2,
986: 2,
990: 4,
994: 0,
997: 2,
999: 0,
}
// ByCode resolves the given code to the 3 character string and the number of
// minor unit digits to display for the given currency.
func ByCode(n int) (string, int) {
return names[n], minorUnits[n]
}
// ByName resolves the given name to the numeric code and the number of minor
// unit digits to display for the given currency.
func ByName(s string) (int, int) {
code := codes[s]
return code, minorUnits[code]
}

6
vendor/modules.txt vendored
View File

@ -438,6 +438,9 @@ github.com/klauspost/cpuid/v2
# github.com/koron/go-ssdp v0.0.3
## explicit; go 1.17
github.com/koron/go-ssdp
# github.com/ladydascalie/currency v1.6.0
## explicit; go 1.16
github.com/ladydascalie/currency
# github.com/leodido/go-urn v1.2.1
## explicit; go 1.13
github.com/leodido/go-urn
@ -857,9 +860,6 @@ github.com/rivo/uniseg
# github.com/rjeczalik/notify v0.9.2
## explicit
github.com/rjeczalik/notify
# github.com/rmg/iso4217 v1.0.0
## explicit; go 1.12
github.com/rmg/iso4217
# github.com/rs/cors v1.7.0
## explicit
github.com/rs/cors