Skip to content

Commit

Permalink
add Buffer polyfill to window global object
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharqiewicz committed Feb 19, 2024
1 parent 738d049 commit 82085f8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/helpers/stellar.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Asset, Keypair, StrKey } from 'stellar-sdk';
import { Buffer } from 'buffer';

// Applying this assignment to the global object here - because Buffer is used only in this file. If Buffer is to be used in several places - it should be added to the global object in the entry file of the application.
// Ref: https://github.com/pendulum-chain/portal/issues/344
window.Buffer = Buffer;

export const StellarPublicKeyPattern = /^G[A-Z0-9]{55}$/;

export const isPublicKey = (str: string) => Boolean(str.match(StellarPublicKeyPattern));
Expand Down

0 comments on commit 82085f8

Please sign in to comment.