Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible bug with field access on Records #67

Closed
kingsleyh opened this issue Aug 7, 2018 · 2 comments
Closed

possible bug with field access on Records #67

kingsleyh opened this issue Aug 7, 2018 · 2 comments
Milestone

Comments

@kingsleyh
Copy link

$$CurrentWallet {wallet: $$EncryptedWalletWithName, balances: Array(2)}
balances
:
(2) [$$TokenPair, $$TokenPair]
wallet
:
$$EncryptedWalletWithName
address
:
"VDBkYWQxZjZlZjllOTAzYzNiODQ0NmZkZTI4NDBhYmMzYjUxYThjM2E1ZjNkODlj"
ciphertext
:
"5a288c40c4b5b518ea83723e2b92d2a69c0144493403a227f684c646f2de959e4c758709b7d890676bbd80555388516f023f4cac215839b87d4c89759720102c418344a63953739c608482b1996155234e5f6e7a129edf39afde3a7467a4e23af1704b9c2079ff91c9a61cb1fad2e69ef466b6b46775d89b27bece4e11de9770f621fdbe2be2363951fbf0856a9970b3db063c3f39406af458cfb5b6e503cc74c2a448813620330ea864fb4c0cd8a59aa76969b70244ccc023d4204e6e152aa61aa381d47862874f40466de8368f40c8ea668ac255c8aaa8ad087137eb400c16107ac57dbaf404809a27bbcb5817a292af524f13eed640bd7f41721223e0fb8acba03567c997fdbdf9f2d18ba79b78765a1f6d967181fd759290340e6a8d29798a9cd3619a1cfca6152d1b1f1350cd3446624f9f565f915ec344963d69ae722132959e91e5a7aeac"
name
:
"w1"
salt
:
"$2a$10$7hWFojLVUwHjLZBqwuqAEe"
source
:
"kajiki"
__proto__
:
Record
__proto__
:
Record

I've got a CurrentWallet record
but when I try to use it - I get an error
Debug.log(currentWallet.wallet)
I just get a cryptic error saying: You are tyring to access a field on an object which is not a record: a
(there's a typo in that message too : tyring instead of trying - although I'm finding it pretty tyring so maybe it's accurate hahah!!
as far as I can see - CurrentWallet is a Record - and EncryptedWalletWithName is a record - and so calling wallet on CurrentWallet should return me an EncryptedWalletWithName - but for some reason - it thinks it's not a record?

I think it may be a bug as it was working fine before the upgrade - this happens in several places the currentWallet record is used.

@kingsleyh
Copy link
Author

kingsleyh commented Aug 7, 2018

I got it working with a workaround:

the original code which started failing after updating to latest master:

senderWalletWithName = currentWallet
                     |> Maybe.toResult("Error getting sender wallet!")

senderWallet = Common.walletWithNametoWallet(senderWalletWithName.wallet)

and then the workaround I used:

senderWalletWithName = currentWallet
                     |> Maybe.map((cw : CurrentWallet) : EncryptedWalletWithName => { cw.wallet } )
                     |> Maybe.toResult("Error getting sender wallet!")

senderWallet = Common.walletWithNametoWallet(senderWalletWithName)

So if I map the Maybe and get out the wallet before converting it to a Result it works - but if I just convert straight to a Result - then the resulting thing - doesn't seem to treated like a Record.

so it seems like a bug to me

@gdotdesign gdotdesign added this to the 0.3 milestone Aug 17, 2018
@gdotdesign
Copy link
Member

It's fixed on master, sorry for fixing this so late 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants