| 290 | } |
| 291 | |
| 292 | func DecodeUint256String(hexOrDecimal string) (*uint256.Int, error) { |
| 293 | var base = 10 |
| 294 | if strings.HasPrefix(hexOrDecimal, "0x") { |
| 295 | base = 16 |
| 296 | } |
| 297 | b, ok := new(big.Int).SetString(hexOrDecimal, base) |
| 298 | if !ok { |
| 299 | return nil, fmt.Errorf("invalid value") |
| 300 | } |
| 301 | val256, nok := uint256.FromBig(b) |
| 302 | if nok { |
| 303 | return nil, fmt.Errorf("value is too big") |
| 304 | } |
| 305 | return val256, nil |
| 306 | } |
| 307 | |
| 308 | // upload blobs and call putBlobs(bytes32[] memory keys) |
| 309 | // and returns the kv indexes and the data hashes |