diff --git a/x/logic/predicate/address.go b/x/logic/predicate/address.go index 05ddbfa3..d7cb2b34 100644 --- a/x/logic/predicate/address.go +++ b/x/logic/predicate/address.go @@ -23,14 +23,14 @@ import ( // // # Example: // -// - Convert the given bech32 address into base64 encoded byte by unify the prefix of given address (Hrp) and -// the base64 encoded value (Address). +// - Convert the given bech32 address into base64 encoded byte by unify the prefix of given address (Hrp) and +// the base64 encoded value (Address). // -// bech32_address(-(Hrp, Address), 'okp415wn30a9z4uc692s0kkx5fp5d4qfr3ac7sj9dqn'). +// bech32_address(-(Hrp, Address), 'okp415wn30a9z4uc692s0kkx5fp5d4qfr3ac7sj9dqn'). // -// - Convert the given pair of HRP and base64 encoded address byte by unify the Bech32 string encoded value. +// - Convert the given pair of HRP and base64 encoded address byte by unify the Bech32 string encoded value. // -// bech32_address(-('okp4', [163,167,23,244,162,175,49,162,170,15,181,141,68,134,141,168,18,56,247,30]), Bech32). +// bech32_address(-('okp4', [163,167,23,244,162,175,49,162,170,15,181,141,68,134,141,168,18,56,247,30]), Bech32). func Bech32Address(vm *engine.VM, address, bech32 engine.Term, cont engine.Cont, env *engine.Env) *engine.Promise { return engine.Delay(func(ctx context.Context) *engine.Promise { switch b := env.Resolve(bech32).(type) { diff --git a/x/logic/predicate/address_test.go b/x/logic/predicate/address_test.go index b5de1717..69b4adf1 100644 --- a/x/logic/predicate/address_test.go +++ b/x/logic/predicate/address_test.go @@ -85,17 +85,17 @@ func TestBech32(t *testing.T) { }, { query: `bech32_address(-('okp4', ['8956',167,23,244,162,175,49,162,170,15,181,141,68,134,141,168,18,56,247,30]), Bech32).`, - wantError: fmt.Errorf("bech32_address/2: failed convert term to bytes list: invalid term type in list engine.Atom, only integer allowed"), + wantError: fmt.Errorf("bech32_address/2: failed to convert term to bytes list: invalid term type in list engine.Atom, only integer allowed"), wantSuccess: false, }, { query: `bech32_address(-(Hrp, [163,167,23,244,162,175,49,162,170,15,181,141,68,134,141,168,18,56,247,30]), Bech32).`, - wantError: fmt.Errorf("bech32_address/2: HRP should be instantiated when trying convert bytes to bech32"), + wantError: fmt.Errorf("bech32_address/2: HRP should be instantiated"), wantSuccess: false, }, { query: `bech32_address(-('okp4', hey(2)), Bech32).`, - wantError: fmt.Errorf("bech32_address/2: address should be a List of bytes, give hey/1"), + wantError: fmt.Errorf("bech32_address/2: address should be a List of bytes"), wantSuccess: false, }, { @@ -105,7 +105,7 @@ func TestBech32(t *testing.T) { }, { query: `bech32_address(Address, Bech32).`, - wantError: fmt.Errorf("bech32_address/2: you should give at least on instantiated value (Address or Bech32)"), + wantError: fmt.Errorf("bech32_address/2: invalid address type: engine.Variable, should be Compound (Hrp, Address)"), wantSuccess: false, }, }