+
Skip to content

Conversation

i582
Copy link

@i582 i582 commented Sep 28, 2025

Fixes #83

@i582 i582 changed the title refactor: use base64url instead hardcoded implementation and and toString doc comment refactor: use base64url instead hardcoded implementation and toString doc comment Sep 28, 2025
expect(address.toString({ bounceable: false, urlSafe: false })).toMatch('UQAs9VlT6S776tq3unJcP5Ogsj+ELLunLXuOb1EKcOQi41+E');
expect(address.toString({ bounceable: false, urlSafe: false, testOnly: true })).toMatch('0QAs9VlT6S776tq3unJcP5Ogsj+ELLunLXuOb1EKcOQi4+QO');
});
it('should serialize with urlSafe=false', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These match exactly 5 out of 8 expects from should serialize to friendly form test above. First of them considers urlSafe to be true. Is this intentional?

/**
* Returns address as a string.
*
* @param args optional arguments with the following properties:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't provide documentation for completions/hovers of fields themselves, where it'd be more expected.

I'd suggest to put it directly into the type.

{
    /**
     * If true, returns url-friendly string, otherwise just base64
     * @default true
     */
    urlSafe?: boolean;
    /**
     * If true, returns bounceable address (with 0x11 tag), otherwise — non-bounceable (with 0x51 tag)
     * @default true
     */
    bounceable?: boolean;
    /**
     * If true, returns test-only address (with 0x80 tag), otherwise — non-test-only
     * @default false
     */
    testOnly?: boolean;
}

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

Successfully merging this pull request may close these issues.

Use base64url for Address.toString() instead of hardcoded algorithm

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载