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

v2AddMetadataToAccount doesn't accept an address with a colon, e.g. "user:1234" #1615

Open
arnarhf opened this issue Jul 21, 2024 · 3 comments

Comments

@arnarhf
Copy link

arnarhf commented Jul 21, 2024

Using v2CreateTransaction you can create a transaction for an address which includes a colon ("user:1234"), e.g.

send EUR/2 500 (
  source = world
  destination = user:1234
)

But you then cannot call v2AddMetadataToAccount for the same address:

await ledger.v2AddMetadataToAccount({
  ledger: ledgerName, 
  address: 'user:1234',
  requestBody: {
    id: 'my-meta-data-value'
  }
})

Using addresses with an underscore works fine ("user_1234"), but it's surprising that a colon doesn't given that it's used in many of your examples.

Using Node, Typescript and "@formance/formance-sdk": "^2.4.4".

@Shiroy
Copy link
Contributor

Shiroy commented Jul 22, 2024

Hey @arnarhf ,

What error do you see exactly?

@arnarhf
Copy link
Author

arnarhf commented Jul 22, 2024

Hi @Shiroy ,

Apologies, I should have included that.

This is what I get when using an address like "deposit:1234" but not when using an address like "deposit_1234".
Note, I'm playing with the kittie tutorial, adapting it to Formance Ledger v2.

c:\dev\Formance\kittie-app-tutorial\node_modules\@formance\formance-sdk\src\sdk\models\errors\v2errorresponse.ts:56
            return new V2ErrorResponse(v);
                   ^
V2ErrorResponse: API error occurred
    at Object.transform (c:\dev\Formance\kittie-app-tutorial\node_modules\@formance\formance-sdk\src\sdk\models\errors\v2errorresponse.ts:56:20)
    at ZodEffects._parse (c:\dev\Formance\kittie-app-tutorial\node_modules\zod\lib\types.js:3224:39)
    at ZodEffects._parseSync (c:\dev\Formance\kittie-app-tutorial\node_modules\zod\lib\types.js:146:29)
    at ZodEffects.safeParse (c:\dev\Formance\kittie-app-tutorial\node_modules\zod\lib\types.js:176:29)
    at ZodEffects.parse (c:\dev\Formance\kittie-app-tutorial\node_modules\zod\lib\types.js:157:29)
    at c:\dev\Formance\kittie-app-tutorial\node_modules\@formance\formance-sdk\src\lib\http.ts:474:57
    at parse (c:\dev\Formance\kittie-app-tutorial\node_modules\@formance\formance-sdk\src\lib\schemas.ts:15:16)
    at ResponseMatcher.match (c:\dev\Formance\kittie-app-tutorial\node_modules\@formance\formance-sdk\src\lib\http.ts:474:27)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Ledger.v2AddMetadataToAccount (c:\dev\Formance\kittie-app-tutorial\node_modules\@formance\formance-sdk\src\sdk\ledger.ts:1821:27) {
  'data$': {
    errorCode: 'VALIDATION',
    errorMessage: 'invalid account address format'
  },
  errorCode: 'VALIDATION',
  errorMessage: 'invalid account address format'
}

@flemzord
Copy link
Member

Hello @arnarhf

We've just released a new version of the SDK that fixes this.

Regards

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

No branches or pull requests

3 participants