(value: string, base: Base = DEFAULT_BASE)
| 45 | * @throws Will throw an error if the base encoding is not supported. |
| 46 | */ |
| 47 | export function carFromString(value: string, base: Base = DEFAULT_BASE): CAR { |
| 48 | const codec = bases[base] |
| 49 | if (codec == null) { |
| 50 | throw new Error(`Unsupported base: ${base}`) |
| 51 | } |
| 52 | return carFactory.fromBytes(codec.decode(value)) |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Encodes a signed event into a CAR format. |
no test coverage detected